开发者

Using RVM, bundler does not install in proper gemset when gems are installed in a different ruby version

I am having trouble with rvm, bundler and gemsets. I have 3 rubies installed in rvm:

rvm rubies

   macruby-0.7.1 [ x86_64 ]
   ree-1.8.7-2010.02 [ x86_64 ]
=> ruby-1.9.2-p0 [ x86_64 ]

And gemsets like so:

rvm gemsets

   macruby-0.7.1 [ x86_64 ]
   ree-1.8.7-2010.02 [ x86_64 ]
   ree-1.8.7-2010.02@chef [ x86_64 ]
   ree-1.8.7-2010.02@global [ x86_64 ]
   ree-1.8.7-2010.02@mobi [ x86_64 ]
   ree-1.8.7-2010.02@temple_rails [ x86_64 ]
   ruby-1.9.2-p0 [ x86_64 ]
=> ruby-1.9.2-p0@instapaper [ x86_64 ]
   ruby-1.9.2-p0@mobi [ x86_64 ]

I have a .rvmrc that switches to ruby 1.9.2 and the "instapaper" gemset:

rvm use ruby-1.9.2-p0@instapaper

I want to use bundler, so I manually install bundler in this gemset and that works fine.

I build my Gemfile:

source "http://rubygems.org"
gem "mechanize"
gem "highline"
gem "www-delicious"

Then when I run "bundle install" it uses the gems it sees in ree 1.8.7:

Using highline (1.6.1) 
Using nokogiri (1.4.4) 
Using mechanize (1.0.0) 
Using www-delicious (0.4.0) 
Using bundler (1.0.7) 
Your bundle is complete! It was installed into /Users/kold/.rvm/gems/ree-1.8.7-2010.02

If I run "rvm info" it spits out all the right information and I'm even able to install a gem manually without issue:

kold@Kevin-Olds-MacBook-Pro [master*]$ rvm info

ruby-1.9.2-p0@instapaper:

  system:
    uname:       "Darwin Kevin-Olds-MacBook-Pro.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386 i386"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-开发者_高级运维apple-darwin10.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.1.0 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p0"
    date:         "2010-08-18"
    platform:     "x86_64-darwin10.4.0"
    patchlevel:   "2010-08-18 revision 29036"
    full_version: "ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]"

  homes:
    gem:          "/Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper"
    ruby:         "/Users/kold/.rvm/rubies/ruby-1.9.2-p0"

  binaries:
    ruby:         "/Users/kold/.rvm/rubies/ruby-1.9.2-p0/bin/ruby"
    irb:          "/Users/kold/.rvm/rubies/ruby-1.9.2-p0/bin/irb"
    gem:          "/Users/kold/.rvm/rubies/ruby-1.9.2-p0/bin/gem"
    rake:         "/Users/kold/.rvm/rubies/ruby-1.9.2-p0/bin/rake"

  environment:
    PATH:         "/Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper/bin:/Users/kold/.rvm/gems/ruby-1.9.2-p0@global/bin:/Users/kold/.rvm/rubies/ruby-1.9.2-p0/bin:/Users/kold/.rvm/bin:/usr/local/bin:/usr/local/mysql/bin:/opt/local/bin:/Users/kold/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
    GEM_HOME:     "/Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper"
    GEM_PATH:     "/Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper:/Users/kold/.rvm/gems/ruby-1.9.2-p0@global"
    MY_RUBY_HOME: "/Users/kold/.rvm/rubies/ruby-1.9.2-p0"
    IRBRC:        "/Users/kold/.rvm/rubies/ruby-1.9.2-p0/.irbrc"
    RUBYOPT:      ""
    gemset:       "instapaper"

I'm just not sure why it's installing these gems outside of the gemset.

Update 1:

$ rvm use ruby-1.9.2-p0@instapaper && which bundle
Using /Users/kold/.rvm/gems/ruby-1.9.2-p0 with gemset instapaper
/Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper/bin/bundle

kold@Kevin-Olds-MacBook-Pro [master*]$ bundle --verbose check
Using highline (1.6.1) from /Users/kold/.rvm/gems/ree-1.8.7-2010.02/specifications/highline-1.6.1.gemspec 
Using nokogiri (1.4.4) from /Users/kold/.rvm/gems/ree-1.8.7-2010.02/specifications/nokogiri-1.4.4.gemspec 
Using mechanize (1.0.0) from /Users/kold/.rvm/gems/ree-1.8.7-2010.02/specifications/mechanize-1.0.0.gemspec 
Using www-delicious (0.4.0) from /Users/kold/.rvm/gems/ree-1.8.7-2010.02/specifications/www-delicious-0.4.0.gemspec 
Using bundler (1.0.7) from /Users/kold/.rvm/gems/ruby-1.9.2-p0@instapaper/gems/bundler-1.0.7/lib/bundler 
Your bundle is complete! It was installed into /Users/kold/.rvm/gems/ree-1.8.7-2010.02


After talking with "indirect" on #bundler on IRC we determined that my BUNDLE_PATH was set to /Users/kold/.rvm/gems/ree-1.8.7-2010.02. Once I did a unset BUNDLE_PATH everything worked as it should!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜