Running all namespace tasks with Capistrano
2 answers
In one project, I often had to call all tasks in a given namespace. Here is a simple monkey patch for a class Namespace
that will add a method run_all_tasks
. The method accepts an optional array except
, which must be a list of task names (as characters) to exclude.
module Capistrano
class Configuration
module Namespaces
class Namespace
def run_all_tasks(except = [])
except << :all
self.task_list(false).each do |task|
task.body.call unless except.include?(task.name)
end
end
end
end
end
end
The method will run tasks in the order in which they are defined. As with any monkey patch \ hack, use this method with care!
0
source to share