Created
February 22, 2012 00:14
-
-
Save wmene/1880099 to your computer and use it in GitHub Desktop.
Cap recipe to create an rvm gemset before deploy
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
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path. | |
require "rvm/capistrano" # Load RVM's capistrano plugin. | |
set :rvm_ruby_string, "1.8.7@#{application}" # Or whatever env you want it to run in. | |
# Make sure the gemset exists before running deploy:setup | |
def disable_rvm_shell(&block) | |
old_shell = self[:default_shell] | |
self[:default_shell] = nil | |
yield | |
self[:default_shell] = old_shell | |
end | |
task :create_gemset do | |
disable_rvm_shell { run "rvm use #{rvm_ruby_string} --create" } | |
end | |
before "deploy:setup", "create_gemset" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment