1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Merge pull request #1682 from jdelStrother/missing-after-hook

Raise a better error when an ‘after’ hook isn’t found
This commit is contained in:
Matt Brictson 2016-05-17 07:52:45 -07:00
commit 31b6c0ff8b
3 changed files with 9 additions and 1 deletions

View file

@ -6,6 +6,7 @@ Reverse Chronological Order:
https://github.com/capistrano/capistrano/compare/v3.5.0...HEAD
* Raise a better error when an after hook isnt found (@jdelStrother)
* Restrict the uploaded git wrapper script permissions to 700 (@irvingwashington)
* Make path to git wrapper script configurable (@thickpaddy)
* Change git wrapper path to work better with multiple users (@thickpaddy)

View file

@ -11,7 +11,9 @@ module Capistrano
Rake::Task.define_task(post_task, *args, &block) if block_given?
task = Rake::Task[task]
task.enhance do
Rake.application.lookup(post_task, task.scope).invoke
post = Rake.application.lookup(post_task, task.scope)
raise ArgumentError, "Task #{post_task.inspect} not found" unless post
post.invoke
end
end

View file

@ -98,6 +98,11 @@ module Capistrano
["namespace:before_task", "namespace:task", "namespace:after_task"]
)
end
it "raises a sensible error if the task isn't found" do
task_enhancements.after("task", "non_existent_task")
expect { Rake::Task["task"].invoke order }.to raise_error(ArgumentError, 'Task "non_existent_task" not found')
end
end
describe "remote_file" do