sudo apt-get install libssl-dev zlib1g zlib1g-dev libreadline-dev bison
# cp rbenv_install.bash /usr/local/rbenv_installer.bash
sudo chgrp sudo /usr/local/rbenv_installer.bash
sudo chmod g+rwxXs /usr/local/rbenv_installer.bash
/usr/local/rbenv_installer.bash
# cp rbenv.sh /etc/profile.d/rbenv.sh
sudo chmod +x /etc/profile.d/rbenv.sh
source /etc/profile.d/rbenv.sh
# cp default-gems /usr/local/rbenv/default-gems
# attempt to downlod $version, else compile it
version=2.1.0 ruby install.rb
Created
September 14, 2014 19:00
-
-
Save bf4/f8ac57c7f73398dafee3 to your computer and use it in GitHub Desktop.
RBenv binaries download
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
bundler | |
foreman | |
god |
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
patches = { | |
# Readline patch ported from Ruby trunk to help 2.1.1 compile on Arch linux | |
# Fixes: | |
# install patched rbenv, else build errors with | |
# readline.c: At top level: | |
# readline.c:634:1: warning: ‘readline_pre_input_hook’ defined but not used [-Wunused-function] | |
# readline_pre_input_hook(void) | |
# ^ | |
# make[2]: *** [readline.o] Error 1 | |
# make[2]: Leaving directory `/tmp/ruby-build.20140814210040.1725/ruby-2.1.0/ext/readline' | |
# make[1]: *** [ext/readline/all] Error 2 | |
# make[1]: Leaving directory `/tmp/ruby-build.20140814210040.1725/ruby-2.1.0' | |
# make: *** [build-ext] Error 2 | |
"2.1.0" => "https://gist.github.com/mislav/a18b9d7f0dc5b9efc162.txt", | |
} | |
compile_command = if patch = patches[version] | |
"curl -fsSL #{path} | rbenv install --patch #{version};" | |
else | |
"rbenv install #{version};" | |
end | |
system <<-EOS | |
. /etc/profile.d/rbenv.sh; | |
ubuntu_version=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d= -f2); | |
echo "Ubuntu version $ubuntu_version"; | |
rbenv download #{version} && \ | |
rbenv shell #{version} && \ | |
ruby -v | grep #{version} || \ | |
echo "Binary install failed: #{version}, $ubuntu_version" && \ | |
#{compile_command} | |
rbenv rehash; | |
rbenv global #{version}; | |
EOS |
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
# Add rbenv to the path: | |
export RBENV_ROOT=/usr/local/rbenv; | |
export PATH="$RBENV_ROOT/bin:$PATH"; | |
eval "$(rbenv init -)"; |
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
#!/usr/bin/env bash | |
# Adapted from https://github.com/fesplugas/rbenv-installer/blob/master/bin/rbenv-installer | |
# Verify Git is installed: | |
if [ ! $(which git) ]; then | |
echo "Git is not installed, can't continue." | |
exit 1 | |
fi | |
if [ -z "${RBENV_ROOT}" ]; then | |
RBENV_ROOT="/usr/local/rbenv" | |
fi | |
# Install rbenv: | |
if [ ! -d "$RBENV_ROOT" ] ; then | |
git clone https://github.com/sstephenson/rbenv.git $RBENV_ROOT | |
chgrp sudo $RBENV_ROOT | |
chmod -R g+rwxXs $RBENV_ROOT | |
else | |
cd $RBENV_ROOT | |
if [ ! -d '.git' ]; then | |
git init | |
git remote add origin https://github.com/sstephenson/rbenv.git | |
fi | |
git pull origin master | |
fi | |
# Install plugins: | |
PLUGINS=( | |
sstephenson/rbenv-vars | |
sstephenson/ruby-build | |
sstephenson/rbenv-default-gems | |
sstephenson/rbenv-gem-rehash | |
garnieretienne/rvm-download | |
) | |
for plugin in ${PLUGINS[@]} ; do | |
KEY=${plugin%%/*} | |
VALUE=${plugin#*/} | |
RBENV_PLUGIN_ROOT="${RBENV_ROOT}/plugins/$VALUE" | |
if [ ! -d "$RBENV_PLUGIN_ROOT" ] ; then | |
git clone https://github.com/$KEY/$VALUE.git $RBENV_PLUGIN_ROOT | |
else | |
cd $RBENV_PLUGIN_ROOT | |
echo "Pulling $VALUE updates." | |
git pull | |
fi | |
done | |
# Show help if `.rbenv` is not in the path: | |
if [ ! $(which rbenv) ]; then | |
echo " | |
Seems you still have not added 'rbenv' to the load path: | |
# ~/.bash_profile: | |
export RBENV_ROOT=\"\${HOME}/.rbenv\" | |
if [ -d \"\${RBENV_ROOT}\" ]; then | |
export PATH=\"\${RBENV_ROOT}/bin:\${PATH}\" | |
eval \"\$(rbenv init -)\" | |
fi | |
" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment