我使用bundler来管理我的rails应用程序中的依赖项,并且我在git存储库中托管了一个gem,如下所示:
gem 'gem-name', :git => 'path/to/my/gem.git'
要更新这个gem,我执行 bundle update 但它也会更新Gemfile中提到的所有gem . 那么更新一个特定宝石的命令是什么?
bundle update
您只需在命令行中指定gem名称:
bundle update gem-name
bundle update gem-name [--major|--patch|--minor]
这也适用于依赖项 .
看来,对于更新版本的bundler(> = 1.14),它是:
bundle update --conservative gem-name
bundler update --source gem-name 将更新Gemfile.lock中的修订版哈希,您可以将其与该git分支的最后一个提交哈希进行比较(默认为master) .
bundler update --source gem-name
GIT remote: git@github.com:organization/repo-name.git revision: c810f4a29547b60ca8106b7a6b9a9532c392c954
可以在 github.com/organization/repo-name/commits/c810f4a2 找到(我使用了简写的8字符提交哈希为url)
github.com/organization/repo-name/commits/c810f4a2
Here你可以找到一个很好的解释之间的区别
更新gem和依赖项:
or
专门更新宝石:
bundle update --source gem-name
以及可能的副作用的一些很好的例子 .
正如@Tim的答案所说,截至Bundler 1.14,官方支持的方式是 bundle update --conservative gem-name .
我已经使用了 bundle update --source 很长一段时间,但有些情况下它没有't work. Luckily, there'是一个名为bundler-patch的宝石,它的目标是解决这个缺点 .
bundle update --source
我还写了一篇关于如何使用 bundler-patch 的简短blog post以及为什么 bundle update --source 不能始终如一地工作 . 此外,请务必查看chrismo的a post,其中详细解释了 --source 选项的作用 .
bundler-patch
--source
执行此操作的方法是运行以下命令:
7 回答
您只需在命令行中指定gem名称:
bundle update gem-name [--major|--patch|--minor]
这也适用于依赖项 .
看来,对于更新版本的bundler(> = 1.14),它是:
bundler update --source gem-name
将更新Gemfile.lock中的修订版哈希,您可以将其与该git分支的最后一个提交哈希进行比较(默认为master) .GIT remote: git@github.com:organization/repo-name.git revision: c810f4a29547b60ca8106b7a6b9a9532c392c954
可以在
github.com/organization/repo-name/commits/c810f4a2
找到(我使用了简写的8字符提交哈希为url)Here你可以找到一个很好的解释之间的区别
更新gem和依赖项:
or
专门更新宝石:
以及可能的副作用的一些很好的例子 .
更新
正如@Tim的答案所说,截至Bundler 1.14,官方支持的方式是
bundle update --conservative gem-name
.我已经使用了
bundle update --source
很长一段时间,但有些情况下它没有't work. Luckily, there'是一个名为bundler-patch的宝石,它的目标是解决这个缺点 .我还写了一篇关于如何使用
bundler-patch
的简短blog post以及为什么bundle update --source
不能始终如一地工作 . 此外,请务必查看chrismo的a post,其中详细解释了--source
选项的作用 .执行此操作的方法是运行以下命令: