Rubygems, Bundler and RVM confusion

六月ゝ 毕业季﹏ 提交于 2019-11-28 15:11:22
idlefingers
  1. To find out where gems are being installed to, run echo $GEM_HOME in a terminal.
  2. When using RVM, gems are installed into your RVM install as it changes $GEM_HOME. Running echo $GEM_HOME now would show a path into your RVM install.
  3. When Bundler is added to the mix, gems will either be installed in $GEM_HOME, or, if you specify a path when running bundle install will be installed to that path. To find out where a gem is through Bundler you can use bundle show gemname to get its full path.
Aditya Sanghi

Use gem env to list the gem paths in each context.

Without RVM gem env will report the system gem library paths.

With RVM gem env will report the RVM-managed gem library paths.

Bundler manages application dependencies and installs into the gem library in your environment. If you are using RVM + Bundler, the gems will be installed in the RVM managed gem directories. If you are using it without RVM, bundler will install gems in the system gem directories.

mpapis

To find the path where a gem is installed use:

gem which gem_name

To find executables (like html2haml) use:

which executable_name

To avoid typing bundle exec html2haml which is recommended by the Bundler team, use my rubygems-bundler gem.

pgras

I'm also trying to understand how it works. The blog "Advice on using Ruby, RVM, Passenger, Rails, Bundler, … in development" helped me have a better overview.

BTW, it's a translation of a French article, the French version is better.

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