What exactly does “berks update ” do?

后端 未结 1 1731
无人及你
无人及你 2021-02-19 09:23

According to \"berks help update\", the command is supposed to:

\"Update the cookbooks (and dependencies) specified in the Berksfile\"

相关标签:
1条回答
  • 2021-02-19 09:49

    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'
    

    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...)

    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 would update your local version to 1.0.8, since that's the latest published version that still satisfies your constraint.

    0 讨论(0)
提交回复
热议问题