Created
June 4, 2009 16:28
-
-
Save dreamcat4/123695 to your computer and use it in GitHub Desktop.
ruby in .profile
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
export GEM_HOME=$HOME/.gem/ruby/active | |
export PATH=$HOME/.gem/ruby/active/bin:$PATH |
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
# This is the bash version of the zsh script | |
# Load it in your .profile or .bashrc / .login script | |
# Its been tweaked for separate gem directories in $HOME/.gem | |
chruby () | |
{ | |
v=`ruby -e "puts RUBY_VERSION.split('.')[0,2].join('.')"` | |
if [ $v = "1.9" ]; then | |
cv="1.8" | |
cvf="1.8" | |
else | |
cv="1.9" | |
cvf="1.9.1" | |
fi | |
rubyexes=(erb gem irb rake rdoc ri ruby testrb) | |
for i in ${rubyexes[*]}; do | |
sudo unlink "/opt/local/bin/${i}" | |
sudo ln -s "/opt/local/bin/${i}${cv}" "/opt/local/bin/${i}" | |
done | |
unlink "$HOME/.gem/ruby/active" | |
ln -s "$HOME/.gem/ruby/${cvf}" "$HOME/.gem/ruby/active" | |
echo "Now Running: "`ruby -v` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment