Rvm和gem,捆绑秀和gem列表

我在轨道上使用带有ruby的RVM,当我进行bundle install它显示了比我做gem list时更多的gem? 与rvm有什么关系以及它使用哪条路径?

捆绑安装

 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清单

 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) 

当您使用bundle install --deployment bundle install --path=...bundle install --path=...时会发生这种情况,它会生成.bundle/config ,如下所示:

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

它可以由你们其中一个同事或者bundler / capistrano集成完成:

  1. 如果是你的同事然后删除并忽略它:

     rm -rf .bundle echo '.bundle' >> .gitignore 
  2. 对于capistrano rvm-capistrano描述了如何禁用它=> https://github.com/wayneeseguin/rvm-capistrano#disabling-bundle—deployment-when-using-gemsets

在做gem list之前,请确保使用应用程序的gemset:

 rvm use application_ruby@application_gemset gem list 

确保将application_ruby替换为ruby版本字符串,将application_gemset替换为rails应用程序使用的gemset

在目录的根目录中有一个名为.bundle的隐藏目录。 删除它,然后再次运行bundle。

根据bundler文档 ,在ops的情况下,当前的默认值可能已设置为vendor / bundle,例如,通过先前的执行bundle install --path vendor/bundle

进一步捆绑命令或对Bundler.setup或Bundler.require的调用将记住此位置

还要检查$ BUNDLE_PATH的内容,它显示了它的安装位置。 注意:也可以通过–deployment选项将其安装到vendor / bundle。 请参阅Deplyment模式 3。

正如这里所回答的, gem list将仅显示使用–system选项安装的gem(请参阅接受的答案和Caspar注释); 改为使用bundle list来显示安装在应用程序目录中的gem,即通过bundle install (不带–system选项)。