Created
February 13, 2012 00:04
-
-
Save joemocha/1811956 to your computer and use it in GitHub Desktop.
rbenv this Mf'er
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
| namespace :rvm do | |
| task :bootstrap do | |
| run "echo 'Overwrote rvm:bootstrap'" | |
| rbenv_script = <<-SH | |
| #!/bin/bash | |
| # | |
| # And now install rbenv | |
| export PATH=$PATH:$HOME/bin:$HOME/.rbenv/shims | |
| VERSION='#{ruby_version}' | |
| HAVE_RBENV_ALREADY=`which rbenv 2>/dev/null` | |
| if [ $? != 0 ]; then | |
| git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
| # Add rbenv to your path | |
| echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"' >> .bash_profile | |
| echo 'eval "$(rbenv init -)"' >> .bash_profile | |
| source ~/.bash_profile | |
| fi; | |
| # Install ruby-build | |
| HAVE_RUBY_BUILD=`which ruby-build 2>/dev/null` | |
| if [ $? != 0 ]; then | |
| cd /tmp | |
| git clone git://github.com/sstephenson/ruby-build.git | |
| cd ruby-build | |
| PREFIX=$HOME ./install.sh | |
| cd $HOME | |
| fi; | |
| # Install Ruby #{ruby_version} | |
| HAVE_CORRECT_VERSION=`rbenv versions | grep $VERSION | wc -l` | |
| if [ $HAVE_CORRECT_VERSION -eq 0 ]; then | |
| rbenv install $VERSION | |
| rbenv global $VERSION | |
| # Rehash! | |
| rbenv rehash | |
| fi; | |
| SH | |
| put rbenv_script, "/tmp/chef-cap-#{rails_env}-rbenv.sh", :mode => "0700" | |
| run "/tmp/chef-cap-#{rails_env}-rbenv.sh" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment