打包商在哪里存储宝石

打包商在哪里存储宝石

本文介绍了打包商在哪里存储宝石?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在使用 gem install 时,gem将被存储在/home/username/.rvm/gems/下,在该gemset下安装了gem。 / p>

但是,如果我使用Bundler并在Gemfile中指定gem,那么当我运行bundle install时,这些gems将存储在哪里?如果我已经使用 gem install 安装了gem,如果我运行bundle install,它会使用以前使用 gem install

解决方案

这取决于。在通常的开发环境中,当你安装一个通常的gem时(通过运行 gem install foo ),bundler将不会重新安装已经存在的gem那里。这个位置取决于rubygems本身的配置。

如果您使用 - deployment 选项运行bundle install,那么这些gem将安装在你的应用程序(你可以把它作为一个单独的选项来传递,但默认为vendor / bundle)

你也可以运行 bundle package 将您的应用程序使用的所有.gem文件存储在 vendor / cache 中。运行 bundle install 会将供应商/缓存中的宝石选为其他位置的宝石。


I know that when using gem install, the gem will be stored under /home/username/.rvm/gems/, under which gemset the gem was installed.

But if I use Bundler and specify the gem in the Gemfile, when I run bundle install, where will those gems be stored? And what if I already installed the gem using gem install, if I run bundle install, will it use the previous gem installed using gem install?

解决方案

It depends. In the usual development setup they are installed where they would be when you install a gem "normally" (by running gem install foo) and bundler won't reinstall gems that are already there. This location depends on how rubygems itself is configured.

If you run bundle install with the --deployment option then the gems will be installed in a location unique to your app (you can pass this as a separate option but it defaults to vendor/bundle)

You can also run bundle package to store all the .gem files your app uses in vendor/cache. Running bundle install will prefer gems in vendor/cache to gems in other locations.

这篇关于打包商在哪里存储宝石?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 18:07