bundler 在哪里存储宝石? [英] Where does bundler store gems?

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

问题描述

我知道当使用 gem install 时,gem 将存储在/home/username/.rvm/gems/下,gem 安装在哪个 gemset 下.

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

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

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?

推荐答案

视情况而定.在通常的开发设置中,当您正常"安装 gem(通过运行 gem install foo)时,它们会安装在它们应该安装的位置,并且捆绑程序不会重新安装已经存在的 gem.该位置取决于 ruby​​gems 本身的配置方式.

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.

如果您使用 --deployment 选项运行 bundle install,则 gem 将安装在您的应用所独有的位置(您可以将其作为单独的选项传递,但默认为 vendor/bundle)

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)

您还可以运行 bundle package 将您的应用使用的所有 .gem 文件存储在 vendor/cache 中.运行 bundle install 会优先选择 vendor/cache 中的 gem,而不是其他位置的 gem.

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.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆