2

I have a Rails 4.2.0.beta2 application on my production server running on Ruby 2.1.2. I have installed Ruby 2.13 using rbenv but not yet made it global.

On my development machine I have installed Ruby 2.1.3, also using rbenv and run bundle in my application to update the gems for the new ruby version. My gems include

group :development do
  # Use Capistrano for deployment
  gem 'capistrano', '~> 3.2'
  gem 'capistrano-rails', '~> 1.1.1'
  gem 'capistrano-bundler'
  gem 'capistrano-rbenv', '~> 2.0'
  gem 'capistrano-unicorn-nginx', '~> 2.0'
  gem 'capistrano-postgresql', '~> 3.0'
end

I am using Capistrano 3.2.1 and in my deploy.rb file I have set

set :rbenv_type, :user
set :rbenv_ruby, "2.1.3"

My question is, will my Capistrano recipe switch the server ruby version and load all my new gems? I know that it normally loads new gems automatically. Specifically, will capistrano run rbenv global 2.1.3 to change the ruby version and then bundle install?

If I need to do this manually, will changing the ruby global in rbenv cause my application to blow up due to a mismatch in gems? Is the ruby version isolated between applications by rbenv?

I have tried to run this deploy recipe but it fails with

rbenv: bundle: command not found
  The `bundle' command exists in these Ruby versions:
    2.1.2
markhorrocks
  • 1,199
  • 19
  • 82
  • 151
  • check this url, it may helps you http://stackoverflow.com/questions/1978797/how-do-i-configure-capistrano-to-use-my-rvm-version-of-ruby – anusha Oct 15 '14 at 03:34

1 Answers1

1

I had to

rbenv global 2.1.3
gem install bundler
rbenv rehash

Then I ran

cap production deploy

again and it was all good. I have no idea what the ruby_version directive in my deploy.rb is supposed to do.

markhorrocks
  • 1,199
  • 19
  • 82
  • 151
  • This question is 2 years old, and I ran in exactly the same issue. I'm not able to change my global ruby, so did you find a solution? – 23tux Oct 26 '16 at 14:26