8

i seem to have a discrepancy between production's gem path when I installed manually versus by bundler+capistrano.

After rvm installing ruby 1.9.2 and creating a gemset "myapp", i did install bundler via gem install bundler.

It was installed into the path:

/usr/local/rvm/gems/ruby-1.9.2-p290@myapp/gems

Bundler via Capistrano installed the remaining gems into:

/usr/local/rvm/gems/ruby-1.9.2-p290@myapp/ruby/1.9.1/gems

Beginning of my deploy.rb file is:

$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
require 'bundler/capistrano'

set :rails_env,             'production'
set :rvm_type,              :system
set :rvm_ruby_string, "ruby-1.9.2-p290@myapp"
set :rvm_path,              "/usr/local/rvm"
set :rvm_bin_path,      "#{rvm_path}/bin"
set :rvm_lib_path,      "#{rvm_path}/lib"

set :default_environment, {
  'PATH'                    => "#{rvm_path}/gems/ruby/1.9.1/bin:#{rvm_bin_path}/bin:$PATH",
  'RUBY_VERSION'    => '1.9.2',
  'GEM_HOME'        => "#{rvm_path}/gems/#{rvm_ruby_string}",
  'GEM_PATH'        => "#{rvm_path}/gems/#{rvm_ruby_string}",
  'BUNDLE_PATH'     => "#{rvm_path}/gems/#{rvm_ruby_string}"
}

set :bundle_dir,            "#{rvm_path}/gems/#{rvm_ruby_string}"
set :bundle_flags,      "--deployment --verbose"
Michael K Madison
  • 2,242
  • 3
  • 21
  • 35
  • Could you be more specific about the discrepancy? – Benoit Garret Sep 07 '11 at 19:46
  • I bolded the paths. Bundler basically installs to my GEM_PATH+"ruby/1.9.1/gems" instead I want it to go in to my GEM_PATH alone. – Michael K Madison Sep 07 '11 at 20:46
  • Installing gems in the `ruby/1.9.1` subdirectory seems to be the norm: http://stackoverflow.com/questions/6352262/why-does-bundler-install-gems-into-a-1-9-1-directory-when-1-9-2-is-the-only-ruby. Does this cause a problem for you (missing gems, etc)? – Benoit Garret Sep 08 '11 at 08:19
  • That norm makes sense if you aren't using RVM, but it doesn't if you are. If you're using RVM then your rubies and their version names and your gemset is already a part of your GEMPATH name why now should bundle version my gems based on ruby version! It's stupid. – Michael K Madison Sep 19 '11 at 04:17

3 Answers3

1

Annoyingly, bundler folks have no intention on working well with RVM and want bundler to manage ruby versions so the workaround so far for me is to simply symbollically link for ruby and 1.9.1 in my GEM_PATH directory pointing to "."

Michael K Madison
  • 2,242
  • 3
  • 21
  • 35
0

I've encountered similar problems with capistrano/bundler/rvm setups.

At least in my case, if I run

bundle exec <command>

from the capistrano created installation:

/u/apps/<app-name>/current

I pick up my GEMDIR

bundle exec env | grep GEM_HOME
GEM_HOME=/u/apps/app-name/shared/bundle/ruby/1.9.1
Bret Weinraub
  • 1,943
  • 15
  • 21
0

After you created your gemset, did you explicitly "rvm use 1.9.2@myapp" before installing bundler?

Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367