module Capistrano::Configuration::Execution
Public Instance Methods
find_and_execute_task(path, hooks= {})
click to toggle source
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
# File lib/capistrano/datadog/v2.rb 19 def find_and_execute_task(path, hooks= {}) 20 task = find_task(path) or raise NoSuchTaskError, "the task `#{path}' does not exist" 21 reporter = Capistrano::Datadog.reporter 22 task_name = task.fully_qualified_name 23 24 roles = task.options[:roles] 25 if roles.is_a? Proc 26 roles = roles.call 27 end 28 29 reporter.record_task(task_name, roles, task.namespace.variables[:stage], fetch(:application)) do 30 trigger(hooks[:before], task) if hooks[:before] 31 result = execute_task(task) 32 trigger(hooks[:after], task) if hooks[:after] 33 result 34 end 35 end