mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Initial draft of version locking documentation. Fixes #1929
This commit is contained in:
parent
400eab87f4
commit
e3754fb23b
2 changed files with 17 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
|||
<li><a href="/documentation/getting-started/flow/">Flow</a></li>
|
||||
<li><a href="/documentation/getting-started/rollbacks/">Rollbacks</a></li>
|
||||
<li><a href="/documentation/getting-started/cold-start/">Cold Start</a></li>
|
||||
<li><a href="/documentation/getting-started/version-locking/">Version Locking</a></li>
|
||||
<li><a href="/documentation/getting-started/tasks/">Tasks</a></li>
|
||||
<li><a href="/documentation/getting-started/local-tasks/">Local Tasks</a></li>
|
||||
<li><a href="/documentation/getting-started/before-after/">Before / After Hooks</a></li>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
title: Version Locking
|
||||
layout: default
|
||||
---
|
||||
|
||||
Capistrano will, by default, include a `lock` command at the top of `deploy.rb`. This checks that the version of Capistrano running the configuration is the same as was intended to run it.
|
||||
|
||||
The reasoning for this is that, in a pre-Bundler world, or when Bundler is not being used, Capistrano could behave in an unexpected and unclear manner with an incompatible configuration. Even today, it is easy to run Capistrano without `bundle exec` or a binstub (`bin/cap`, obtained through `bundle binstub capistrano`), resulting in unexpected behavior.
|
||||
|
||||
The syntax for the lock is similar to that used by Bundler in a Gemfile.
|
||||
|
||||
The simplest form is: `lock '3.9.0'`. This locks the configuration to the exact version given.
|
||||
|
||||
The most useful form uses the pessimistic operator: `~> 3.9.0`. This allows the version of the last segment to be increased, and all prior segments are locked. For example, if you used `lock '~> 3.9.2'`, version `3.9.3` would be allowed, but `3.9.1`, `3.10.0`, and `4.0.0` would not. Generally, you will want to lock to the `major.minor` revision. This means that the major version cannot increase, but the minor version can, which is consistent with semantic versioning (which Capistrano follows, [loosely](https://github.com/capistrano/capistrano/pull/1894/files)).
|
||||
|
||||
You can also use `>`, `<`, `<=`, `>=`, and `=` before the version, as in `lock '>= 3.9.0'`. These are useful if you want to lock to a specific set of rules.
|
Loading…
Reference in a new issue