Rvm and gems, bundle show and gem list

╄→尐↘猪︶ㄣ 提交于 2019-12-04 03:38:40

问题


Im using RVM with ruby on rails, when I do bundle install it shows a whole bunch more gems than when I do gem list? Something to do with rvm and which path its using?

bundle install

mds@db1:~/staging$ bundle
Using rake (0.9.6) 
Using Ascii85 (1.0.1) 
Using Platform (0.4.0) 
Using open4 (1.3.0) 
Using POpen4 (0.1.4) 
Using activesupport (2.3.17) 
Using rack (1.1.6) 
Using actionpack (2.3.17) 
Using actionmailer (2.3.17) 
Using activerecord (2.3.17) 
Using activeresource (2.3.17) 
Using acts_as_audited (1.1.1) 
Using addressable (2.2.8) 
Using builder (3.0.0) 
Using gyoku (1.0.0) 
Using nokogiri (1.5.6) 
Using akami (1.2.0) 
Using ar-extensions (0.9.5) 
Using cgi_multipart_eof_fix (2.5.0) 
Using chunky_png (1.2.5) 
Using cocaine (0.2.1) 
Using coderay (1.0.9) 
Using fssm (0.2.9) 
Using sass (3.1.18) 
Using compass (0.12.1) 
Using daemons (1.1.9) 
Using warden (0.10.7) 
Using devise (1.0.6) 
Using fastimage (1.2.13) 
Using html_compressor (0.0.3) 
Using rubyzip (0.9.8)
more gems......
Your bundle is complete!
It was installed into ./vendor/bundle

gem list

mds@db1:~/staging$ gem list

*** LOCAL GEMS ***

actionmailer (2.3.17)
actionpack (2.3.17)
activerecord (2.3.17)
activeresource (2.3.17)
activesupport (2.3.17)
bundler (1.3.5)
bundler-unload (1.0.1)
daemon_controller (1.1.4)
fastthread (1.0.7)
passenger (3.0.19)
rack (1.5.2, 1.1.6)
rails (2.3.17)
rake (10.1.0)
rubygems-bundler (1.2.2)
rvm (1.11.3.8)

回答1:


this happens when you use bundle install --deployment or bundle install --path=..., it generates .bundle/config with something like this:

---
BUNDLE_FROZEN: '1'
BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'

it could be done by one of you coworkers or the bundler/capistrano integration:

  1. if it was your coworker then just remove and ignore it:

    rm -rf .bundle
    echo '.bundle' >> .gitignore
    
  2. for capistrano rvm-capistrano describes how to disable it => https://github.com/wayneeseguin/rvm-capistrano#disabling-bundle---deployment-when-using-gemsets




回答2:


before doing gem list make sure you use the application's gemset:

rvm use application_ruby@application_gemset
gem list

Be sure to replace application_ruby with your ruby version string and application_gemset to the gemset that is used by your rails application




回答3:


There is a hidden directory called .bundle in the root of your directory. Remove that, then run bundle again.




回答4:


According to bundler documentation the current default, in ops case, may have been set to vendor/bundle, e.g. by a prior execution bundle install --path vendor/bundle:

Further bundle commands or calls to Bundler.setup or Bundler.require will remember this location

Also check contents of $BUNDLE_PATH which shows where it's installed. Note: It's also possible it was installed to vendor/bundle via the --deployment option. See Deplyment mode 3.

As answered here, gem list will show only the gems installed using the --system option (see accepted answer and Caspar comment); use bundle list instead, to show gems installed in the application directory, i.e. via bundle install (without the --system option).



来源:https://stackoverflow.com/questions/17810552/rvm-and-gems-bundle-show-and-gem-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!