capistrano 2.14.2 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG +49 -8
  4. data/Gemfile +1 -1
  5. data/README.md +4 -4
  6. data/capistrano.gemspec +9 -17
  7. data/lib/capistrano/callback.rb +1 -1
  8. data/lib/capistrano/cli.rb +1 -1
  9. data/lib/capistrano/cli/execute.rb +3 -3
  10. data/lib/capistrano/cli/help.rb +3 -3
  11. data/lib/capistrano/cli/help.txt +23 -23
  12. data/lib/capistrano/cli/options.rb +12 -12
  13. data/lib/capistrano/command.rb +20 -7
  14. data/lib/capistrano/configuration/actions/invocation.rb +23 -11
  15. data/lib/capistrano/configuration/connections.rb +22 -15
  16. data/lib/capistrano/configuration/execution.rb +2 -2
  17. data/lib/capistrano/configuration/loading.rb +2 -2
  18. data/lib/capistrano/configuration/log_formatters.rb +5 -1
  19. data/lib/capistrano/configuration/roles.rb +1 -1
  20. data/lib/capistrano/configuration/servers.rb +6 -6
  21. data/lib/capistrano/errors.rb +4 -4
  22. data/lib/capistrano/ext/multistage.rb +2 -2
  23. data/lib/capistrano/logger.rb +14 -1
  24. data/lib/capistrano/recipes/deploy.rb +94 -27
  25. data/lib/capistrano/recipes/deploy/assets.rb +21 -18
  26. data/lib/capistrano/recipes/deploy/dependencies.rb +2 -2
  27. data/lib/capistrano/recipes/deploy/remote_dependency.rb +11 -11
  28. data/lib/capistrano/recipes/deploy/scm.rb +1 -1
  29. data/lib/capistrano/recipes/deploy/scm/accurev.rb +6 -6
  30. data/lib/capistrano/recipes/deploy/scm/cvs.rb +4 -4
  31. data/lib/capistrano/recipes/deploy/scm/darcs.rb +3 -3
  32. data/lib/capistrano/recipes/deploy/scm/git.rb +3 -0
  33. data/lib/capistrano/recipes/deploy/scm/mercurial.rb +3 -3
  34. data/lib/capistrano/recipes/deploy/scm/none.rb +9 -5
  35. data/lib/capistrano/recipes/deploy/scm/perforce.rb +5 -5
  36. data/lib/capistrano/recipes/deploy/scm/subversion.rb +1 -1
  37. data/lib/capistrano/recipes/deploy/strategy.rb +1 -1
  38. data/lib/capistrano/recipes/deploy/strategy/base.rb +5 -1
  39. data/lib/capistrano/recipes/deploy/strategy/copy.rb +14 -2
  40. data/lib/capistrano/recipes/standard.rb +1 -1
  41. data/lib/capistrano/server_definition.rb +1 -1
  42. data/lib/capistrano/shell.rb +4 -1
  43. data/lib/capistrano/ssh.rb +1 -1
  44. data/lib/capistrano/version.rb +2 -2
  45. data/test/cli/options_test.rb +1 -1
  46. data/test/cli/ui_test.rb +1 -1
  47. data/test/command_test.rb +11 -1
  48. data/test/configuration/actions/invocation_test.rb +5 -1
  49. data/test/configuration/callbacks_test.rb +1 -1
  50. data/test/configuration/connections_test.rb +19 -0
  51. data/test/configuration/execution_test.rb +1 -1
  52. data/test/configuration/namespace_dsl_test.rb +6 -6
  53. data/test/configuration/roles_test.rb +2 -2
  54. data/test/configuration/servers_test.rb +12 -12
  55. data/test/configuration/variables_test.rb +3 -3
  56. data/test/deploy/scm/bzr_test.rb +1 -1
  57. data/test/deploy/scm/darcs_test.rb +2 -2
  58. data/test/deploy/scm/git_test.rb +10 -0
  59. data/test/deploy/scm/mercurial_test.rb +3 -3
  60. data/test/deploy/scm/perforce_test.rb +1 -1
  61. data/test/deploy/strategy/copy_test.rb +25 -1
  62. data/test/extensions_test.rb +1 -1
  63. data/test/logger_formatting_test.rb +56 -1
  64. data/test/recipes_test.rb +1 -1
  65. data/test/server_definition_test.rb +2 -2
  66. data/test/shell_test.rb +12 -6
  67. data/test/transfer_test.rb +1 -1
  68. metadata +63 -31
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 01115be3e8ab363fc0f9555eb6e3504e3e6eb709
4
+ data.tar.gz: 9b8b1fc5f765d23f5a336f25c28c2a3078793806
5
+ SHA512:
6
+ metadata.gz: 85916614f98a4f4d0f816b9ad2689e952fe05ec7ec3db49ff83e4ff08423c9d6b9e7a57cb84bdd401020172548a842ecf6bcc8458ed27438d3b9d727401dc8a0
7
+ data.tar.gz: 9283b6c3631fe2be2884b826141be26944a6b1d4037a2f036c8fed81ed8e776a7fc02c80ffa2a353e97ac084fe793c7429410c95df9dd5dc82c0fdfd1adebcfc
@@ -3,4 +3,5 @@ rvm:
3
3
  - 1.8.7
4
4
  - 1.9.2
5
5
  - 1.9.3
6
+ - 2.0.0
6
7
  - ree
data/CHANGELOG CHANGED
@@ -1,4 +1,45 @@
1
- ## 2.14.1 (tentative) / January 10 2013
1
+ ## 2.15.0 / April 23 2013
2
+
3
+ * New varaible :shared_assets_prefix to allow people to host somewhere other
4
+ than `/assets/`. Default is `assets`.
5
+ * Bring back web:enable and web:disable tasks. Sincerely apologies to all affected
6
+ removing these was one of the most glaring mistakes we've made on this projec
7
+ and I feel personally responsible.
8
+ * Makes :git_shallow_clone work with branches (@cannikin)
9
+ * Avoid removing required assets (@bosko)
10
+ * Fix escaping of asset_paths when calling `deploy:finalize_update` (@mcary)
11
+ * Improve parallel command logging (@mpapis)
12
+ * Allow updating variables in the cap shell `cap> set :some_setting new_value`
13
+ (@jpfuentes2)
14
+ * Add the option to configure `Capistrano::Logger.default_formatters=` this
15
+ relates to the previous merging of the capistrano-colors gem. (@kellyredding)
16
+ * Don't attempt to connect to a nil `:gateway` (@mattheath)
17
+ * Simplify our .gemspec dependency list (@timoschilling)
18
+ * Make the existece of `config/deploy/{stage}.rb` optional, it'll be loaded if
19
+ it exists, otherwise we continue without it (@ymainier)
20
+ * Misc spelling/typo fixes. (@mv)
21
+ * Update mtime and atime with touch when fixing asset timestamps (@wildoats)
22
+ * Change call of `rake {env} precompile:all` to drop the errornous `{env}` (@zxiest)
23
+ * Evaluate assets_role at runtime using a lambda (@nlenepveu)
24
+ * Handle when hosts (for example by joining/leaving the no_release meta group)
25
+ have different old releases for `deploy:cleanup` (@oggy)
26
+ * Check for nil when tearing down connections (@yyuu)
27
+ * Go back to using SCP for uploads as against SFTP (@pjungwir)
28
+ * Added an option to dereference symlinks when using the :copy strategy
29
+ (`set :copy_dereference_symlink, true`) useful when your working directory
30
+ contains files symlinked in from outside your project root (@mehmetc)
31
+ * Small typo fix in README (@yule)
32
+ * Add Ruby 2.0.0-p0 to the TravisCI build (@jarrettmeyer)
33
+ * Add the option to set the shared asset prefix for Rails,
34
+ (`set :shared_assets_prefix, "my_shared_assets"`) corresponds with it's
35
+ namesake in Rails. By default is set to `assets`. (@spectator)
36
+ * Improved error messages for `cap {stage} deploy:check` (@petems)
37
+ * Make `run_locally` work with the `--dry-run` flag. (@flagthisiskun)
38
+ * Fix a link in the README to writing a good commit message. (@mhutchin)
39
+ * Code style fixes (@mv)
40
+ * Report differently if the command was killed by a signal (for example the
41
+ oom killer on Ubuntu/Debian). (@tanob)
42
+
2
43
 
3
44
  ## 2.14.0 / January 9 2013
4
45
 
@@ -227,26 +268,26 @@ Git-version requirement for the new implementation is now >= 1.5.6, from
227
268
  previously un-documented. (1.5.6 is new-enough that I think this is
228
269
  acceptable)
229
270
 
230
- * Upgrade Net::SSH-gateway dependency to 1.1 (fixes a thread-deadlocking bug on MRI 1.9)
231
- * Respect "dry-run" on transfer methods (Florian Frank)
232
- * Add support for multiple gateways: (Ryan Duryea)
271
+ * Upgrade Net::SSH-gateway dependency to 1.1 (fixes a thread-deadlocking bug on MRI 1.9)
272
+ * Respect "dry-run" on transfer methods (Florian Frank)
273
+ * Add support for multiple gateways: (Ryan Duryea)
233
274
  set :gateway, {
234
275
  'gate1.example.com' => 'server1.example.com',
235
276
  [ 'gate2.example.com', 'gate3.example.com' ] => [ 'server5.example.com', 'server6.example.com' ]
236
277
  }
237
- * Properly support nested Git submodules, moves Git requirement to >= 1.5.6 [if you rely upon submodules] (Ken Miller)
278
+ * Properly support nested Git submodules, moves Git requirement to >= 1.5.6 [if you rely upon submodules] (Ken Miller)
238
279
  * Fetch tags into the remote cache, allows deploying a tag when using Git, with the remote_cache strategy (Florian Frank)
239
280
  * Various fixes to path handling bugs in the copt strategy. (Philippe Rathé)
240
281
 
241
282
  ## 2.5.21 / April 6 2011
242
283
 
243
- * Fixed to follow best-practice guidelines from Bundler (Ben Langfeld)
244
- * No longer force a gemset for Capistrano development. (Ben Langfeld)
284
+ * Fixed to follow best-practice guidelines from Bundler (Ben Langfeld)
285
+ * No longer force a gemset for Capistrano development. (Ben Langfeld)
245
286
 
246
287
  ## 2.5.20 / March 16 2011
247
288
 
248
289
  * `deploy:migrations` will now always operate on the latest_release, not
249
- current_release (Mike Vincent)
290
+ current_release (Mike Vincent)
250
291
  * Adds a check for the presence of `rsync` when using the copy strategy with `rsync`. (Chris Griego)
251
292
  * Do not try to look up the `:release_path` on servers which are defined `:no_release` (Chris Griego)
252
293
  * Tiny patch to the `CVS` SCM code to be Ruby 1.9 compatible (Martin Carpenter)
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source "http://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  #
7
- # Development Dependencies from the Gemfile
7
+ # Development Dependencies from the Gemfile
8
8
  # are merged here.
9
9
  #
10
10
  group :development do
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ## Capistrano
2
2
 
3
3
  [![Build
4
- Status](https://secure.travis-ci.org/capistrano/capistrano.png)](http://travis-ci.org/capistrano/capistrano)
4
+ Status](https://secure.travis-ci.org/capistrano/capistrano.png)](http://travis-ci.org/capistrano/capistrano)[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/capistrano/capistrano)
5
5
 
6
6
 
7
7
  Capistrano is a utility and framework for executing commands in parallel on
@@ -39,7 +39,7 @@ assumptions behind these opinions are:
39
39
 
40
40
  * You are using SSH to access the remote servers.
41
41
  * You either have the same password to all target machines, or you have public
42
- keys in place to allow passwordless access to them.
42
+ keys in place to allow passwordless access to them.
43
43
 
44
44
  Do not expect these assumptions to change.
45
45
 
@@ -55,7 +55,7 @@ Use the `cap` script as follows:
55
55
  cap sometask
56
56
 
57
57
  By default, the script will look for a file called one of `capfile` or
58
- `Capfile`. The `someaction` text indicates which task to execute. You can do
58
+ `Capfile`. The `sometask` text indicates which task to execute. You can do
59
59
  "cap -h" to see all the available options and "cap -T" to see all the available
60
60
  tasks.
61
61
 
@@ -68,7 +68,7 @@ tasks.
68
68
  * Push to your branch - `git push origin my_branch`
69
69
  * Create a Pull Request from your branch, include as much documentation
70
70
  as you can in the commit message/pull request, following these
71
- [guidelines on writing a good commit message](http://spheredev.org/wiki/Git_for_the_lazy#Writing_good_commit_messages)
71
+ [guidelines on writing a good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
72
72
  * That's it!
73
73
 
74
74
 
@@ -20,23 +20,15 @@ Gem::Specification.new do |s|
20
20
  "README.md"
21
21
  ]
22
22
 
23
- if s.respond_to? :specification_version then
24
- s.specification_version = 3
25
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<highline>, [">= 0"])
27
- s.add_runtime_dependency(%q<net-ssh>, [">= 2.0.14"])
28
- s.add_runtime_dependency(%q<net-sftp>, [">= 2.0.0"])
29
- s.add_runtime_dependency(%q<net-scp>, [">= 1.0.0"])
30
- s.add_runtime_dependency(%q<net-ssh-gateway>, [">= 1.1.0"])
31
- s.add_development_dependency(%q<mocha>, ["0.9.12"])
32
- else
33
- s.add_dependency(%q<net-ssh>, [">= 2.0.14"])
34
- s.add_dependency(%q<net-sftp>, [">= 2.0.0"])
35
- s.add_dependency(%q<net-scp>, [">= 1.0.0"])
36
- s.add_dependency(%q<net-ssh-gateway>, [">= 1.1.0"])
37
- s.add_dependency(%q<highline>, [">= 0"])
38
- s.add_dependency(%q<mocha>, ["0.9.12"])
39
- end
23
+ s.specification_version = 3 if s.respond_to? :specification_version
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<highline>, [">= 0"])
27
+ s.add_runtime_dependency(%q<net-ssh>, [">= 2.0.14"])
28
+ s.add_runtime_dependency(%q<net-sftp>, [">= 2.0.0"])
29
+ s.add_runtime_dependency(%q<net-scp>, [">= 1.0.0"])
30
+ s.add_runtime_dependency(%q<net-ssh-gateway>, [">= 1.1.0"])
31
+ s.add_development_dependency(%q<mocha>, ["0.9.12"])
40
32
  else
41
33
  s.add_dependency(%q<net-ssh>, [">= 2.0.14"])
42
34
  s.add_dependency(%q<net-sftp>, [">= 2.0.0"])
@@ -42,4 +42,4 @@ module Capistrano
42
42
  super && (task.nil? || task.fully_qualified_name != source.to_s)
43
43
  end
44
44
  end
45
- end
45
+ end
@@ -20,7 +20,7 @@ module Capistrano
20
20
  # Capistrano::CLI.parse(%W(-vvvv -f config/deploy update_code)).execute!
21
21
  #
22
22
  # Note that you can also embed cap directly by creating a new Configuration
23
- # instance and setting it up, The above snippet, redone using the
23
+ # instance and setting it up, The above snippet, redone using the
24
24
  # Configuration class directly, would look like:
25
25
  #
26
26
  # require 'capistrano'
@@ -55,10 +55,10 @@ module Capistrano
55
55
  def load_recipes(config) #:nodoc:
56
56
  # load the standard recipe definition
57
57
  config.load "standard"
58
-
58
+
59
59
  # load systemwide config/recipe definition
60
- config.load(options[:sysconf]) if options[:sysconf] && File.file?(options[:sysconf])
61
-
60
+ config.load(options[:sysconf]) if options[:sysconf] && File.file?(options[:sysconf])
61
+
62
62
  # load user config/recipe definition
63
63
  config.load(options[:dotfile]) if options[:dotfile] && File.file?(options[:dotfile])
64
64
 
@@ -111,14 +111,14 @@ module Capistrano
111
111
  end
112
112
 
113
113
  def output_columns #:nodoc:
114
- if ( @output_columns.nil? )
114
+ if ( @output_columns.nil? )
115
115
  if ( self.class.ui.output_cols.nil? )
116
- @output_columns = 80
116
+ @output_columns = 80
117
117
  else
118
118
  @output_columns = self.class.ui.output_cols
119
119
  end
120
120
  end
121
- @output_columns
121
+ @output_columns
122
122
  end
123
123
  end
124
124
  end
@@ -6,76 +6,76 @@ Capistrano is a utility for automating the execution of commands across multiple
6
6
 
7
7
  The command-line interface to Capistrano is via the `cap' command.
8
8
 
9
- cap [ option ] ... action ...
9
+ cap [ option ] ... action ...
10
10
 
11
11
  The following options are understood:
12
12
 
13
13
  <%= color '-d, --debug', :bold %>
14
- Causes Capistrano to pause and prompt before executing any remote command, giving the user the option to either execute the command, skip the command, or abort execution entirely. This makes it a great way to troubleshoot tasks, or test custom tasks, by executing commands one at a time and checking the server to make sure they worked as expected before moving on to the next command. (Compare this to the --dry-run command.)
14
+ Causes Capistrano to pause and prompt before executing any remote command, giving the user the option to either execute the command, skip the command, or abort execution entirely. This makes it a great way to troubleshoot tasks, or test custom tasks, by executing commands one at a time and checking the server to make sure they worked as expected before moving on to the next command. (Compare this to the --dry-run command.)
15
15
 
16
16
  <%= color '-e, --explain TASK', :bold %>
17
- Displays the extended description of the given task. Not all tasks will have an extended description, but for those that do, this can provide a wealth of additional usage information, such as describing environment variables or settings that can affect the execution of the task.
17
+ Displays the extended description of the given task. Not all tasks will have an extended description, but for those that do, this can provide a wealth of additional usage information, such as describing environment variables or settings that can affect the execution of the task.
18
18
 
19
19
  <%= color '-F, --default-config', :bold %>
20
- By default, cap will search for a config file named `Capfile' or `capfile' in the current directory, or in any parent directory, and will automatically load it. However, if you specify the -f flag (see below), cap will use that file instead of the default config. If you want to use both the default config, and files loaded via -f, you can specify -F to force cap to search for and load the default config, even if additional files were specified via -f.
20
+ By default, cap will search for a config file named `Capfile' or `capfile' in the current directory, or in any parent directory, and will automatically load it. However, if you specify the -f flag (see below), cap will use that file instead of the default config. If you want to use both the default config, and files loaded via -f, you can specify -F to force cap to search for and load the default config, even if additional files were specified via -f.
21
21
 
22
22
  <%= color '-f, --file FILE', :bold %>
23
- Causes the named file to be loaded. Capistrano will search both its own recipe directory, as well as the current directory, looking for the named file. An ".rb" extension is optional. The -f option may be given any number of times, but if it is given, it will take the place of the normal `Capfile' or `capfile' detection. Use -F if you want the default capfile to be loaded when you use -f.
23
+ Causes the named file to be loaded. Capistrano will search both its own recipe directory, as well as the current directory, looking for the named file. An ".rb" extension is optional. The -f option may be given any number of times, but if it is given, it will take the place of the normal `Capfile' or `capfile' detection. Use -F if you want the default capfile to be loaded when you use -f.
24
24
 
25
25
  <%= color '-H, --long-help', :bold %>
26
- Displays this document and exits.
26
+ Displays this document and exits.
27
27
 
28
28
  <%= color '-h, --help', :bold %>
29
- Shows a brief summary of these options and exits.
29
+ Shows a brief summary of these options and exits.
30
30
 
31
31
  <%= color '-l, --logger [STDERR|STDOUT|file]', :bold %>
32
- Change the file used to print the output. It offers three options: standard error(stderr), standard output and file. Options are not case sensitive. By default Capistrano uses stderr.
32
+ Change the file used to print the output. It offers three options: standard error(stderr), standard output and file. Options are not case sensitive. By default Capistrano uses stderr.
33
33
 
34
34
  <%= color '-n, --dry-run', :bold %>
35
- Causes Capistrano to simply display each remote command, without executing it. In this sense it is similar to --debug, but without the prompt. Note that commands executed locally are still run--only remote commands are skipped.
35
+ Causes Capistrano to simply display each remote command, without executing it. In this sense it is similar to --debug, but without the prompt. Note that commands executed locally are still run--only remote commands are skipped.
36
36
 
37
37
  <%= color '-p, --password', :bold %>
38
- Normally, cap will prompt for the password on-demand, the first time it is needed. This can make it hard to walk away from Capistrano, since you might not know if it will prompt for a password down the road. In such cases, you can use the -p option to force cap to prompt for the password immediately.
38
+ Normally, cap will prompt for the password on-demand, the first time it is needed. This can make it hard to walk away from Capistrano, since you might not know if it will prompt for a password down the road. In such cases, you can use the -p option to force cap to prompt for the password immediately.
39
39
 
40
40
  <%= color '-q, --quiet', :bold %>
41
- Display only critical error messages. All other output is suppressed.
41
+ Display only critical error messages. All other output is suppressed.
42
42
 
43
43
  <%= color '-S, --set-before NAME=VALUE', :bold %>
44
- Sets the given variable to the given value, before loading any recipe files. This is useful if you have a recipe file that depends on a certain variable being set, at the time it is loaded.
44
+ Sets the given variable to the given value, before loading any recipe files. This is useful if you have a recipe file that depends on a certain variable being set, at the time it is loaded.
45
45
 
46
46
  <%= color '-s, --set NAME=VALUE', :bold %>
47
- Sets the given variable to the given value, after loading all recipe files. This is useful when you want to override the value of a variable which is used in a task. Note that this will set the variables too late for them to affect conditions that are executed as the recipes are loaded.
47
+ Sets the given variable to the given value, after loading all recipe files. This is useful when you want to override the value of a variable which is used in a task. Note that this will set the variables too late for them to affect conditions that are executed as the recipes are loaded.
48
48
 
49
49
  <%= color '-T, --tasks PATTERN', :bold %>
50
- Displays the list of all tasks (matching optional PATTERN) in all loaded recipe files. If a task has no description, or if the description starts with the [internal] tag, the task will not be listed unless you also specify -v.
50
+ Displays the list of all tasks (matching optional PATTERN) in all loaded recipe files. If a task has no description, or if the description starts with the [internal] tag, the task will not be listed unless you also specify -v.
51
51
 
52
52
  <%= color '-t, --tool', :bold %>
53
- Abbreviates the output of -T for integration with other tools. Without -t, -T will list tasks with their summaries, and may include additional instructive text at the bottom. When integrating with other tools (e.g., bash auto-expansion and the like) that additional text can get in the way. This switch makes it easier for those tools to parse the list of tasks. (The -t switch has no effect if the -T switch is not specified.)
53
+ Abbreviates the output of -T for integration with other tools. Without -t, -T will list tasks with their summaries, and may include additional instructive text at the bottom. When integrating with other tools (e.g., bash auto-expansion and the like) that additional text can get in the way. This switch makes it easier for those tools to parse the list of tasks. (The -t switch has no effect if the -T switch is not specified.)
54
54
 
55
55
  <%= color '-V, --version', :bold %>
56
- Shows the current Capistrano version number and exits.
56
+ Shows the current Capistrano version number and exits.
57
57
 
58
58
  <%= color '-v, --verbose', :bold %>
59
- Increase the verbosity. You can specify this option up to three times to further increase verbosity. By default, cap will use maximum verbosity, but if you specify an explicit verbosity, that will be used instead. See also -q.
59
+ Increase the verbosity. You can specify this option up to three times to further increase verbosity. By default, cap will use maximum verbosity, but if you specify an explicit verbosity, that will be used instead. See also -q.
60
60
 
61
61
  <%= color '-X, --skip-system-config', :bold %>
62
- By default, cap will look for and (if it exists) load the global system configuration file located in /etc/capistrano.conf. If you don't want cap to load that file, give this option.
62
+ By default, cap will look for and (if it exists) load the global system configuration file located in /etc/capistrano.conf. If you don't want cap to load that file, give this option.
63
63
 
64
64
  <%= color '-x, --skip-user-config', :bold %>
65
- By default, cap will look for and (if it exists) load the user-specific configuration file located in $HOME/.caprc. If you don't want cap to load that file, give this option.
65
+ By default, cap will look for and (if it exists) load the user-specific configuration file located in $HOME/.caprc. If you don't want cap to load that file, give this option.
66
66
 
67
67
  -----------------------------
68
68
  <%= color('Environment Variables', :bold) %>
69
69
  -----------------------------
70
70
 
71
71
  <%= color 'HOSTS', :bold %>
72
- Execute the tasks against this comma-separated list of hosts. Effectively, this makes the host(s) part of every roles.
72
+ Execute the tasks against this comma-separated list of hosts. Effectively, this makes the host(s) part of every roles.
73
73
 
74
74
  <%= color 'HOSTFILTER', :bold %>
75
- Execute tasks against this comma-separated list of host, but only if the host has the proper role for the task.
75
+ Execute tasks against this comma-separated list of host, but only if the host has the proper role for the task.
76
76
 
77
77
  <%= color 'HOSTROLEFILTER', :bold %>
78
- Execute tasks against the hosts in this comma-separated list of roles, but only if the host has the proper role for the task.
78
+ Execute tasks against the hosts in this comma-separated list of roles, but only if the host has the proper role for the task.
79
79
 
80
80
  <%= color 'ROLES', :bold %>
81
- Execute tasks against this comma-separated list of roles. Hosts which do not have the right roles will be skipped.
81
+ Execute tasks against this comma-separated list of roles. Hosts which do not have the right roles will be skipped.
@@ -54,18 +54,18 @@ module Capistrano
54
54
  exit
55
55
  end
56
56
 
57
- opts.on("-l", "--logger [STDERR|STDOUT|file]",
58
- "Choose logger method. STDERR used by default."
59
- ) do |value|
60
- options[:output] = if value.nil? || value.upcase == 'STDERR'
61
- # Using default logger.
62
- nil
63
- elsif value.upcase == 'STDOUT'
64
- $stdout
65
- else
66
- value
67
- end
68
- end
57
+ opts.on("-l", "--logger [STDERR|STDOUT|file]",
58
+ "Choose logger method. STDERR used by default."
59
+ ) do |value|
60
+ options[:output] = if value.nil? || value.upcase == 'STDERR'
61
+ # Using default logger.
62
+ nil
63
+ elsif value.upcase == 'STDOUT'
64
+ $stdout
65
+ else
66
+ value
67
+ end
68
+ end
69
69
 
70
70
  opts.on("-n", "--dry-run",
71
71
  "Prints out commands without running them."
@@ -17,7 +17,7 @@ module Capistrano
17
17
  include Enumerable
18
18
 
19
19
  class Branch
20
- attr_accessor :command, :callback
20
+ attr_accessor :command, :callback, :condition
21
21
  attr_reader :options
22
22
 
23
23
  def initialize(command, options, callback)
@@ -43,14 +43,17 @@ module Capistrano
43
43
  true
44
44
  end
45
45
 
46
- def to_s
47
- command.inspect
46
+ def to_s(parallel=false)
47
+ if parallel && @condition
48
+ "#{condition.inspect} :: #{command.inspect}"
49
+ else
50
+ command.inspect
51
+ end
48
52
  end
49
53
  end
50
54
 
51
55
  class ConditionBranch < Branch
52
56
  attr_accessor :configuration
53
- attr_accessor :condition
54
57
 
55
58
  class Evaluator
56
59
  attr_reader :configuration, :condition, :server
@@ -89,9 +92,12 @@ module Capistrano
89
92
  def match(server)
90
93
  Evaluator.new(configuration, condition, server).result
91
94
  end
95
+ end
92
96
 
93
- def to_s
94
- "#{condition.inspect} :: #{command.inspect}"
97
+ class ElseBranch < Branch
98
+ def initialize(command, options, callback)
99
+ @condition = "else"
100
+ super(command, options, callback)
95
101
  end
96
102
  end
97
103
 
@@ -106,7 +112,7 @@ module Capistrano
106
112
  end
107
113
 
108
114
  def else(command, &block)
109
- @fallback = Branch.new(command, {}, block)
115
+ @fallback = ElseBranch.new(command, {}, block)
110
116
  end
111
117
 
112
118
  def branches_for(server)
@@ -243,6 +249,13 @@ module Capistrano
243
249
  ch[:status] = data.read_long
244
250
  end
245
251
 
252
+ channel.on_request("exit-signal") do |ch, data|
253
+ if logger
254
+ exit_signal = data.read_string
255
+ logger.important "command received signal #{exit_signal}", ch[:server]
256
+ end
257
+ end
258
+
246
259
  channel.on_close do |ch|
247
260
  ch[:closed] = true
248
261
  end
@@ -59,7 +59,7 @@ module Capistrano
59
59
  #
60
60
  # The string specified as the first argument to +when+ may be any valid
61
61
  # Ruby code. It has access to the following variables and methods:
62
- #
62
+ #
63
63
  # * +in?(role)+ returns true if the server participates in the given role
64
64
  # * +server+ is the ServerDefinition object for the server. This can be
65
65
  # used to get the host-name, etc.
@@ -121,7 +121,7 @@ module Capistrano
121
121
  # to run, then the hosts will be run in groups of max_hosts. The default is nil,
122
122
  # which indicates that there is no maximum host limit. Please note this does not
123
123
  # limit the number of SSH channels that can be open, only the number of hosts upon
124
- # which this will be called.
124
+ # which this will be called.
125
125
  # * :shell - says which shell should be used to invoke commands. This
126
126
  # defaults to "sh". Setting this to false causes Capistrano to invoke
127
127
  # the commands directly, without wrapping them in a shell invocation.
@@ -159,12 +159,26 @@ module Capistrano
159
159
  # use, but should instead be called indirectly, via #run or #parallel,
160
160
  # or #invoke_command.
161
161
  def run_tree(tree, options={}) #:nodoc:
162
- if tree.branches.empty? && tree.fallback
163
- logger.debug "executing #{tree.fallback}" unless options[:silent]
164
- elsif tree.branches.any?
165
- logger.debug "executing multiple commands in parallel"
166
- tree.each do |branch|
167
- logger.trace "-> #{branch}"
162
+ options = add_default_command_options(options)
163
+
164
+ if tree.branches.any? || tree.fallback
165
+ _, servers = filter_servers(options)
166
+ branches = servers.map{|server| tree.branches_for(server)}.compact
167
+ case branches.size
168
+ when 0
169
+ branches = tree.branches.dup + [tree.fallback]
170
+ case branches.size
171
+ when 1
172
+ logger.debug "no servers for #{branches.first}"
173
+ else
174
+ logger.debug "no servers for commands"
175
+ branches.each{ |branch| logger.trace "-> #{branch.to_s(true)}" }
176
+ end
177
+ when 1
178
+ logger.debug "executing #{branches.first}" unless options[:silent]
179
+ else
180
+ logger.debug "executing multiple commands in parallel"
181
+ branches.each{ |branch| logger.trace "-> #{branch.to_s(true)}" }
168
182
  end
169
183
  else
170
184
  raise ArgumentError, "attempt to execute without specifying a command"
@@ -172,8 +186,6 @@ module Capistrano
172
186
 
173
187
  return if dry_run || (debug && continue_execution(tree) == false)
174
188
 
175
- options = add_default_command_options(options)
176
-
177
189
  tree.each do |branch|
178
190
  if branch.command.include?(sudo)
179
191
  branch.callback = sudo_behavior_callback(branch.callback)
@@ -279,7 +291,7 @@ module Capistrano
279
291
  def sudo_prompt
280
292
  fetch(:sudo_prompt, "sudo password: ")
281
293
  end
282
-
294
+
283
295
  def continue_execution(tree)
284
296
  if tree.branches.length == 1
285
297
  continue_execution_for_branch(tree.branches.first)