Created
November 4, 2012 11:31
-
-
Save akishin/4011493 to your computer and use it in GitHub Desktop.
rbenv_setup.sh
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
#!/bin/sh | |
if [ -d $HOME/.rbenv ] | |
then | |
echo "$HOME/.rbenv already exists." | |
exit 1 | |
fi | |
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
mkdir -p ~/.rbenv/plugins | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
git clone git://github.com/jamis/rbenv-gemset.git ~/.rbenv/plugins/rbenv-gemset | |
SHNAME=`basename $SHELL` | |
if [ $SHNAME = 'bash' ]; then | |
CONF=~/.bash_profile | |
COMPLETION=~/.rbenv/completions/rbenv.bash | |
elif [ $SHNAME = 'zsh' ]; then | |
CONF=~/.zshenv | |
COMPLETION=~/.rbenv/completions/rbenv.zsh | |
fi | |
cat >> $CONF <<'_EOF_' | |
# rbenv setup | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init -)" | |
_EOF_ | |
echo "source $COMPLETION" >> $CONF | |
. $CONF | |
rbenv --help |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment