capistrano 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +5 -2
- data/CHANGELOG.md +36 -3
- data/CONTRIBUTING.md +91 -0
- data/Gemfile +9 -0
- data/README.md +9 -11
- data/capistrano.gemspec +5 -8
- data/features/configuration.feature +15 -0
- data/features/deploy.feature +1 -0
- data/features/deploy_failure.feature +17 -0
- data/features/step_definitions/assertions.rb +19 -0
- data/features/step_definitions/cap_commands.rb +5 -1
- data/features/step_definitions/setup.rb +13 -0
- data/features/support/remote_command_helpers.rb +4 -0
- data/lib/capistrano/application.rb +41 -3
- data/lib/capistrano/configuration.rb +8 -0
- data/lib/capistrano/configuration/server.rb +28 -5
- data/lib/capistrano/configuration/servers.rb +3 -6
- data/lib/capistrano/configuration/servers/host_filter.rb +82 -0
- data/lib/capistrano/dsl.rb +16 -1
- data/lib/capistrano/dsl/env.rb +11 -1
- data/lib/capistrano/dsl/paths.rb +8 -0
- data/lib/capistrano/dsl/stages.rb +8 -1
- data/lib/capistrano/dsl/task_enhancements.rb +13 -2
- data/lib/capistrano/git.rb +35 -0
- data/lib/capistrano/hg.rb +32 -0
- data/lib/capistrano/i18n.rb +6 -2
- data/lib/capistrano/scm.rb +116 -0
- data/lib/capistrano/setup.rb +4 -3
- data/lib/capistrano/tasks/console.rake +9 -1
- data/lib/capistrano/tasks/deploy.rake +17 -15
- data/lib/capistrano/tasks/framework.rake +1 -0
- data/lib/capistrano/tasks/git.rake +16 -10
- data/lib/capistrano/tasks/hg.rake +13 -9
- data/lib/capistrano/templates/Capfile +1 -2
- data/lib/capistrano/templates/deploy.rb.erb +20 -2
- data/lib/capistrano/templates/stage.rb.erb +1 -4
- data/lib/capistrano/version.rb +1 -1
- data/spec/integration/dsl_spec.rb +147 -2
- data/spec/lib/capistrano/application_spec.rb +2 -5
- data/spec/lib/capistrano/configuration/server_spec.rb +40 -4
- data/spec/lib/capistrano/configuration/servers/host_filter_spec.rb +84 -0
- data/spec/lib/capistrano/configuration/servers_spec.rb +35 -0
- data/spec/lib/capistrano/configuration_spec.rb +8 -0
- data/spec/lib/capistrano/dsl_spec.rb +0 -11
- data/spec/lib/capistrano/git_spec.rb +70 -0
- data/spec/lib/capistrano/hg_spec.rb +70 -0
- data/spec/lib/capistrano/scm_spec.rb +104 -0
- data/spec/support/tasks/fail.cap +7 -0
- data/spec/support/tasks/failed.cap +5 -0
- data/spec/support/test_app.rb +33 -3
- metadata +29 -52
- data/spec/lib/capistrano/dsl/env_spec.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3783d6041216c4b9c311d09d0e21b4cb59faa047
|
4
|
+
data.tar.gz: 9080286b94f6d929467214fe2beb1e4cbfcf69ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bb13c785e02643ee9a9f511f875fd96eb3d6cf0765b412546e7d0a89aaa04b8e46700700fa58ee47de02ad8ef9b1ac79ea37be6fabd895d74544d5b5a3d59f5
|
7
|
+
data.tar.gz: 6f00a69f1245900b8b1b88dfa7208b0416681fdd87157831c0c7f1415ee02bfb106b3c4e5b997aadeb7bc86cc79aca7dfc4e0c1cb92a94fee927ac292bc7caf5
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,9 +2,42 @@
|
|
2
2
|
|
3
3
|
Reverse Chronological Order:
|
4
4
|
|
5
|
-
## `3.0
|
6
|
-
|
7
|
-
|
5
|
+
## `3.1.0`
|
6
|
+
|
7
|
+
Breaking changes:
|
8
|
+
|
9
|
+
* `deploy:restart` task **is no longer run by default**.
|
10
|
+
From this version, developers who restart the app on each deploy need to declare it in their deploy flow (eg `after 'deploy:publishing', 'deploy:restart'`).
|
11
|
+
|
12
|
+
Please, check https://github.com/capistrano/capistrano/commit/4e6523e1f50707499cf75eb53dce37a89528a9b0 for more information. (@kirs)
|
13
|
+
|
14
|
+
* Minor changes
|
15
|
+
* Tasks that used `linked_dirs` and `linked_files` now run on all roles, not just app roles (@mikespokefire)
|
16
|
+
* Tasks `deploy:linked_dirs`, `deploy:make_linked_dirs`, `deploy:linked_files`, `deploy:cleanup_rollback`,
|
17
|
+
`deploy:log_revision` and `deploy:revert_release` now use `release_roles()` not `roles()` meaning that they
|
18
|
+
will only run on servers where the `no_release` property is not falsy. (@leehambley)
|
19
|
+
* Fixed bug when `deploy:cleanup` was executed twice by default (@kirs)
|
20
|
+
* Config location can now be changed with `deploy_config_path` and `stage_config_path` options (@seenmyfate)
|
21
|
+
* `no_release` option is now available (@seenmyfate)
|
22
|
+
* Raise an error if developer tries to define `:all` role, which is reserved (@kirs)
|
23
|
+
* `deploy:fallback` hook was added to add some custom behaviour on failed deploy (@seenmyfate)
|
24
|
+
* Correctly infer namespace in task enhancements (@seenmyfate)
|
25
|
+
* Add SHA to revision log (@blackxored)
|
26
|
+
* Allow configuration of multiple servers with same hostname but different ports (@rsslldnphy)
|
27
|
+
* Add command line option to control role filtering (@andytinycat)
|
28
|
+
* Make use of recent changes in Rake to over-ride the application name (@shime)
|
29
|
+
* Readme corrections (@nathanstitt)
|
30
|
+
* Allow roles to be fetched with a variable containing an array (@seenmyfate)
|
31
|
+
* Improve console (@jage)
|
32
|
+
* Add ability to filter tasks to specific servers (host filtering). (@andytinycat)
|
33
|
+
* Add a command line option to control role filter (`--roles`) (@andytinycat)
|
34
|
+
* Use an SCM object with a pluggable strategy (@coffeeaddict)
|
35
|
+
|
36
|
+
Big thanks to @Kriechi for his help.
|
37
|
+
|
38
|
+
## `3.0.1`
|
39
|
+
|
40
|
+
* `capify` not listed as executable (@leehambley)
|
8
41
|
* Confirm license as MIT (@leehambley)
|
9
42
|
* Move the git ssh helper to application path (@mpapis)
|
10
43
|
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
## CONTRIBUTING
|
2
|
+
|
3
|
+
**The issue tracker is intended exclusively for things that are genuine bugs,
|
4
|
+
or improvements to the code.**
|
5
|
+
|
6
|
+
If you have a user support query, or you suspect that you might just be holding
|
7
|
+
it wrong, drop us a line at [the mailing list]() or on [StackOverflow](). The
|
8
|
+
mailing list is moderated to cut down on spam, so please be patient, if you use
|
9
|
+
StackOverflow, make sure to tag your post with "Capistrano". (Not forgetting
|
10
|
+
any other tags which might relate, rvm, rbenv, Ubuntu, etc.)
|
11
|
+
|
12
|
+
Wherever you post please be sure to include the version of Capistrano you are
|
13
|
+
using, which versions of any plugins (*capistrano-rvm*, *capistrano-bundler*,
|
14
|
+
etc.). Proper logs are vital, if you need to redact them, go ahead, but be
|
15
|
+
careful not to remove anything important. Please take care to format logs and
|
16
|
+
code correctly, ideally wrapped to a sane line length, and in a mono spaced
|
17
|
+
font. This all helps us to gather a clear understanding of what is going wrong.
|
18
|
+
|
19
|
+
**If you really think that you found a bug, or want to enquire about a feature,
|
20
|
+
or send us a patch to add a feature, or fix a bug, please keep a few things in
|
21
|
+
mind:**
|
22
|
+
|
23
|
+
## When Submitting An Issue:
|
24
|
+
|
25
|
+
If you think there's a bug, please make sure it's really a bug in Capistrano.
|
26
|
+
As Capistrano sits on the (sometimes rough) edges between SSH, Git, the
|
27
|
+
network, Ruby, RVM, rbenv, chruby, Bundler, your Linux distribution, countless
|
28
|
+
shell configuration files on your end, and the server… there's a good chance
|
29
|
+
the problem lies somewhere else.
|
30
|
+
|
31
|
+
Please make sure you have reviewed the FAQs at http://www.capistranorb.com/.
|
32
|
+
|
33
|
+
It's really important to include as much information as possible, versions of
|
34
|
+
everything involved, anything weird you might be doing that might be having
|
35
|
+
side effects, include as much as you can in a [GitHub
|
36
|
+
Gist](https://gist.github.com/) and link that from the issue, with tools such
|
37
|
+
as Gist, we can link to individual lines and help work out what is going wrong.
|
38
|
+
|
39
|
+
If you are an experienced Ruby programmer, take a few minutes to get our test
|
40
|
+
suite running, and do what you can to get a test case written that fails, from
|
41
|
+
there we can understand exactly what it takes to reproduce the issue (as it's
|
42
|
+
documented with code)
|
43
|
+
|
44
|
+
## When Requesting a Feature:
|
45
|
+
|
46
|
+
We can't make everyone happy all of the time, and we've been around the block
|
47
|
+
well enough to know when something doesn't work well, or when your proposed fix
|
48
|
+
might impact other things.
|
49
|
+
|
50
|
+
We prefer to [start with
|
51
|
+
"no"](https://gettingreal.37signals.com/ch05_Start_With_No.php), and help you
|
52
|
+
find a better way to solve your problem, sometimes the solution is to [build
|
53
|
+
faster
|
54
|
+
horses](http://blog.cauvin.org/2010/07/henry-fords-faster-horse-quote.html),
|
55
|
+
sometimes the solution is to work around it in a neat way that you didn't know
|
56
|
+
existed.
|
57
|
+
|
58
|
+
Please don't be offended if we say no, and don't be afraid to fight your
|
59
|
+
corner, try and avoid being one of the [poisonous
|
60
|
+
people](https://www.youtube.com/watch?v=Q52kFL8zVoM)
|
61
|
+
|
62
|
+
## Submitting A Pull Request:
|
63
|
+
|
64
|
+
Pull requests are awesome, and if they arrive with decent tests, and conform to
|
65
|
+
the guidelines below, we'll merge them in as soon as possible, we'll let you
|
66
|
+
know which release we're planning them for (we adhere to
|
67
|
+
[semver](http://semver.org/) so please don't be upset if we plan your changes
|
68
|
+
for a later release)
|
69
|
+
|
70
|
+
* The code is MIT licenced, your code will fall under the same license if we merge it.
|
71
|
+
* We can't merge it without a [good commit
|
72
|
+
message](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message).
|
73
|
+
If you do this right, Github will use the commit message as the body of your
|
74
|
+
pull request, double win.
|
75
|
+
* If you are referencing an improvement to an existing issue (if we have not
|
76
|
+
yet merged it )
|
77
|
+
* Add an entry to the `CHANGELOG` under the `### master` section, but please
|
78
|
+
don't mess with the version.
|
79
|
+
* If you add a new feature, please make sure to document it, open a
|
80
|
+
corresponding pull request in [the
|
81
|
+
documentation](https://github.com/capistrano/documentation) and mention the
|
82
|
+
code change pull request over there, and Github will link everything up. If
|
83
|
+
it's a simple feature, or a new variable, or something changed, it may be
|
84
|
+
appropriate simply to document it in the generated `Capfile` or `deploy.rb`, or
|
85
|
+
in the `README`
|
86
|
+
* Take care to squash your commit into one single commit with a good message, it
|
87
|
+
saves us a lot of work in maintaining the CHANGELOG if we can generate it from
|
88
|
+
the commit messages between the release tags!
|
89
|
+
* Tests! It's tricky to test some parts of Capistrano, but do your best, it
|
90
|
+
might just serve as a starting point for us to build a reliable test on top of,
|
91
|
+
and help us understand where you are coming from.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
11
|
``` ruby
|
12
|
-
gem 'capistrano', '~> 3.0.
|
12
|
+
gem 'capistrano', '~> 3.0.1'
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
@@ -65,7 +65,7 @@ server 'example.org', roles: [:db, :workers]
|
|
65
65
|
desc "Report Uptimes"
|
66
66
|
task :uptime do
|
67
67
|
on roles(:all) do |host|
|
68
|
-
info "Host #{host} (#{host.roles.join(', ')}):\t#{capture(:uptime)}"
|
68
|
+
info "Host #{host} (#{host.roles.to_a.join(', ')}):\t#{capture(:uptime)}"
|
69
69
|
end
|
70
70
|
end
|
71
71
|
```
|
@@ -91,7 +91,7 @@ after :finishing, :notify do
|
|
91
91
|
end
|
92
92
|
```
|
93
93
|
|
94
|
-
If it makes sense for your use
|
94
|
+
If it makes sense for your use case (often, that means *generating a file*)
|
95
95
|
the Rake prerequisite mechanism can be used:
|
96
96
|
|
97
97
|
``` ruby
|
@@ -126,9 +126,9 @@ This method is widely used.
|
|
126
126
|
``` ruby
|
127
127
|
desc "Ask about breakfast"
|
128
128
|
task :breakfast do
|
129
|
-
|
129
|
+
ask(:breakfast, "pancakes")
|
130
130
|
on roles(:all) do |h|
|
131
|
-
execute "echo \"$(whoami) wants #{breakfast} for breakfast!\"
|
131
|
+
execute "echo \"$(whoami) wants #{fetch(:breakfast)} for breakfast!\""
|
132
132
|
end
|
133
133
|
end
|
134
134
|
```
|
@@ -184,7 +184,7 @@ DEBUG [9ce34809] leehambley pts/0 2013-06-13 17:11 (port-11262.pppoe.wtn
|
|
184
184
|
|
185
185
|
## A word about PTYs
|
186
186
|
|
187
|
-
There is a configuration option which asks the backend driver to
|
187
|
+
There is a configuration option which asks the backend driver to ask the remote host
|
188
188
|
to assign the connection a *pty*. A *pty* is a pseudo-terminal, which in effect means
|
189
189
|
*tell the backend that this is an **interactive** session*. This is normally a bad idea.
|
190
190
|
|
@@ -200,7 +200,7 @@ or at least they are being used incorrectly.
|
|
200
200
|
Whilst, especially in the case of language runtimes (Ruby, Node, Python and friends in
|
201
201
|
particular) there is a temptation to run multiple versions in parallel on a single server
|
202
202
|
and to switch between them using environmental variables, this is an anti-pattern, and
|
203
|
-
symptomatic of bad design (
|
203
|
+
symptomatic of bad design (e.g. you're testing a second version of Ruby in production because
|
204
204
|
your company lacks the infrastructure to test this in a staging environment).
|
205
205
|
|
206
206
|
## Configuration
|
@@ -210,9 +210,7 @@ The following variables are settable:
|
|
210
210
|
| Variable Name | Description | Notes |
|
211
211
|
|:---------------------:|----------------------------------------------------------------------|-----------------------------------------------------------------|
|
212
212
|
| `:repo_url` | The URL of your Git repository | file://, https://, or ssh:// are all supported |
|
213
|
-
| `:
|
214
|
-
| `:git_https_password` | The (optional) password for accessing your Git repository over HTTPS | if this is an SSH connection, this setting will have no effect. |
|
215
|
-
| `:tmp_dir` | The (optional) temp directory that will be used (default: /tmp) | if you have a shared web host, this setting may need to be set (i.e. /home/user/tmp/capistrano). |
|
213
|
+
| `:tmp_dir` | The (optional) temp directory that will be used (default: /tmp) | if you have a shared web host, this setting may need to be set (i.e. /home/user/tmp/capistrano). |
|
216
214
|
|
217
215
|
__Support removed__ for following variables:
|
218
216
|
|
@@ -223,7 +221,7 @@ __Support removed__ for following variables:
|
|
223
221
|
## SSHKit
|
224
222
|
|
225
223
|
[SSHKit](https://github.com/leehambley/sshkit) is the driver for SSH
|
226
|
-
connections behind the scenes in Capistrano
|
224
|
+
connections behind the scenes in Capistrano. Depending on how deep you dig, you
|
227
225
|
might run into interfaces that come directly from SSHKit (the configuration is
|
228
226
|
a good example).
|
229
227
|
|
data/capistrano.gemspec
CHANGED
@@ -19,19 +19,16 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
gem.licenses = ['MIT']
|
21
21
|
|
22
|
-
gem.post_install_message =
|
22
|
+
gem.post_install_message = <<eos
|
23
|
+
Capistrano 3.1 has some breaking changes, like `deploy:restart` callback should be added manually to your deploy.rb. Please, check the CHANGELOG: http://goo.gl/SxB0lr
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
If you're upgrading Capistrano from 2.x, we recommend to read the upgrade guide: http://goo.gl/4536kB
|
26
|
+
eos
|
26
27
|
|
27
|
-
gem.add_dependency 'sshkit', '
|
28
|
+
gem.add_dependency 'sshkit', '~> 1.3'
|
28
29
|
gem.add_dependency 'rake', '>= 10.0.0'
|
29
30
|
gem.add_dependency 'i18n'
|
30
31
|
|
31
32
|
gem.add_development_dependency 'rspec'
|
32
33
|
gem.add_development_dependency 'mocha'
|
33
|
-
gem.add_development_dependency 'vagrant', '~> 1.0.7'
|
34
|
-
gem.add_development_dependency 'kuroko'
|
35
|
-
gem.add_development_dependency 'cucumber'
|
36
|
-
|
37
34
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Feature: The path to the configuration can be changed, removing the need to
|
2
|
+
follow Ruby/Rails conventions
|
3
|
+
|
4
|
+
Background:
|
5
|
+
Given a test app with the default configuration
|
6
|
+
And servers with the roles app and web
|
7
|
+
|
8
|
+
Scenario: Deploying with configuration in default location
|
9
|
+
When I run "cap test"
|
10
|
+
Then the task is successful
|
11
|
+
|
12
|
+
Scenario: Deploying with configuration in a custom location
|
13
|
+
But the configuration is in a custom location
|
14
|
+
When I run "cap test"
|
15
|
+
Then the task is successful
|
data/features/deploy.feature
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: Deploy failure
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a test app with the default configuration
|
5
|
+
And a custom task that will simulate a failure
|
6
|
+
And a custom task to run in the event of a failure
|
7
|
+
And servers with the roles app and web
|
8
|
+
|
9
|
+
Scenario: Triggering the custom task
|
10
|
+
When I run cap "deploy:starting"
|
11
|
+
But an error is raised
|
12
|
+
Then the failure task will not run
|
13
|
+
|
14
|
+
Scenario: Triggering the custom task
|
15
|
+
When I run cap "deploy"
|
16
|
+
But an error is raised
|
17
|
+
Then the failure task will run
|
@@ -88,3 +88,22 @@ end
|
|
88
88
|
Then(/^it will not recreate the file$/) do
|
89
89
|
#
|
90
90
|
end
|
91
|
+
|
92
|
+
Then(/^the task is successful$/) do
|
93
|
+
expect(@success).to be_true
|
94
|
+
end
|
95
|
+
|
96
|
+
Then(/^the failure task will run$/) do
|
97
|
+
failed = TestApp.shared_path.join('failed')
|
98
|
+
run_vagrant_command(test_file_exists(failed))
|
99
|
+
end
|
100
|
+
|
101
|
+
Then(/^the failure task will not run$/) do
|
102
|
+
failed = TestApp.shared_path.join('failed')
|
103
|
+
!run_vagrant_command(test_file_exists(failed))
|
104
|
+
end
|
105
|
+
|
106
|
+
When(/^an error is raised$/) do
|
107
|
+
error = TestApp.shared_path.join('fail')
|
108
|
+
run_vagrant_command(test_file_exists(error))
|
109
|
+
end
|
@@ -1,8 +1,12 @@
|
|
1
1
|
When(/^I run cap "(.*?)"$/) do |task|
|
2
|
-
TestApp.cap(task)
|
2
|
+
@success = TestApp.cap(task)
|
3
3
|
end
|
4
4
|
|
5
5
|
When(/^I run cap "(.*?)" as part of a release$/) do |task|
|
6
6
|
TestApp.cap("deploy:new_release_path #{task}")
|
7
7
|
end
|
8
8
|
|
9
|
+
When(/^I run "(.*?)"$/) do |command|
|
10
|
+
@success = TestApp.run(command)
|
11
|
+
end
|
12
|
+
|
@@ -23,3 +23,16 @@ Given(/^a custom task to generate a file$/) do
|
|
23
23
|
TestApp.copy_task_to_test_app('spec/support/tasks/database.cap')
|
24
24
|
end
|
25
25
|
|
26
|
+
Given(/^the configuration is in a custom location$/) do
|
27
|
+
TestApp.move_configuration_to_custom_location('app')
|
28
|
+
end
|
29
|
+
|
30
|
+
Given(/^a custom task that will simulate a failure$/) do
|
31
|
+
safely_remove_file(TestApp.shared_path.join('failed'))
|
32
|
+
TestApp.copy_task_to_test_app('spec/support/tasks/fail.cap')
|
33
|
+
end
|
34
|
+
|
35
|
+
Given(/^a custom task to run in the event of a failure$/) do
|
36
|
+
safely_remove_file(TestApp.shared_path.join('failed'))
|
37
|
+
TestApp.copy_task_to_test_app('spec/support/tasks/failed.cap')
|
38
|
+
end
|
@@ -15,6 +15,10 @@ module RemoteCommandHelpers
|
|
15
15
|
def exists?(type, path)
|
16
16
|
%{[ -#{type} "#{path}" ] && echo "#{path} exists." || echo "Error: #{path} does not exist."}
|
17
17
|
end
|
18
|
+
|
19
|
+
def safely_remove_file(path)
|
20
|
+
run_vagrant_command("rm #{test_file}") rescue Vagrant::Errors::VagrantError
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
World(RemoteCommandHelpers)
|
@@ -3,22 +3,24 @@ module Capistrano
|
|
3
3
|
|
4
4
|
def initialize
|
5
5
|
super
|
6
|
-
@name = "cap"
|
7
6
|
@rakefiles = %w{capfile Capfile capfile.rb Capfile.rb} << capfile
|
8
7
|
end
|
9
8
|
|
9
|
+
def name
|
10
|
+
"cap"
|
11
|
+
end
|
12
|
+
|
10
13
|
def run
|
11
14
|
Rake.application = self
|
12
15
|
super
|
13
16
|
end
|
14
17
|
|
15
18
|
def sort_options(options)
|
16
|
-
options.push(version,dry_run)
|
19
|
+
options.push(version, roles, dry_run, hostfilter)
|
17
20
|
super
|
18
21
|
end
|
19
22
|
|
20
23
|
def load_rakefile
|
21
|
-
@name = 'cap'
|
22
24
|
super
|
23
25
|
end
|
24
26
|
|
@@ -30,8 +32,25 @@ module Capistrano
|
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
35
|
+
def exit_because_of_exception(ex)
|
36
|
+
if deploying?
|
37
|
+
exit_deploy_because_of_exception(ex)
|
38
|
+
else
|
39
|
+
super
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
33
43
|
private
|
34
44
|
|
45
|
+
def load_imports
|
46
|
+
if options.show_tasks
|
47
|
+
invoke 'load:defaults'
|
48
|
+
Dir[deploy_config_path, stage_definitions].each { |f| add_import f }
|
49
|
+
end
|
50
|
+
|
51
|
+
super
|
52
|
+
end
|
53
|
+
|
35
54
|
# allows the `cap install` task to load without a capfile
|
36
55
|
def capfile
|
37
56
|
File.expand_path(File.join(File.dirname(__FILE__),'..','Capfile'))
|
@@ -55,6 +74,25 @@ module Capistrano
|
|
55
74
|
}
|
56
75
|
]
|
57
76
|
end
|
77
|
+
|
78
|
+
def roles
|
79
|
+
['--roles ROLES', '-r',
|
80
|
+
"Filter command to only apply to these roles (separate multiple roles with a comma)",
|
81
|
+
lambda { |value|
|
82
|
+
Configuration.env.set(:filter, :roles => value.split(","))
|
83
|
+
}
|
84
|
+
]
|
85
|
+
end
|
86
|
+
|
87
|
+
def hostfilter
|
88
|
+
['--hosts HOSTS', '-z',
|
89
|
+
"Filter command to only apply to these hosts (separate multiple hosts with a comma)",
|
90
|
+
lambda { |value|
|
91
|
+
Configuration.env.set(:filter, :hosts => value.split(","))
|
92
|
+
}
|
93
|
+
]
|
94
|
+
end
|
95
|
+
|
58
96
|
end
|
59
97
|
|
60
98
|
end
|