Module: Capistrano::Configuration::Execution
- Defined in:
- lib/capistrano/datadog/v2.rb
Instance Method Summary collapse
-
#find_and_execute_task(path, hooks = {}) ⇒ Object
Attempts to locate the task at the given fully-qualified path, and execute it.
Instance Method Details
#find_and_execute_task(path, hooks = {}) ⇒ Object
Attempts to locate the task at the given fully-qualified path, and execute it. If no such task exists, a Capistrano::NoSuchTaskError will be raised. Also, capture the time the task took to execute, and the logs it outputted for submission to Datadog
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/capistrano/datadog/v2.rb', line 19 def find_and_execute_task(path, hooks= {}) task = find_task(path) or raise NoSuchTaskError, "the task `#{path}' does not exist" reporter = Capistrano::Datadog.reporter task_name = task.fully_qualified_name roles = task.[:roles] if roles.is_a? Proc roles = roles.call end reporter.record_task(task_name, roles, task.namespace.variables[:stage], fetch(:application)) do trigger(hooks[:before], task) if hooks[:before] result = execute_task(task) trigger(hooks[:after], task) if hooks[:after] result end end |