问题描述
根据"berks帮助更新",该命令应该执行以下操作:
According to "berks help update", the command is supposed to:
(是的,仅此而已!).
(Yes ... that's all it says!).
但这到底是什么意思?
这与Berksfile中不同类型的"cookbook"规范有何不同?
And how does this vary with different kinds of "cookbook" specification in your Berksfile?
推荐答案
update命令将尝试查找每个食谱的最新版本(仍满足您定义的任何版本要求).例如,假设您具有以下Berksfile:
The update command will attempt to find the newest versions of each cookbook (that still meet any version requirements you've defined). For example, suppose you have the following Berksfile:
cookbook 'foo', '~> 1.0.0'
这告诉Berkshelf接受1.0.x
系列中的任何版本.因此,您运行berks install
并(假设)将foo-1.0.5
安装到本地berkshelf中.锁定文件将锁定"版本1.0.5的foo定义,因此其他开发人员和以后的安装将始终使用版本1.0.5(这是锁定文件的全部内容).
This tells Berkshelf to accept any version in the 1.0.x
series. So you run berks install
and (hypothetically) foo-1.0.5
is installed into your local berkshelf. The lockfile will "lock" the definition for foo at version 1.0.5, so other developers and future installs will always use version 1.0.5 (that's the entire point of the lockfile).
(几个月过去了...)
(A few months pass by...)
现在,您要将菜谱更新为最新版本.但是由于 SemVer ,您希望保留在1.0.x系列中.运行berks update
将解锁锁文件中的硬依赖性,但将约束保留在Berksfile中.因此(假设),如果社区站点具有以下foo Cookbook版本:
Now you want to update the cookbook to the latest version. But because of SemVer, you want to remain in the 1.0.x series. Running berks update
will unlock the hard dependency in the lockfile, but keep the constraint in the Berksfile. So (hypothetically), if the community site had the following foo cookbook versions:
- 1.0.5
- 1.0.6
- 1.0.8
- 1.1.0
- 2.0.0
berks update
会将您的本地版本更新为1.0.8
,因为这是仍满足您约束的最新发布版本.
berks update
would update your local version to 1.0.8
, since that's the latest published version that still satisfies your constraint.
这篇关于"berks更新< cookbook-name>"的确切含义是什么?做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!