rubyrubygemscapistranobundlerrvm-capistrano

rvm-capistrano errors on ruby 2.2.3


I'm attempting to do a deploy using ruby 2.2.3, capistrano, and rvm-capistrano.

When I run:

$ rvm use 2.2.3

And then:

$ cap deploy

The deploy fails and I get this message:

failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell '2.2.0' -c 'git clone -q -b develop --depth 1 <rest of the git clone command>'" on xxx.xxx.xxx.xxx

The server in question doesn't have ruby-2.2.0 installed (just 2.2.3), hence the crash. But it shouldn't need to, because I'm using ruby-2.2.3.

I did some digging and I found that there's an ENV variable, GEM_HOME, that controls which ruby version rvm-capistrano depends on. With my ruby version set using rvm, it seems fine:

$ echo $GEM_HOME
/home/rof/.rvm/gems/ruby-2.2.3

It looks like there is some code inside bundler that changes the GEM_HOME but it feels like a bit of a wild goose change. Wondering if this is a known issue or something that anyone else has come across.

My config/deploy.rb has:

set :rvm_ruby_string, :local  # use the same ruby as used locally for deployment
require "rvm/capistrano"

Solution

  • Not really an answer but I've fixed this up in the meantime by just explicitly stating my ruby version in the capistrano deploy script, rather than relying on :local