mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Remove before_
and after_
tasks.
This commit is contained in:
parent
bd6ff00fa3
commit
510b1660f2
3 changed files with 9 additions and 24 deletions
|
@ -1,22 +1,18 @@
|
|||
require 'capistrano/server_definition'
|
||||
|
||||
module Capistrano
|
||||
# Represents the definition of a single task.
|
||||
|
||||
class TaskDefinition
|
||||
|
||||
attr_reader :name, :namespace, :options, :body, :desc, :on_error, :max_hosts
|
||||
|
||||
def initialize(name, namespace, options={}, &block)
|
||||
|
||||
if name.to_s =~ /^(?:before_|after_)/
|
||||
Kernel.warn("[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was #{name})")
|
||||
end
|
||||
|
||||
@name, @namespace, @options = name, namespace, options
|
||||
@desc = @options.delete(:desc)
|
||||
@on_error = options.delete(:on_error)
|
||||
@desc = @options.delete(:desc)
|
||||
@on_error = options.delete(:on_error)
|
||||
@max_hosts = options[:max_hosts] && options[:max_hosts].to_i
|
||||
@body = block or raise ArgumentError, "a task requires a block"
|
||||
@servers = nil
|
||||
@body = block or raise ArgumentError, "a task requires a block"
|
||||
@servers = nil
|
||||
end
|
||||
|
||||
# Returns the task's fully-qualified name, including the namespace
|
||||
|
@ -76,5 +72,6 @@ module Capistrano
|
|||
def continue_on_error?
|
||||
@on_error == :continue
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,18 +38,6 @@ class TaskDefinitionTest < Test::Unit::TestCase
|
|||
assert_raises(ArgumentError) { task.name = ['invalid task name'] }
|
||||
end
|
||||
|
||||
def test_deprecation_warning_on_method_name_beginning_with_before_underscore
|
||||
name = "before_test"
|
||||
Kernel.expects(:warn).with("[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was #{name})")
|
||||
new_task(name)
|
||||
end
|
||||
|
||||
def test_deprecation_warning_on_method_name_beginning_with_after_underscore
|
||||
name = "after_test"
|
||||
Kernel.expects(:warn).with("[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was #{name})")
|
||||
new_task(name)
|
||||
end
|
||||
|
||||
def test_fqn_in_namespace_when_default_should_be_namespace_fqn
|
||||
ns = namespace("outer:inner")
|
||||
task = new_task(:default, ns)
|
||||
|
|
Loading…
Reference in a new issue