Skip to content

Instantly share code, notes, and snippets.

@yoshuki
Last active March 17, 2018 05:57
Show Gist options
  • Save yoshuki/7615220 to your computer and use it in GitHub Desktop.
Save yoshuki/7615220 to your computer and use it in GitHub Desktop.
#!/bin/sh
RBENV_HOME="$HOME/.rbenv"
if [ "$1" = 'init' ]; then
git clone https://github.com/rbenv/rbenv.git $RBENV_HOME
mkdir $RBENV_HOME/plugins
if [ $? -eq 0 ]; then
cd $RBENV_HOME/plugins
git clone https://github.com/rbenv/ruby-build.git
fi
cd $HOME
echo '=================================================='
cat <<'EOT'
echo 'export RBENV_HOME="${HOME}/.rbenv"' >> $HOME/.zshrc
echo 'export PATH="${RBENV_HOME}/bin:${PATH}"' >> $HOME/.zshrc
echo 'eval "$(rbenv init -)"' >> $HOME/.zshrc
EOT
exit
fi
for dir in '' '/plugins/ruby-build'
do
cd $RBENV_HOME$dir
git pull origin master
cd $HOME
done
echo '=================================================='
rbenv install -l
echo '--------------------------------------------------'
rbenv versions
echo '=================================================='
cat <<EOT
rbenv install [NEW] --verbose
rbenv global [NEW]
gem install bundler
rbenv uninstall [OLD]
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment