Last active
December 17, 2015 19:28
-
-
Save ytnobody/5660098 to your computer and use it in GitHub Desktop.
automated rbenv setup
This file contains hidden or 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 | |
# | |
# rbenvsetup http://is.gd/rbenvsetup | |
# Tue May 28 11:03:00 JST 2013 v0.01 by ytnobody | |
# | |
RBENV_REPO=git://github.com/sstephenson/rbenv.git | |
RBENV_ROOT=$HOME/.rbenv | |
PROF_FILE=$HOME/.bash_profile | |
RUBYBUILDER_REPO=git://github.com/sstephenson/ruby-build.git | |
RBENV_PLUGIN_DIR=$RBENV_ROOT/plugins | |
die () { | |
echo $1 >&2 | |
exit 1 | |
} | |
write_profile () { | |
if [ $(grep "$1" $PROF_FILE | wc -l) -le 0 ] ; then | |
echo "$1" >> $PROF_FILE | |
fi | |
} | |
git --version || die "git is not installed." | |
### setup rbenv | |
git clone $RBENV_REPO $RBENV_ROOT || die "git clone failure : $RBENV_REPO" | |
write_profile 'export RBENV_ROOT=$HOME/.rbenv' | |
write_profile 'export PATH=$PATH:$RBENV_ROOT/bin' | |
write_profile 'eval "$(rbenv init -)"' | |
### setup ruby-builder | |
mkdir $RBENV_PLUGIN_DIR | |
git clone $RUBYBUILDER_REPO $RBENV_PLUGIN_DIR/ruby-build || die "git clone failure : $RUBYBUILDER_REPO" | |
### load profile | |
exec $SHELL -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment