Skip to content

Instantly share code, notes, and snippets.

@akishin
Created November 4, 2012 11:31
Show Gist options
  • Save akishin/4011493 to your computer and use it in GitHub Desktop.
Save akishin/4011493 to your computer and use it in GitHub Desktop.
rbenv_setup.sh
#!/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