views:

889

answers:

2

Does anybody know how I can tell capistrano to use my default rvm version of ruby for on the server I am pushing to. It insists on using the system version.

Is it even possible?

+4  A: 

You have two options:

  1. Enable .ssh environment variables using the PermitUserEnvironment option in your ssh condfiguration file
  2. Use the capistrano :default_environment setting

For the second option, simply add the following line in your deploy.rb file

set :default_environment, { 
  'PATH' => "/path/to/.rvm/ree-1.8.7-2009.10/bin:/path/to/.rvm/gems/ree/1.8.7/bin:/path/to/.rvm/bin:$PATH",
  'RUBY_VERSION' => 'ruby 1.8.7',
  'GEM_HOME' => '/path/to/.rvm/gems/ree/1.8.7',
  'GEM_PATH' => '/path/to/.rvm/gems/ree/1.8.7' 
}

To get the accurate locations have a look at cat ~/.rvm/default

Simone Carletti
your answer is so close that I will just edit it so its correct ...
Sam Saffron
I think the first PATH setting should be `path/to/.rvm/rubies/ree-1.8.7`My RVM installation uses `rubies` anyway as the directory that ruby is actually isntalled
brad
+1  A: 

See http://rvm.beginrescueend.com/integration/capistrano/. "Integration via the rvm capistrano plugin" looks like a winner.

And http://rvm.beginrescueend.com/deployment/

Matt Scilipoti