capistrano 2.0.0 → 2.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +7 -0
  4. data/CHANGELOG +737 -18
  5. data/Gemfile +13 -0
  6. data/README.md +94 -0
  7. data/Rakefile +11 -0
  8. data/bin/cap +0 -0
  9. data/bin/capify +37 -22
  10. data/capistrano.gemspec +40 -0
  11. data/lib/capistrano/callback.rb +5 -1
  12. data/lib/capistrano/cli/execute.rb +10 -7
  13. data/lib/capistrano/cli/help.rb +39 -16
  14. data/lib/capistrano/cli/help.txt +44 -16
  15. data/lib/capistrano/cli/options.rb +71 -11
  16. data/lib/capistrano/cli/ui.rb +13 -1
  17. data/lib/capistrano/cli.rb +5 -5
  18. data/lib/capistrano/command.rb +215 -58
  19. data/lib/capistrano/configuration/actions/file_transfer.rb +29 -14
  20. data/lib/capistrano/configuration/actions/inspect.rb +3 -3
  21. data/lib/capistrano/configuration/actions/invocation.rb +224 -22
  22. data/lib/capistrano/configuration/alias_task.rb +26 -0
  23. data/lib/capistrano/configuration/callbacks.rb +26 -27
  24. data/lib/capistrano/configuration/connections.rb +130 -52
  25. data/lib/capistrano/configuration/execution.rb +34 -18
  26. data/lib/capistrano/configuration/loading.rb +99 -6
  27. data/lib/capistrano/configuration/log_formatters.rb +75 -0
  28. data/lib/capistrano/configuration/namespaces.rb +45 -12
  29. data/lib/capistrano/configuration/roles.rb +28 -2
  30. data/lib/capistrano/configuration/servers.rb +51 -10
  31. data/lib/capistrano/configuration/variables.rb +3 -3
  32. data/lib/capistrano/configuration.rb +20 -4
  33. data/lib/capistrano/errors.rb +12 -8
  34. data/lib/capistrano/ext/multistage.rb +67 -0
  35. data/lib/capistrano/ext/string.rb +5 -0
  36. data/lib/capistrano/extensions.rb +1 -1
  37. data/lib/capistrano/fix_rake_deprecated_dsl.rb +8 -0
  38. data/lib/capistrano/logger.rb +112 -5
  39. data/lib/capistrano/processable.rb +55 -0
  40. data/lib/capistrano/recipes/compat.rb +2 -2
  41. data/lib/capistrano/recipes/deploy/assets.rb +201 -0
  42. data/lib/capistrano/recipes/deploy/dependencies.rb +2 -2
  43. data/lib/capistrano/recipes/deploy/local_dependency.rb +10 -2
  44. data/lib/capistrano/recipes/deploy/remote_dependency.rb +54 -2
  45. data/lib/capistrano/recipes/deploy/scm/accurev.rb +169 -0
  46. data/lib/capistrano/recipes/deploy/scm/base.rb +31 -11
  47. data/lib/capistrano/recipes/deploy/scm/bzr.rb +14 -14
  48. data/lib/capistrano/recipes/deploy/scm/cvs.rb +11 -9
  49. data/lib/capistrano/recipes/deploy/scm/darcs.rb +12 -1
  50. data/lib/capistrano/recipes/deploy/scm/git.rb +293 -0
  51. data/lib/capistrano/recipes/deploy/scm/mercurial.rb +23 -15
  52. data/lib/capistrano/recipes/deploy/scm/none.rb +55 -0
  53. data/lib/capistrano/recipes/deploy/scm/perforce.rb +54 -28
  54. data/lib/capistrano/recipes/deploy/scm/subversion.rb +36 -18
  55. data/lib/capistrano/recipes/deploy/scm.rb +1 -1
  56. data/lib/capistrano/recipes/deploy/strategy/base.rb +32 -4
  57. data/lib/capistrano/recipes/deploy/strategy/copy.rb +238 -43
  58. data/lib/capistrano/recipes/deploy/strategy/remote.rb +1 -1
  59. data/lib/capistrano/recipes/deploy/strategy/remote_cache.rb +11 -1
  60. data/lib/capistrano/recipes/deploy/strategy/unshared_remote_cache.rb +21 -0
  61. data/lib/capistrano/recipes/deploy/strategy.rb +1 -1
  62. data/lib/capistrano/recipes/deploy.rb +265 -123
  63. data/lib/capistrano/recipes/standard.rb +1 -1
  64. data/lib/capistrano/role.rb +102 -0
  65. data/lib/capistrano/server_definition.rb +6 -1
  66. data/lib/capistrano/shell.rb +30 -33
  67. data/lib/capistrano/ssh.rb +46 -60
  68. data/lib/capistrano/task_definition.rb +16 -8
  69. data/lib/capistrano/transfer.rb +218 -0
  70. data/lib/capistrano/version.rb +6 -17
  71. data/lib/capistrano.rb +4 -1
  72. data/test/cli/execute_test.rb +3 -3
  73. data/test/cli/help_test.rb +33 -7
  74. data/test/cli/options_test.rb +109 -6
  75. data/test/cli/ui_test.rb +2 -2
  76. data/test/cli_test.rb +3 -3
  77. data/test/command_test.rb +144 -124
  78. data/test/configuration/actions/file_transfer_test.rb +41 -20
  79. data/test/configuration/actions/inspect_test.rb +21 -7
  80. data/test/configuration/actions/invocation_test.rb +123 -30
  81. data/test/configuration/alias_task_test.rb +118 -0
  82. data/test/configuration/callbacks_test.rb +41 -46
  83. data/test/configuration/connections_test.rb +187 -36
  84. data/test/configuration/execution_test.rb +18 -2
  85. data/test/configuration/loading_test.rb +33 -4
  86. data/test/configuration/namespace_dsl_test.rb +54 -5
  87. data/test/configuration/roles_test.rb +114 -4
  88. data/test/configuration/servers_test.rb +97 -4
  89. data/test/configuration/variables_test.rb +12 -2
  90. data/test/configuration_test.rb +9 -13
  91. data/test/deploy/local_dependency_test.rb +76 -0
  92. data/test/deploy/remote_dependency_test.rb +146 -0
  93. data/test/deploy/scm/accurev_test.rb +23 -0
  94. data/test/deploy/scm/base_test.rb +1 -1
  95. data/test/deploy/scm/bzr_test.rb +51 -0
  96. data/test/deploy/scm/darcs_test.rb +37 -0
  97. data/test/deploy/scm/git_test.rb +274 -0
  98. data/test/deploy/scm/mercurial_test.rb +134 -0
  99. data/test/deploy/scm/none_test.rb +35 -0
  100. data/test/deploy/scm/perforce_test.rb +23 -0
  101. data/test/deploy/scm/subversion_test.rb +68 -0
  102. data/test/deploy/strategy/copy_test.rb +240 -26
  103. data/test/extensions_test.rb +2 -2
  104. data/test/logger_formatting_test.rb +149 -0
  105. data/test/logger_test.rb +13 -2
  106. data/test/recipes_test.rb +25 -0
  107. data/test/role_test.rb +11 -0
  108. data/test/server_definition_test.rb +15 -2
  109. data/test/shell_test.rb +33 -1
  110. data/test/ssh_test.rb +40 -24
  111. data/test/task_definition_test.rb +18 -2
  112. data/test/transfer_test.rb +168 -0
  113. data/test/utils.rb +28 -33
  114. metadata +215 -101
  115. data/MIT-LICENSE +0 -20
  116. data/README +0 -43
  117. data/examples/sample.rb +0 -14
  118. data/lib/capistrano/gateway.rb +0 -131
  119. data/lib/capistrano/recipes/deploy/templates/maintenance.rhtml +0 -53
  120. data/lib/capistrano/recipes/upgrade.rb +0 -33
  121. data/lib/capistrano/upload.rb +0 -146
  122. data/test/gateway_test.rb +0 -167
  123. data/test/upload_test.rb +0 -131
  124. data/test/version_test.rb +0 -24
@@ -23,6 +23,60 @@ module Capistrano
23
23
  def initialize_with_invocation(*args) #:nodoc:
24
24
  initialize_without_invocation(*args)
25
25
  set :default_environment, {}
26
+ set :default_run_options, {}
27
+ end
28
+
29
+ # Executes different commands in parallel. This is useful for commands
30
+ # that need to be different on different hosts, but which could be
31
+ # otherwise run in parallel.
32
+ #
33
+ # The +options+ parameter is currently unused.
34
+ #
35
+ # Example:
36
+ #
37
+ # task :restart_everything do
38
+ # parallel do |session|
39
+ # session.when "in?(:app)", "/path/to/restart/mongrel"
40
+ # session.when "in?(:web)", "/path/to/restart/apache"
41
+ # session.when "in?(:db)", "/path/to/restart/mysql"
42
+ # end
43
+ # end
44
+ #
45
+ # Each command may have its own callback block, for capturing and
46
+ # responding to output, with semantics identical to #run:
47
+ #
48
+ # session.when "in?(:app)", "/path/to/restart/mongrel" do |ch, stream, data|
49
+ # # ch is the SSH channel for this command, used to send data
50
+ # # back to the command (e.g. ch.send_data("password\n"))
51
+ # # stream is either :out or :err, for which stream the data arrived on
52
+ # # data is a string containing data sent from the remote command
53
+ # end
54
+ #
55
+ # Also, you can specify a fallback command, to use when none of the
56
+ # conditions match a server:
57
+ #
58
+ # session.else "/execute/something/else"
59
+ #
60
+ # The string specified as the first argument to +when+ may be any valid
61
+ # Ruby code. It has access to the following variables and methods:
62
+ #
63
+ # * +in?(role)+ returns true if the server participates in the given role
64
+ # * +server+ is the ServerDefinition object for the server. This can be
65
+ # used to get the host-name, etc.
66
+ # * +configuration+ is the current Capistrano::Configuration object, which
67
+ # you can use to get the value of variables, etc.
68
+ #
69
+ # For example:
70
+ #
71
+ # session.when "server.host =~ /app/", "/some/command"
72
+ # session.when "server.host == configuration[:some_var]", "/another/command"
73
+ # session.when "in?(:web) || in?(:app)", "/more/commands"
74
+ #
75
+ # See #run for a description of the valid +options+.
76
+ def parallel(options={})
77
+ raise ArgumentError, "parallel() requires a block" unless block_given?
78
+ tree = Command::Tree.new(self) { |t| yield t }
79
+ run_tree(tree, options)
26
80
  end
27
81
 
28
82
  # Invokes the given command. If a +via+ key is given, it will be used
@@ -41,37 +95,146 @@ module Capistrano
41
95
  # channel (which may be used to send data back to the remote process),
42
96
  # the stream identifier (<tt>:err</tt> for stderr, and <tt>:out</tt> for
43
97
  # stdout), and the data that was received.
98
+ #
99
+ # The +options+ hash may include any of the following keys:
100
+ #
101
+ # * :hosts - this is either a string (for a single target host) or an array
102
+ # of strings, indicating which hosts the command should run on. By default,
103
+ # the hosts are determined from the task definition.
104
+ # * :roles - this is either a string or symbol (for a single target role) or
105
+ # an array of strings or symbols, indicating which roles the command should
106
+ # run on. If :hosts is specified, :roles will be ignored.
107
+ # * :only - specifies a condition limiting which hosts will be selected to
108
+ # run the command. This should refer to values set in the role definition.
109
+ # For example, if a role is defined with :primary => true, then you could
110
+ # select only hosts with :primary true by setting :only => { :primary => true }.
111
+ # * :except - specifies a condition limiting which hosts will be selected to
112
+ # run the command. This is the inverse of :only (hosts that do _not_ match
113
+ # the condition will be selected).
114
+ # * :on_no_matching_servers - if :continue, will continue to execute tasks if
115
+ # no matching servers are found for the host criteria. The default is to raise
116
+ # a NoMatchingServersError exception.
117
+ # * :once - if true, only the first matching server will be selected. The default
118
+ # is false (all matching servers will be selected).
119
+ # * :max_hosts - specifies the maximum number of hosts that should be selected
120
+ # at a time. If this value is less than the number of hosts that are selected
121
+ # to run, then the hosts will be run in groups of max_hosts. The default is nil,
122
+ # which indicates that there is no maximum host limit. Please note this does not
123
+ # limit the number of SSH channels that can be open, only the number of hosts upon
124
+ # which this will be called.
125
+ # * :shell - says which shell should be used to invoke commands. This
126
+ # defaults to "sh". Setting this to false causes Capistrano to invoke
127
+ # the commands directly, without wrapping them in a shell invocation.
128
+ # * :data - if not nil (the default), this should be a string that will
129
+ # be passed to the command's stdin stream.
130
+ # * :pty - if true, a pseudo-tty will be allocated for each command. The
131
+ # default is false. Note that there are benefits and drawbacks both ways.
132
+ # Empirically, it appears that if a pty is allocated, the SSH server daemon
133
+ # will _not_ read user shell start-up scripts (e.g. bashrc, etc.). However,
134
+ # if a pty is _not_ allocated, some commands will refuse to run in
135
+ # interactive mode and will not prompt for (e.g.) passwords.
136
+ # * :env - a hash of environment variable mappings that should be made
137
+ # available to the command. The keys should be environment variable names,
138
+ # and the values should be their corresponding values. The default is
139
+ # empty, but may be modified by changing the +default_environment+
140
+ # Capistrano variable.
141
+ # * :eof - if true, the standard input stream will be closed after sending
142
+ # any data specified in the :data option. If false, the input stream is
143
+ # left open. The default is to close the input stream only if no block is
144
+ # passed.
145
+ #
146
+ # Note that if you set these keys in the +default_run_options+ Capistrano
147
+ # variable, they will apply for all invocations of #run, #invoke_command,
148
+ # and #parallel.
44
149
  def run(cmd, options={}, &block)
150
+ if options[:eof].nil? && !cmd.include?(sudo)
151
+ options = options.merge(:eof => !block_given?)
152
+ end
45
153
  block ||= self.class.default_io_proc
46
- logger.debug "executing #{cmd.strip.inspect}"
154
+ tree = Command::Tree.new(self) { |t| t.else(cmd, &block) }
155
+ run_tree(tree, options)
156
+ end
47
157
 
158
+ # Executes a Capistrano::Command::Tree object. This is not for direct
159
+ # use, but should instead be called indirectly, via #run or #parallel,
160
+ # or #invoke_command.
161
+ def run_tree(tree, options={}) #:nodoc:
48
162
  options = add_default_command_options(options)
49
163
 
164
+ if tree.branches.any? || tree.fallback
165
+ _, servers = filter_servers(options)
166
+ branches = branches_for_servers(tree,servers)
167
+ case branches.size
168
+ when 0
169
+ branches = tree.branches.dup + [tree.fallback]
170
+ branches.compact!
171
+ case branches.size
172
+ when 1
173
+ logger.debug "no servers for #{branches.first}"
174
+ else
175
+ logger.debug "no servers for commands"
176
+ branches.each{ |branch| logger.trace "-> #{branch.to_s(true)}" }
177
+ end
178
+ when 1
179
+ logger.debug "executing #{branches.first}" unless options[:silent]
180
+ else
181
+ logger.debug "executing multiple commands in parallel"
182
+ branches.each {|branch| logger.trace "-> #{branch.to_s(true)}" }
183
+ end
184
+ else
185
+ raise ArgumentError, "attempt to execute without specifying a command"
186
+ end
187
+
188
+ return if dry_run || (debug && continue_execution(tree) == false)
189
+
190
+ tree.each do |branch|
191
+ if branch.command.include?(sudo)
192
+ branch.callback = sudo_behavior_callback(branch.callback)
193
+ end
194
+ end
195
+
50
196
  execute_on_servers(options) do |servers|
51
197
  targets = servers.map { |s| sessions[s] }
52
- Command.process(cmd, targets, options.merge(:logger => logger), &block)
198
+ Command.process(tree, targets, options.merge(:logger => logger))
53
199
  end
54
200
  end
55
201
 
56
- # Like #run, but executes the command via <tt>sudo</tt>. This assumes
57
- # that the sudo password (if required) is the same as the password for
58
- # logging in to the server.
202
+ # Returns the command string used by capistrano to invoke a comamnd via
203
+ # sudo.
59
204
  #
60
- # Also, this module accepts a <tt>:sudo</tt> configuration variable,
205
+ # run "#{sudo :as => 'bob'} mkdir /path/to/dir"
206
+ #
207
+ # It can also be invoked like #run, but executing the command via sudo.
208
+ # This assumes that the sudo password (if required) is the same as the
209
+ # password for logging in to the server.
210
+ #
211
+ # sudo "mkdir /path/to/dir"
212
+ #
213
+ # Also, this method understands a <tt>:sudo</tt> configuration variable,
61
214
  # which (if specified) will be used as the full path to the sudo
62
215
  # executable on the remote machine:
63
216
  #
64
217
  # set :sudo, "/opt/local/bin/sudo"
65
- def sudo(command, options={}, &block)
66
- block ||= self.class.default_io_proc
67
-
68
- options = options.dup
69
- as = options.delete(:as)
218
+ #
219
+ # If you know what you're doing, you can also set <tt>:sudo_prompt</tt>,
220
+ # which tells capistrano which prompt sudo should use when asking for
221
+ # a password. (This is so that capistrano knows what prompt to look for
222
+ # in the output.) If you set :sudo_prompt to an empty string, Capistrano
223
+ # will not send a preferred prompt.
224
+ def sudo(*parameters, &block)
225
+ options = parameters.last.is_a?(Hash) ? parameters.pop.dup : {}
226
+ command = parameters.first
227
+ user = options[:as] && "-u #{options.delete(:as)}"
70
228
 
71
- user = as && "-u #{as}"
72
- command = [fetch(:sudo, "sudo"), user, command].compact.join(" ")
229
+ sudo_prompt_option = "-p '#{sudo_prompt}'" unless sudo_prompt.empty?
230
+ sudo_command = [fetch(:sudo, "sudo"), sudo_prompt_option, user].compact.join(" ")
73
231
 
74
- run(command, options, &sudo_behavior_callback(block))
232
+ if command
233
+ command = sudo_command + " " + command
234
+ run(command, options, &block)
235
+ else
236
+ return sudo_command
237
+ end
75
238
  end
76
239
 
77
240
  # Returns a Proc object that defines the behavior of the sudo
@@ -83,17 +246,19 @@ module Capistrano
83
246
  # was wrong, let's track which host prompted first and only allow
84
247
  # subsequent prompts from that host.
85
248
  prompt_host = nil
86
-
249
+
87
250
  Proc.new do |ch, stream, out|
88
- if out =~ /password:/i
89
- ch.send_data "#{self[:password]}\n"
90
- elsif out =~ /try again/
251
+ if out =~ /^Sorry, try again/
91
252
  if prompt_host.nil? || prompt_host == ch[:server]
92
253
  prompt_host = ch[:server]
93
254
  logger.important out, "#{stream} :: #{ch[:server]}"
94
255
  reset! :password
95
256
  end
96
- else
257
+ end
258
+
259
+ if out =~ /^#{Regexp.escape(sudo_prompt)}/
260
+ ch.send_data "#{self[:password]}\n"
261
+ elsif fallback
97
262
  fallback.call(ch, stream, out)
98
263
  end
99
264
  end
@@ -110,18 +275,55 @@ module Capistrano
110
275
  # Otherwise, if the :default_shell key exists in the configuration,
111
276
  # it will be used. Otherwise, no :shell key is added.
112
277
  def add_default_command_options(options)
113
- options = options.dup
278
+ defaults = self[:default_run_options]
279
+ options = defaults.merge(options)
114
280
 
115
281
  env = self[:default_environment]
116
282
  env = env.merge(options[:env]) if options[:env]
117
283
  options[:env] = env unless env.empty?
118
284
 
119
285
  shell = options[:shell] || self[:default_shell]
120
- options[:shell] = shell if shell
286
+ options[:shell] = shell unless shell.nil?
121
287
 
122
288
  options
123
289
  end
290
+
291
+ # Returns the prompt text to use with sudo
292
+ def sudo_prompt
293
+ fetch(:sudo_prompt, "sudo password: ")
294
+ end
295
+
296
+ def continue_execution(tree)
297
+ if tree.branches.length == 1
298
+ continue_execution_for_branch(tree.branches.first)
299
+ else
300
+ tree.each { |branch| branch.skip! unless continue_execution_for_branch(branch) }
301
+ tree.any? { |branch| !branch.skip? }
302
+ end
303
+ end
304
+
305
+ def continue_execution_for_branch(branch)
306
+ case Capistrano::CLI.debug_prompt(branch)
307
+ when "y"
308
+ true
309
+ when "n"
310
+ false
311
+ when "a"
312
+ exit(-1)
313
+ end
314
+ end
315
+
316
+ private
317
+ def branches_for_servers(tree,servers)
318
+ servers.inject([]) do |branches,server|
319
+ if server_branches = tree.branches_for(server)
320
+ branches += server_branches
321
+ end
322
+ branches
323
+ end
324
+ end
325
+
124
326
  end
125
327
  end
126
328
  end
127
- end
329
+ end
@@ -0,0 +1,26 @@
1
+ module Capistrano
2
+ class Configuration
3
+ module AliasTask
4
+ # Attempts to find the task at the given fully-qualified path, and
5
+ # alias it. If arguments don't have correct task names, an ArgumentError
6
+ # wil be raised. If no such task exists, a Capistrano::NoSuchTaskError
7
+ # will be raised.
8
+ #
9
+ # Usage:
10
+ #
11
+ # alias_task :original_deploy, :deploy
12
+ #
13
+ def alias_task(new_name, old_name)
14
+ if !new_name.respond_to?(:to_sym) or !old_name.respond_to?(:to_sym)
15
+ raise ArgumentError, "expected a valid task name"
16
+ end
17
+
18
+ original_task = find_task(old_name) or raise NoSuchTaskError, "the task `#{old_name}' does not exist"
19
+ task = original_task.dup # Dup. task to avoid modify original task
20
+ task.name = new_name
21
+
22
+ define_task(task)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -4,7 +4,7 @@ module Capistrano
4
4
  class Configuration
5
5
  module Callbacks
6
6
  def self.included(base) #:nodoc:
7
- %w(initialize execute_task).each do |method|
7
+ %w(initialize invoke_task_directly).each do |method|
8
8
  base.send :alias_method, "#{method}_without_callbacks", method
9
9
  base.send :alias_method, method, "#{method}_with_callbacks"
10
10
  end
@@ -18,19 +18,14 @@ module Capistrano
18
18
  @callbacks = {}
19
19
  end
20
20
 
21
- def execute_task_with_callbacks(task) #:nodoc:
22
- before = find_hook(task, :before)
23
- execute_task(before) if before
21
+ def invoke_task_directly_with_callbacks(task) #:nodoc:
24
22
 
25
23
  trigger :before, task
26
24
 
27
- result = execute_task_without_callbacks(task)
25
+ result = invoke_task_directly_without_callbacks(task)
28
26
 
29
27
  trigger :after, task
30
28
 
31
- after = find_hook(task, :after)
32
- execute_task(after) if after
33
-
34
29
  return result
35
30
  end
36
31
 
@@ -95,7 +90,7 @@ module Capistrano
95
90
  # Usage:
96
91
  #
97
92
  # on :before, "some:hook", "another:hook", :only => "deploy:update"
98
- # on :after, "some:hook", :except => "deploy:symlink"
93
+ # on :after, "some:hook", :except => "deploy:create_symlink"
99
94
  # on :before, "global:hook"
100
95
  # on :after, :only => :deploy do
101
96
  # puts "after deploy here"
@@ -111,10 +106,28 @@ module Capistrano
111
106
  elsif block
112
107
  callbacks[event] << ProcCallback.new(block, options)
113
108
  else
114
- args.each do |name|
115
- callbacks[event] << TaskCallback.new(self, name, options)
116
- end
109
+ args = filter_deprecated_tasks(args)
110
+ options[:only] = filter_deprecated_tasks(options[:only])
111
+ options[:except] = filter_deprecated_tasks(options[:except])
112
+
113
+ callbacks[event].concat(args.map { |name| TaskCallback.new(self, name, options) })
114
+ end
115
+ end
116
+
117
+ # Filters the given task name or names and attempts to replace deprecated tasks with their equivalents.
118
+ def filter_deprecated_tasks(names)
119
+ deprecation_msg = "[Deprecation Warning] This API has changed, please hook `deploy:create_symlink` instead of" \
120
+ " `deploy:symlink`."
121
+
122
+ if names == "deploy:symlink"
123
+ warn deprecation_msg
124
+ names = "deploy:create_symlink"
125
+ elsif names.is_a?(Array) && names.include?("deploy:symlink")
126
+ warn deprecation_msg
127
+ names = names.map { |name| name == "deploy:symlink" ? "deploy:create_symlink" : name }
117
128
  end
129
+
130
+ names
118
131
  end
119
132
 
120
133
  # Trigger the named event for the named task. All associated callbacks
@@ -129,20 +142,6 @@ module Capistrano
129
142
  end
130
143
  end
131
144
 
132
- private
133
-
134
- # Looks for before_foo or after_foo tasks. This method of extending tasks
135
- # is now discouraged (though not formally deprecated). You should use the
136
- # before and after methods to declare hooks for such callbacks.
137
- def find_hook(task, hook)
138
- if task == task.namespace.default_task
139
- result = task.namespace.search_task("#{hook}_#{task.namespace.name}")
140
- return result if result
141
- end
142
-
143
- task.namespace.search_task("#{hook}_#{task.name}")
144
- end
145
-
146
145
  end
147
146
  end
148
- end
147
+ end