Skip to content

Commit

Permalink
Add a large warning for people still using deploy:symlink.
Browse files Browse the repository at this point in the history
  • Loading branch information
leehambley committed Feb 20, 2012
1 parent 2fe633d commit 7fee3ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/capistrano/configuration/callbacks.rb
Expand Up @@ -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
Expand Down Expand Up @@ -145,4 +148,4 @@ def find_hook(task, hook)

end
end
end
end
12 changes: 12 additions & 0 deletions test/configuration/callbacks_test.rb
Expand Up @@ -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")
Expand Down

0 comments on commit 7fee3ab

Please sign in to comment.