forked from NZOI/nztrain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update all the installers (sysruby, RVM, rbenv, Travis CI). Reasons against Ruby < 2.3 described in the previous commit. Ruby 2.3 is itself old and has end-of-life scheduled for 2019-03-31. This is a minimal temporary fix, the intention is to eventually update to the latest Ruby version. Rewrite the rbenv install script, use rbenv-installer from https://github.com/rbenv/rbenv-installer and remove the old downloaded copy which was from https://github.com/fesplugas/rbenv-installer (archived: https://web.archive.org/web/20160414060830/https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer).
- Loading branch information
1 parent
b7f183a
commit b55af35
Showing
6 changed files
with
74 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
language: ruby | ||
rvm: | ||
- "2.2.9" | ||
- "2.3.8" | ||
services: | ||
- redis-server | ||
- postgresql | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,76 @@ | ||
#!/usr/bin/env bash | ||
|
||
ruby_version=2.0.0-p353 | ||
ruby_version=2.3.8 | ||
|
||
# detect rbenv | ||
rbenv --version &> /dev/null && { | ||
# install ruby on rbenv | ||
cmd="rbenv install $ruby_version" | ||
echo "$ $cmd" | ||
$cmd | ||
rbenv --version &> /dev/null || { | ||
# install rbenv using rbenv-installer | ||
|
||
curl --version &> /dev/null || { | ||
cmd="sudo apt-get install curl" | ||
echo "$ $cmd" | ||
$cmd || exit 1 | ||
} | ||
|
||
source ~/.bashrc | ||
cmd="rbenv global $ruby_version" | ||
# suggested build environment (https://github.com/rbenv/ruby-build/wiki#suggested-build-environment) | ||
cmd="sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev" | ||
echo "$ $cmd" | ||
$cmd | ||
echo "Ruby $ruby_version installed, restart your session again and re-run this script" | ||
exit 1 | ||
} || { | ||
# install rvm | ||
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv | ||
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | ||
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | ||
$cmd || exit 1 | ||
# as suggested, try installing libgdbm5, if it is not available try with libgdbm3 | ||
# (it should have been installed as a dependency of libgdbm-dev anyway) | ||
cmd="sudo apt-get install libgdbm5" | ||
echo "$ $cmd" | ||
$cmd || { | ||
cmd="sudo apt-get install libgdbm3" | ||
echo "$ $cmd" | ||
$cmd || exit 1 | ||
} | ||
|
||
# install ruby-build | ||
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | ||
# rbenv-installer prints some instructions, make it clear what is | ||
# output from rbenv-installer and what is output from this script. | ||
echo "script/install/rbenv.bash: running rbenv-installer..." | ||
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash | ||
# ignore exit code because rbenv-installer runs rbenv-doctor, which is fussy and reports spurious errors | ||
echo "script/install/rbenv.bash: rbenv-installer finished" | ||
if ! [ -x ~/.rbenv/bin/rbenv ]; then | ||
echo "rbenv-installer appears to have failed, please fix and re-run this script" | ||
exit 1 | ||
fi | ||
|
||
# add some bootstrap scripts | ||
cat `dirname $0`/rbenv-installer | bash | ||
# check if the user wants ~/.bashrc to be configured | ||
# (try to detect if it's already been configured) | ||
configure_bashrc=false | ||
if ! grep -q 'PATH.*\.rbenv/bin' ~/.bashrc; then | ||
# looks like it hasn't been configured yet | ||
if bash script/confirm.bash "Configure ~/.bashrc"; then | ||
configure_bashrc=true | ||
fi | ||
else | ||
# looks like is has already been configured | ||
echo "It looks like ~/.bashrc has already been configured (did you restart the session?)" | ||
if DEFAULT=1 bash script/confirm.bash "Configure ~/.bashrc anyway"; then | ||
configure_bashrc=true | ||
fi | ||
fi | ||
# configure ~/.bashrc (if asked) | ||
if $configure_bashrc; then | ||
echo '$ echo '\''export PATH="$HOME/.rbenv/bin:$PATH"'\'' >> ~/.bashrc' | ||
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | ||
echo '$ echo '\''eval "$(rbenv init -)"'\'' >> ~/.bashrc' | ||
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | ||
fi | ||
|
||
echo "rbenv installed, now restart the session and re-run this script" | ||
echo "You might want to run a bootstrap script to install some ruby dependencies before installing a ruby, eg 'rbenv bootstrap-ubuntu-12-04'" | ||
exit 1 | ||
} | ||
|
||
# install ruby on rbenv | ||
cmd="rbenv install $ruby_version" | ||
echo "$ $cmd" | ||
$cmd || exit 1 | ||
|
||
# TODO: consider using .ruby-version file for project instead of global version | ||
cmd="rbenv global $ruby_version" | ||
echo "$ $cmd" | ||
$cmd || exit 1 | ||
echo "Ruby $ruby_version installed" # no need to restart session |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
ruby_version=2.0.0 | ||
ruby_version=2.3.8 | ||
|
||
# detect rvm | ||
rvm --version &> /dev/null && { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters