使用 bundler 只更新一个 gem [英] Update just one gem with bundler
问题描述
我使用 bundler 来管理我的 rails 应用程序中的依赖项,并且我在 git 存储库中托管了一个 gem,如下所示:
I use bundler to manage dependencies in my rails app, and I have a gem hosted in a git repository included as followed:
gem 'gem-name', :git => 'path/to/my/gem.git'
要更新这个 gem,我执行 bundle update
但它也会更新 Gemfile 中提到的所有 gem.那么只更新一个特定 gem 的命令是什么?
To update this gem, I execute bundle update
but it also updates all the gem mentioned in Gemfile. So what is the command to update just one specific gem?
推荐答案
这里你可以找到一个很好的解释,说明两者之间的区别
Here you can find a good explanation on the difference between
更新 gem 和依赖项:
bundle update gem-name
或
只更新 gem:
bundle update --source gem-name
以及一些可能的副作用的好例子.
along with some nice examples of possible side-effects.
正如@Tim 的回答所说,从 Bundler 1.14 开始,官方支持的方法是使用 bundle update --conservative gem-name
.
As @Tim's answer says, as of Bundler 1.14 the officially-supported way to this is with bundle update --conservative gem-name
.
这篇关于使用 bundler 只更新一个 gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!