Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to specify "rvmrc" as rvm_ruby_string #4

Merged
merged 4 commits into from May 22, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Expand Up @@ -23,13 +23,16 @@ Example:

set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")
set :rvm_install_ruby_params, '--1.9' # for jruby/rbx default to 1.9 mode

before 'deploy:setup', 'rvm:install_rvm' # install RVM
before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, or:
before 'deploy:setup', 'rvm:create_gemset' # only create gemset

require "rvm/capistrano"

## To use the ruby version currently active locally

set :rvm_ruby_string, :local

## Development

Expand Down
7 changes: 6 additions & 1 deletion lib/rvm/capistrano.rb
Expand Up @@ -12,8 +12,13 @@ def _cset(name, *args, &block)
set :default_shell do
shell = File.join(rvm_bin_path, "rvm-shell")
ruby = rvm_ruby_string.to_s.strip
if "#{ruby}" == "release_path"
case ruby
when "release_path"
shell = "rvm_path=#{rvm_path} #{shell} --path '#{release_path}'"
when "local"
ruby = (ENV['GEM_HOME'] || "").gsub(/.*\//, "")
raise "Failed to get ruby version from GEM_HOME. Please make sure rvm is loaded!" if ruby.empty?
shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'"
else
shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'" unless ruby.empty?
end
Expand Down