diff --git a/lib/capistrano/configuration/callbacks.rb b/lib/capistrano/configuration/callbacks.rb index 2f1eebfd2..ea0aad1dc 100644 --- a/lib/capistrano/configuration/callbacks.rb +++ b/lib/capistrano/configuration/callbacks.rb @@ -112,6 +112,9 @@ def on(event, *args, &block) callbacks[event] << ProcCallback.new(block, options) else args.each do |name| + if name =~ /^(?:deploy\:symlink|symlink)$/ + Kernel.warn("[API Change] deploy:symlink no longer exists, please use deploy:create_symlink") + end callbacks[event] << TaskCallback.new(self, name, options) end end @@ -145,4 +148,4 @@ def find_hook(task, hook) end end -end \ No newline at end of file +end diff --git a/test/configuration/callbacks_test.rb b/test/configuration/callbacks_test.rb index 7d5b1a648..5847d739c 100644 --- a/test/configuration/callbacks_test.rb +++ b/test/configuration/callbacks_test.rb @@ -111,6 +111,18 @@ def test_on_with_both_tasks_and_block_should_raise_error assert_raises(ArgumentError) { @config.on(:before, :first) { blah } } end + def test_calling_on_before_symlink_should_raise_a_warning + Kernel.expects(:warn).with("[API Change] deploy:symlink no longer exists, please use deploy:create_symlink").once + task = stub(:fully_qualified_name => "any:old:thing") + @config.on(:before, 'deploy:symlink', 'anything') + end + + def test_calling_on_after_symlink_should_raise_a_warning + Kernel.expects(:warn).with("[API Change] deploy:symlink no longer exists, please use deploy:create_symlink").once + task = stub(:fully_qualified_name => "any:old:thing") + @config.on(:after, 'deploy:symlink', 'anything') + end + def test_trigger_without_constraints_should_invoke_all_callbacks task = stub(:fully_qualified_name => "any:old:thing") @config.on(:before, :first, "second:third")