capistrano 3.9.1 → 3.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +64 -44
- data/DEVELOPMENT.md +1 -1
- data/README.md +5 -1
- data/features/deploy.feature +10 -0
- data/features/step_definitions/assertions.rb +1 -1
- data/lib/capistrano/configuration/host_filter.rb +1 -2
- data/lib/capistrano/configuration/role_filter.rb +1 -2
- data/lib/capistrano/doctor/servers_doctor.rb +1 -1
- data/lib/capistrano/doctor/variables_doctor.rb +10 -3
- data/lib/capistrano/dsl/paths.rb +2 -2
- data/lib/capistrano/i18n.rb +2 -0
- data/lib/capistrano/immutable_task.rb +3 -2
- data/lib/capistrano/tasks/deploy.rake +13 -4
- data/lib/capistrano/templates/deploy.rb.erb +5 -2
- data/lib/capistrano/version.rb +1 -1
- data/spec/lib/capistrano/configuration/host_filter_spec.rb +5 -0
- data/spec/lib/capistrano/dsl/paths_spec.rb +30 -0
- data/spec/lib/capistrano/immutable_task_spec.rb +1 -1
- data/spec/lib/capistrano/version_validator_spec.rb +23 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a302da5e0e94500447c641fced114c789e57b587
|
4
|
+
data.tar.gz: e8acf0b64f804fa72c6c3f98be72ae9a246814fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f7159ed1bfa2f2c90301334d687752c17ee78b7ca4c0b21933754868e7694ebd120dae93ae71ba4ec9137b01477094525056c50c1bfe09a1216239c58173020
|
7
|
+
data.tar.gz: cfe1d69ed40b6bb9f73edc96b4938ed9a17a4614b534ca1ea7e5b03ad5790f86dd9a30f0ecba182e08dbf02524c1564d5b6dd5008482d6428dcc6d5347f32015
|
data/CHANGELOG.md
CHANGED
@@ -14,15 +14,35 @@ All notable changes to this project will be documented in this file, in reverse
|
|
14
14
|
gem "capistrano", :github => "capistrano/capistrano"
|
15
15
|
```
|
16
16
|
|
17
|
-
## master
|
17
|
+
## [master]
|
18
18
|
|
19
|
-
https://github.com/capistrano/capistrano/compare/v3.
|
19
|
+
[master]: https://github.com/capistrano/capistrano/compare/v3.10.0...HEAD
|
20
20
|
|
21
21
|
* Your contribution here!
|
22
22
|
|
23
|
-
## `3.
|
23
|
+
## [`3.10.0`] (2017-10-23)
|
24
24
|
|
25
|
-
https://github.com/capistrano/capistrano/compare/v3.9.
|
25
|
+
[`3.10.0`]: https://github.com/capistrano/capistrano/compare/v3.9.1...v3.10.0
|
26
|
+
|
27
|
+
As of this release, version 2.x of Capistrano is officially End of Life. No further releases of 2.x series are planned, and pull requests against 2.x are no longer accepted. The maintainers encourage you to upgrade to 3.x if possible.
|
28
|
+
|
29
|
+
### Breaking changes:
|
30
|
+
|
31
|
+
* None
|
32
|
+
|
33
|
+
### New features:
|
34
|
+
|
35
|
+
* [#1943](https://github.com/capistrano/capistrano/issues/1943): Make 'releases' and 'shared' directory names configurable from deployment target
|
36
|
+
* [#1922](https://github.com/capistrano/capistrano/pull/1922): Prevents last good release from being deleted during cleanup if there are too many subsequent failed deploys
|
37
|
+
* [#1930](https://github.com/capistrano/capistrano/issues/1930): Default to locking the version using the pessimistic version operator at the patch level.
|
38
|
+
|
39
|
+
### Fixes:
|
40
|
+
|
41
|
+
* [#1937](https://github.com/capistrano/capistrano/pull/1937): Clarify error message when plugin is required in the wrong config file.
|
42
|
+
|
43
|
+
## [`3.9.1`] (2017-09-08)
|
44
|
+
|
45
|
+
[`3.9.1`]: https://github.com/capistrano/capistrano/compare/v3.9.0...v3.9.1
|
26
46
|
|
27
47
|
### Breaking changes:
|
28
48
|
|
@@ -32,9 +52,9 @@ https://github.com/capistrano/capistrano/compare/v3.9.0...v3.9.1
|
|
32
52
|
|
33
53
|
* [#1912](https://github.com/capistrano/capistrano/pull/1912): Fixed an issue where questions posed by `ask` were not printed on certain platforms - [@kminiatures](https://github.com/kminiatures)
|
34
54
|
|
35
|
-
## `3.9.0` (2017-07-28)
|
55
|
+
## [`3.9.0`] (2017-07-28)
|
36
56
|
|
37
|
-
https://github.com/capistrano/capistrano/compare/v3.8.2...v3.9.0
|
57
|
+
[`3.9.0`]: https://github.com/capistrano/capistrano/compare/v3.8.2...v3.9.0
|
38
58
|
|
39
59
|
### Breaking changes:
|
40
60
|
|
@@ -48,9 +68,9 @@ https://github.com/capistrano/capistrano/compare/v3.8.2...v3.9.0
|
|
48
68
|
|
49
69
|
* [#1899](https://github.com/capistrano/capistrano/pull/1899): Updated `deploy:cleanup` to continue rotating the releases and skip the invalid directory names instead of skipping the whole rotation of releases. The warning message has changed slightly due to the change of behavior.
|
50
70
|
|
51
|
-
## `3.8.2` (2017-06-16)
|
71
|
+
## [`3.8.2`] (2017-06-16)
|
52
72
|
|
53
|
-
https://github.com/capistrano/capistrano/compare/v3.8.1...v3.8.2
|
73
|
+
[`3.8.2`]: https://github.com/capistrano/capistrano/compare/v3.8.1...v3.8.2
|
54
74
|
|
55
75
|
### Breaking changes:
|
56
76
|
|
@@ -60,9 +80,9 @@ https://github.com/capistrano/capistrano/compare/v3.8.1...v3.8.2
|
|
60
80
|
|
61
81
|
* [#1882](https://github.com/capistrano/capistrano/pull/1882): Explain where to add new Capfile lines in scm deprecation warning - [@robd](https://github.com/robd)
|
62
82
|
|
63
|
-
## `3.8.1` (2017-04-21)
|
83
|
+
## [`3.8.1`] (2017-04-21)
|
64
84
|
|
65
|
-
https://github.com/capistrano/capistrano/compare/v3.8.0...v3.8.1
|
85
|
+
[`3.8.1`]: https://github.com/capistrano/capistrano/compare/v3.8.0...v3.8.1
|
66
86
|
|
67
87
|
### Breaking changes:
|
68
88
|
|
@@ -72,9 +92,9 @@ https://github.com/capistrano/capistrano/compare/v3.8.0...v3.8.1
|
|
72
92
|
|
73
93
|
* [#1867](https://github.com/capistrano/capistrano/pull/1867): Allow `cap -T` to run without Capfile present - [@mattbrictson](https://github.com/mattbrictson)
|
74
94
|
|
75
|
-
## `3.8.0` (2017-03-10)
|
95
|
+
## [`3.8.0`] (2017-03-10)
|
76
96
|
|
77
|
-
https://github.com/capistrano/capistrano/compare/v3.7.2...v3.8.0
|
97
|
+
[`3.8.0`]: https://github.com/capistrano/capistrano/compare/v3.7.2...v3.8.0
|
78
98
|
|
79
99
|
### Minor breaking changes:
|
80
100
|
|
@@ -100,9 +120,9 @@ https://github.com/capistrano/capistrano/compare/v3.7.2...v3.8.0
|
|
100
120
|
* [#1859](https://github.com/capistrano/capistrano/pull/1859): Move git-specific repo_url logic into git plugin - [@mattbrictson](https://github.com/mattbrictson)
|
101
121
|
* [#1858](https://github.com/capistrano/capistrano/pull/1858): Unset the :scm variable when an SCM plugin is used - [@mattbrictson](https://github.com/mattbrictson)
|
102
122
|
|
103
|
-
## `3.7.2` (2017-01-27)
|
123
|
+
## [`3.7.2`] (2017-01-27)
|
104
124
|
|
105
|
-
https://github.com/capistrano/capistrano/compare/v3.7.1...v3.7.2
|
125
|
+
[`3.7.2`]: https://github.com/capistrano/capistrano/compare/v3.7.1...v3.7.2
|
106
126
|
|
107
127
|
### Potentially breaking changes:
|
108
128
|
|
@@ -113,9 +133,9 @@ https://github.com/capistrano/capistrano/compare/v3.7.1...v3.7.2
|
|
113
133
|
* Suppress log messages of `git ls-remote` by filtering remote refs (@aeroastro)
|
114
134
|
* The Git SCM now allows the repo_url to be changed without manually wiping out the mirror on each target host first (@javanthropus)
|
115
135
|
|
116
|
-
## `3.7.1` (2016-12-16)
|
136
|
+
## [`3.7.1`] (2016-12-16)
|
117
137
|
|
118
|
-
https://github.com/capistrano/capistrano/compare/v3.7.0...v3.7.1
|
138
|
+
[`3.7.1`]: https://github.com/capistrano/capistrano/compare/v3.7.0...v3.7.1
|
119
139
|
|
120
140
|
### Potentially breaking changes:
|
121
141
|
|
@@ -125,9 +145,9 @@ https://github.com/capistrano/capistrano/compare/v3.7.0...v3.7.1
|
|
125
145
|
|
126
146
|
* Fixed a bug with mercurial deploys failing due to an undefined variable
|
127
147
|
|
128
|
-
## `3.7.0` (2016-12-10)
|
148
|
+
## [`3.7.0`] (2016-12-10)
|
129
149
|
|
130
|
-
https://github.com/capistrano/capistrano/compare/v3.6.1...v3.7.0
|
150
|
+
[`3.7.0`]: https://github.com/capistrano/capistrano/compare/v3.6.1...v3.7.0
|
131
151
|
|
132
152
|
*Note: These release notes include all changes since 3.6.1, including the changes that were first published in 3.7.0.beta1.*
|
133
153
|
|
@@ -151,9 +171,9 @@ https://github.com/capistrano/capistrano/compare/v3.6.1...v3.7.0
|
|
151
171
|
* Fix bug where host_filter and role_filter were overly greedy [#1766](https://github.com/capistrano/capistrano/issues/1766) (@cseeger-epages)
|
152
172
|
* Fix the removal of old releases `deploy:cleanup`. Logic is changed because of unreliable modification times on folders. Removal of directories is now decided by sorting on folder names (name is generated from current datetime format YmdHis). Cleanup is skipped, and a warning is given when a folder name is in a different format
|
153
173
|
|
154
|
-
## `3.7.0.beta1` (2016-11-02)
|
174
|
+
## [`3.7.0.beta1`] (2016-11-02)
|
155
175
|
|
156
|
-
https://github.com/capistrano/capistrano/compare/v3.6.1...v3.7.0.beta1
|
176
|
+
[`3.7.0.beta1`]: https://github.com/capistrano/capistrano/compare/v3.6.1...v3.7.0.beta1
|
157
177
|
|
158
178
|
### Deprecations:
|
159
179
|
|
@@ -177,9 +197,9 @@ the [new plugin system](http://capistranorb.com/documentation/advanced-features/
|
|
177
197
|
* Fix test suite to work with Mocha 1.2.0 (@caius)
|
178
198
|
* Fix bug where host_filter and role_filter were overly greedy [#1766](https://github.com/capistrano/capistrano/issues/1766) (@cseeger-epages)
|
179
199
|
|
180
|
-
## `3.6.1` (2016-08-23)
|
200
|
+
## [`3.6.1`] (2016-08-23)
|
181
201
|
|
182
|
-
https://github.com/capistrano/capistrano/compare/v3.6.0...v3.6.1
|
202
|
+
[`3.6.1`]: https://github.com/capistrano/capistrano/compare/v3.6.0...v3.6.1
|
183
203
|
|
184
204
|
### Fixes:
|
185
205
|
|
@@ -187,9 +207,9 @@ https://github.com/capistrano/capistrano/compare/v3.6.0...v3.6.1
|
|
187
207
|
* Fix `NoMethodError: undefined method gsub` when setting `:application` to a Proc. The original fix released in 3.6.0 worked for values specified with blocks, but not for those specified with procs or lambdas (the latter syntax is much more common). [#1681](https://github.com/capistrano/capistrano/issues/1681)
|
188
208
|
* Fix a bug where deploy would fail if `:local_user` contained a space; spaces are now replaced with dashes when computing the git-ssh suffix. (@will_in_wi)
|
189
209
|
|
190
|
-
## `3.6.0` (2016-07-26)
|
210
|
+
## [`3.6.0`] (2016-07-26)
|
191
211
|
|
192
|
-
https://github.com/capistrano/capistrano/compare/v3.5.0...v3.6.0
|
212
|
+
[`3.6.0`]: https://github.com/capistrano/capistrano/compare/v3.5.0...v3.6.0
|
193
213
|
|
194
214
|
Thank you to the many first-time contributors from the Capistrano community who
|
195
215
|
helped with this release!
|
@@ -227,9 +247,9 @@ affected by these deprecations.
|
|
227
247
|
* Restrict the uploaded git wrapper script permissions to 700 (@irvingwashington)
|
228
248
|
* Add `net-ssh` gem version to `doctor:gems` output (@lebedev-yury)
|
229
249
|
|
230
|
-
## `3.5.0`
|
250
|
+
## [`3.5.0`]
|
231
251
|
|
232
|
-
https://github.com/capistrano/capistrano/compare/v3.4.1...v3.5.0
|
252
|
+
[`3.5.0`]: https://github.com/capistrano/capistrano/compare/v3.4.1...v3.5.0
|
233
253
|
|
234
254
|
**You'll notice a big cosmetic change in this release: the default logging
|
235
255
|
format has been changed to
|
@@ -300,9 +320,9 @@ and how to configure it, visit the
|
|
300
320
|
of case statements (@cshaffer)
|
301
321
|
* Clean up rubocop lint warnings (@cshaffer)
|
302
322
|
|
303
|
-
## `3.4.0`
|
323
|
+
## [`3.4.0`]
|
304
324
|
|
305
|
-
https://github.com/capistrano/capistrano/compare/v3.3.5...v3.4.0
|
325
|
+
[`3.4.0`]: https://github.com/capistrano/capistrano/compare/v3.3.5...v3.4.0
|
306
326
|
|
307
327
|
* Fixed fetch revision for annotated git tags. (@igorsokolov)
|
308
328
|
* Fixed updating roles when custom user or port is specified. (@ayastreb)
|
@@ -334,16 +354,16 @@ https://github.com/capistrano/capistrano/compare/v3.3.5...v3.4.0
|
|
334
354
|
* Allow specification of repo_path using stage variable
|
335
355
|
default is as before (@townsen)
|
336
356
|
|
337
|
-
## `3.3.5`
|
357
|
+
## [`3.3.5`]
|
338
358
|
|
339
|
-
https://github.com/capistrano/capistrano/compare/v3.3.4...v3.3.5
|
359
|
+
[`3.3.5`]: https://github.com/capistrano/capistrano/compare/v3.3.4...v3.3.5
|
340
360
|
|
341
361
|
* Fixed setting properties twice when creating new server. See [issue
|
342
362
|
#1214](https://github.com/capistrano/capistrano/issues/1214) (@ayastreb)
|
343
363
|
|
344
|
-
## `3.3.4`
|
364
|
+
## [`3.3.4`]
|
345
365
|
|
346
|
-
https://github.com/capistrano/capistrano/compare/v3.3.3...v3.3.4
|
366
|
+
[`3.3.4`]: https://github.com/capistrano/capistrano/compare/v3.3.3...v3.3.4
|
347
367
|
|
348
368
|
* Minor changes:
|
349
369
|
* Rely on a newer version of capistrano-stats with better privacy (@leehambley)
|
@@ -352,9 +372,9 @@ https://github.com/capistrano/capistrano/compare/v3.3.3...v3.3.4
|
|
352
372
|
* Spec improvements (@dimitrid, @sponomarev)
|
353
373
|
* Fix to CLI flags for git-ls-remote (@dimitrid)
|
354
374
|
|
355
|
-
## `3.3.3`
|
375
|
+
## [`3.3.3`]
|
356
376
|
|
357
|
-
https://github.com/capistrano/capistrano/compare/v3.2.1...v3.3.3
|
377
|
+
[`3.3.3`]: https://github.com/capistrano/capistrano/compare/v3.2.1...v3.3.3
|
358
378
|
|
359
379
|
* Enhancement (@townsen)
|
360
380
|
* Added the variable `:repo_tree` which allows the specification of a sub-tree that
|
@@ -438,9 +458,9 @@ Breaking Changes:
|
|
438
458
|
* Updated svn fetch_revision method to use `svnversion`
|
439
459
|
* `cap install` no longer overwrites existing files. (@dmarkow)
|
440
460
|
|
441
|
-
## `3.2.1`
|
461
|
+
## [`3.2.1`]
|
442
462
|
|
443
|
-
https://github.com/capistrano/capistrano/compare/v3.2.0...v3.2.1
|
463
|
+
[`3.2.1`]: https://github.com/capistrano/capistrano/compare/v3.2.0...v3.2.1
|
444
464
|
|
445
465
|
* Bug Fixes:
|
446
466
|
* 3.2.0 introduced some behaviour to modify the way before/after hooks were called, to allow the optional
|
@@ -455,12 +475,12 @@ https://github.com/capistrano/capistrano/compare/v3.2.0...v3.2.1
|
|
455
475
|
* Added `keys` method to Configuration to allow introspection of configuration options. (@juanibiapina)
|
456
476
|
* Improve error message when git:check fails (raise instead of silently `exit 1`) (@mbrictson)
|
457
477
|
|
458
|
-
## `3.2.0`
|
478
|
+
## [`3.2.0`]
|
459
479
|
|
460
480
|
The changelog entries here are incomplete, because many authors choose not to
|
461
481
|
be credited for their work, check the tag comparison link for Github.
|
462
482
|
|
463
|
-
https://github.com/capistrano/capistrano/compare/v3.1.0...v3.2.0
|
483
|
+
[`3.2.0`]: https://github.com/capistrano/capistrano/compare/v3.1.0...v3.2.0
|
464
484
|
|
465
485
|
* Minor changes:
|
466
486
|
* Added `keys` method to Server properties to allow introspection of automatically added
|
@@ -468,9 +488,9 @@ https://github.com/capistrano/capistrano/compare/v3.1.0...v3.2.0
|
|
468
488
|
* Compatibility with Rake 10.2.0 - `ensure_task` is now added to `@top_level_tasks` as a string. (@dmarkow)
|
469
489
|
* Amended the git check command, "ls-remote", to use "-h", limiting the list to refs/heads
|
470
490
|
|
471
|
-
## `3.1.0`
|
491
|
+
## [`3.1.0`]
|
472
492
|
|
473
|
-
https://github.com/capistrano/capistrano/compare/v3.0.1...v3.1.0
|
493
|
+
[`3.1.0`]: https://github.com/capistrano/capistrano/compare/v3.0.1...v3.1.0
|
474
494
|
|
475
495
|
Breaking changes:
|
476
496
|
|
@@ -504,17 +524,17 @@ Breaking changes:
|
|
504
524
|
|
505
525
|
Big thanks to @Kriechi for his help.
|
506
526
|
|
507
|
-
## `3.0.1`
|
527
|
+
## [`3.0.1`]
|
508
528
|
|
509
|
-
https://github.com/capistrano/capistrano/compare/v3.0.0...v3.0.1
|
529
|
+
[`3.0.1`]: https://github.com/capistrano/capistrano/compare/v3.0.0...v3.0.1
|
510
530
|
|
511
531
|
* `capify` not listed as executable (@leehambley)
|
512
532
|
* Confirm license as MIT (@leehambley)
|
513
533
|
* Move the git ssh helper to application path (@mpapis)
|
514
534
|
|
515
|
-
## `3.0.0`
|
535
|
+
## [`3.0.0`]
|
516
536
|
|
517
|
-
https://github.com/capistrano/capistrano/compare/2.15.5...v3.0.0
|
537
|
+
[`3.0.0`]: https://github.com/capistrano/capistrano/compare/2.15.5...v3.0.0
|
518
538
|
|
519
539
|
If you are coming here to wonder why your Capfile doesn't work anymore, please
|
520
540
|
vendor lock your Capistrano at 2.x, whichever version was working for you
|
data/DEVELOPMENT.md
CHANGED
@@ -71,7 +71,7 @@ Pull requests are awesome, and if they arrive with decent tests, and conform to
|
|
71
71
|
|
72
72
|
Your code should conform to these guidelines:
|
73
73
|
|
74
|
-
* The code is MIT
|
74
|
+
* The code is MIT licensed, your code will fall under the same license if we merge it.
|
75
75
|
* We can't merge it without a [good commit message](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message). If you do this right, Github will use the commit message as the body of your pull request, double win.
|
76
76
|
* If you are making an improvement/fix for an existing issue, make sure to mention the issue number (if we have not yet merged it )
|
77
77
|
* Add an entry to the `CHANGELOG` under the `### master` section, but please don't mess with the version.
|
data/README.md
CHANGED
@@ -88,6 +88,10 @@ Likewise, your server(s) will likely need supporting software installed before y
|
|
88
88
|
|
89
89
|
Capistrano is designed to deploy using a single, non-privileged SSH user, using a *non-interactive* SSH session. If your deployment requires `sudo`, interactive prompts, authenticating as one user but running commands as another, you can probably accomplish this with Capistrano, but it may be difficult. Your automated deployments will be much smoother if you can avoid such requirements.
|
90
90
|
|
91
|
+
#### Shells
|
92
|
+
|
93
|
+
Capistrano 3 expects a POSIX shell like Bash or Sh. Shells like tcsh, csh, and such may work, but probably will not.
|
94
|
+
|
91
95
|
## Quick start
|
92
96
|
|
93
97
|
### Requirements
|
@@ -103,7 +107,7 @@ Add Capistrano to your project's Gemfile:
|
|
103
107
|
|
104
108
|
``` ruby
|
105
109
|
group :development do
|
106
|
-
gem "capistrano", "~> 3.
|
110
|
+
gem "capistrano", "~> 3.10"
|
107
111
|
end
|
108
112
|
```
|
109
113
|
|
data/features/deploy.feature
CHANGED
@@ -60,6 +60,16 @@ Feature: Deploy
|
|
60
60
|
Then 3 valid releases are kept
|
61
61
|
And the invalid "new" release is ignored
|
62
62
|
|
63
|
+
Scenario: Cleanup after many failed releases doesn't remove last good release
|
64
|
+
Given config stage file has line "set :keep_releases, 2"
|
65
|
+
And I make 2 deployments
|
66
|
+
And an invalid release named "77777777777777"
|
67
|
+
And an invalid release named "88888888888888"
|
68
|
+
And an invalid release named "99999999999999"
|
69
|
+
When I run cap "deploy:cleanup"
|
70
|
+
Then 3 valid releases are kept
|
71
|
+
And the current directory will be a symlink to the release
|
72
|
+
|
63
73
|
Scenario: Rolling Back
|
64
74
|
Given I make 2 deployments
|
65
75
|
When I run cap "deploy:rollback"
|
@@ -66,7 +66,7 @@ Then(/^directory symlinks are created in the new release$/) do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
Then(/^the current directory will be a symlink to the release$/) do
|
69
|
-
run_vagrant_command(
|
69
|
+
run_vagrant_command(exists?("e", TestApp.current_path))
|
70
70
|
end
|
71
71
|
|
72
72
|
Then(/^the deploy\.rb file is created$/) do
|
@@ -3,8 +3,7 @@ module Capistrano
|
|
3
3
|
class HostFilter
|
4
4
|
def initialize(values)
|
5
5
|
av = Array(values).dup
|
6
|
-
av.
|
7
|
-
av.flatten!
|
6
|
+
av = av.flat_map { |v| v.is_a?(String) && v =~ /^(?<name>[-A-Za-z1-9.]+)(,\g<name>)*$/ ? v.split(",") : v }
|
8
7
|
@rex = regex_matcher(av)
|
9
8
|
end
|
10
9
|
|
@@ -5,9 +5,16 @@ module Capistrano
|
|
5
5
|
# Prints a table of all Capistrano variables and their current values. If
|
6
6
|
# there are unrecognized variables, print warnings for them.
|
7
7
|
class VariablesDoctor
|
8
|
-
# These are keys that
|
9
|
-
#
|
10
|
-
WHITELIST = %i(
|
8
|
+
# These are keys that are recognized by Capistrano, but do not have values
|
9
|
+
# set by default.
|
10
|
+
WHITELIST = %i(
|
11
|
+
application
|
12
|
+
current_directory
|
13
|
+
releases_directory
|
14
|
+
repo_url
|
15
|
+
repo_tree
|
16
|
+
shared_directory
|
17
|
+
).freeze
|
11
18
|
private_constant :WHITELIST
|
12
19
|
|
13
20
|
include Capistrano::Doctor::OutputHelpers
|
data/lib/capistrano/dsl/paths.rb
CHANGED
@@ -15,7 +15,7 @@ module Capistrano
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def releases_path
|
18
|
-
deploy_path.join("releases")
|
18
|
+
deploy_path.join(fetch(:releases_directory, "releases"))
|
19
19
|
end
|
20
20
|
|
21
21
|
def release_path
|
@@ -44,7 +44,7 @@ module Capistrano
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def shared_path
|
47
|
-
deploy_path.join("shared")
|
47
|
+
deploy_path.join(fetch(:shared_directory, "shared"))
|
48
48
|
end
|
49
49
|
|
50
50
|
def revision_log
|
data/lib/capistrano/i18n.rb
CHANGED
@@ -14,6 +14,8 @@ en = {
|
|
14
14
|
question_default: "Please enter %{key} (%{default_value}): ",
|
15
15
|
keeping_releases: "Keeping %{keep_releases} of %{releases} deployed releases on %{host}",
|
16
16
|
skip_cleanup: "Skipping cleanup of invalid releases on %{host}; unexpected foldername found (should be timestamp)",
|
17
|
+
wont_delete_current_release: "Current release was marked for being removed but it's going to be skipped on %{host}",
|
18
|
+
no_current_release: "There is no current release present on %{host}",
|
17
19
|
no_old_releases: "No old releases (keeping newest %{keep_releases}) on %{host}",
|
18
20
|
linked_file_does_not_exist: "linked file %{file} does not exist on %{host}",
|
19
21
|
cannot_rollback: "There are no older releases to rollback to",
|
@@ -17,8 +17,9 @@ module Capistrano
|
|
17
17
|
|
18
18
|
def enhance(*args, &block)
|
19
19
|
$stderr.puts <<-MESSAGE
|
20
|
-
|
21
|
-
Check that you haven't loaded a Capistrano plugin in deploy.rb
|
20
|
+
ERROR: #{name} has already been invoked and can no longer be modified.
|
21
|
+
Check that you haven't loaded a Capistrano plugin in deploy.rb or a stage
|
22
|
+
(e.g. deploy/production.rb) by mistake.
|
22
23
|
Plugins must be loaded in the Capfile to initialize properly.
|
23
24
|
MESSAGE
|
24
25
|
|
@@ -155,11 +155,20 @@ namespace :deploy do
|
|
155
155
|
|
156
156
|
if valid.count >= fetch(:keep_releases)
|
157
157
|
info t(:keeping_releases, host: host.to_s, keep_releases: fetch(:keep_releases), releases: valid.count)
|
158
|
-
directories = (valid - valid.last(fetch(:keep_releases)))
|
158
|
+
directories = (valid - valid.last(fetch(:keep_releases))).map do |release|
|
159
|
+
releases_path.join(release).to_s
|
160
|
+
end
|
161
|
+
if test("[ -d #{current_path} ]")
|
162
|
+
current_release = capture(:readlink, current_path).to_s
|
163
|
+
if directories.include?(current_release)
|
164
|
+
warn t(:wont_delete_current_release, host: host.to_s)
|
165
|
+
directories.delete(current_release)
|
166
|
+
end
|
167
|
+
else
|
168
|
+
debug t(:no_current_release, host: host.to_s)
|
169
|
+
end
|
159
170
|
if directories.any?
|
160
|
-
directories_str = directories.
|
161
|
-
releases_path.join(release)
|
162
|
-
end.join(" ")
|
171
|
+
directories_str = directories.join(" ")
|
163
172
|
execute :rm, "-rf", directories_str
|
164
173
|
else
|
165
174
|
info t(:no_old_releases, host: host.to_s, keep_releases: fetch(:keep_releases))
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# config valid
|
2
|
-
lock "<%= Capistrano::VERSION %>"
|
1
|
+
# config valid for current version and patch releases of Capistrano
|
2
|
+
lock "~> <%= Capistrano::VERSION %>"
|
3
3
|
|
4
4
|
set :application, "my_app_name"
|
5
5
|
set :repo_url, "git@example.com:me/my_repo.git"
|
@@ -34,3 +34,6 @@ set :repo_url, "git@example.com:me/my_repo.git"
|
|
34
34
|
|
35
35
|
# Default value for keep_releases is 5
|
36
36
|
# set :keep_releases, 5
|
37
|
+
|
38
|
+
# Uncomment the following to require manually verifying the host key before first deploy.
|
39
|
+
# set :ssh_options, verify_host_key: :secure
|
data/lib/capistrano/version.rb
CHANGED
@@ -41,6 +41,11 @@ module Capistrano
|
|
41
41
|
it_behaves_like "it filters hosts correctly", %w{server1 server3}
|
42
42
|
end
|
43
43
|
|
44
|
+
context "with mixed splittable and unsplittable strings" do
|
45
|
+
let(:values) { %w{server1 server2,server3} }
|
46
|
+
it_behaves_like "it filters hosts correctly", %w{server1 server2 server3}
|
47
|
+
end
|
48
|
+
|
44
49
|
context "with a regexp" do
|
45
50
|
let(:values) { "server[13]$" }
|
46
51
|
it_behaves_like "it filters hosts correctly", %w{server1 server3}
|
@@ -123,6 +123,36 @@ describe Capistrano::DSL::Paths do
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
+
describe "#releases_path" do
|
127
|
+
subject { paths.releases_path }
|
128
|
+
|
129
|
+
context "with custom releases directory" do
|
130
|
+
before do
|
131
|
+
paths.expects(:fetch).with(:releases_directory, "releases").returns("test123")
|
132
|
+
paths.expects(:fetch).with(:deploy_to).returns("/var/www")
|
133
|
+
end
|
134
|
+
|
135
|
+
it "returns the releases path with the custom directory" do
|
136
|
+
expect(subject.to_s).to eq "/var/www/test123"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "#shared_path" do
|
142
|
+
subject { paths.shared_path }
|
143
|
+
|
144
|
+
context "with custom shared directory" do
|
145
|
+
before do
|
146
|
+
paths.expects(:fetch).with(:shared_directory, "shared").returns("test123")
|
147
|
+
paths.expects(:fetch).with(:deploy_to).returns("/var/www")
|
148
|
+
end
|
149
|
+
|
150
|
+
it "returns the shared path with the custom directory" do
|
151
|
+
expect(subject.to_s).to eq "/var/www/test123"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
126
156
|
describe "#deploy_config_path" do
|
127
157
|
subject { dsl.deploy_config_path.to_s }
|
128
158
|
|
@@ -16,7 +16,7 @@ module Capistrano
|
|
16
16
|
load_defaults.extend(Capistrano::ImmutableTask)
|
17
17
|
|
18
18
|
$stderr.expects(:puts).with do |message|
|
19
|
-
message =~ /^
|
19
|
+
message =~ /^ERROR: load:defaults has already been invoked/
|
20
20
|
end
|
21
21
|
|
22
22
|
expect do
|
@@ -89,6 +89,29 @@ module Capistrano
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
92
|
+
|
93
|
+
context "with multiple versions" do
|
94
|
+
let(:current_version) { "3.5.9" }
|
95
|
+
|
96
|
+
context "valid" do
|
97
|
+
let(:version) { [">= 3.5.0", "< 3.5.10"] }
|
98
|
+
it { is_expected.to be_truthy }
|
99
|
+
end
|
100
|
+
|
101
|
+
context "invalid" do
|
102
|
+
let(:version) { [">= 3.5.0", "< 3.5.8"] }
|
103
|
+
it "fails" do
|
104
|
+
expect { subject }.to raise_error(RuntimeError)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
context "invalid" do
|
109
|
+
let(:version) { ["> 3.5.9", "< 3.5.13"] }
|
110
|
+
it "fails" do
|
111
|
+
expect { subject }.to raise_error(RuntimeError)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
92
115
|
end
|
93
116
|
end
|
94
117
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Clements
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: airbrussh
|
@@ -285,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
285
|
version: '0'
|
286
286
|
requirements: []
|
287
287
|
rubyforge_project:
|
288
|
-
rubygems_version: 2.6.
|
288
|
+
rubygems_version: 2.6.14
|
289
289
|
signing_key:
|
290
290
|
specification_version: 4
|
291
291
|
summary: Capistrano - Welcome to easy deployment with Ruby over SSH
|