class AvoDeploy::Task::TaskExecutionEnvironment
Attributes
options[RW]
scm[RW]
Public Class Methods
new(config)
click to toggle source
Initialized the environment
@param config [Hash] deployment configuration
# File lib/avodeploy/task/task_execution_environment.rb, line 29 def initialize(config) # @todo check @config = config end
Public Instance Methods
check_util_availability(utils, system_name)
click to toggle source
Checks, if all utilities are available for the deployment process to be executed
@param utils [Array] array with utilities to check
# File lib/avodeploy/task/task_execution_environment.rb, line 53 def check_util_availability(utils, system_name) begin utils.each do |util| if command("command -v #{util} >/dev/null 2>&1 || exit 1;").retval == 1 msg = "command line utility '#{util}' is not installed #{system_name}" raise RuntimeError, msg end end rescue Exception => e handle_abort e end end
get(key)
click to toggle source
Returns a configuration item if set
@param key [Symbol] configuration key @return [mixed] configuration value
# File lib/avodeploy/task/task_execution_environment.rb, line 86 def get(key) @config[key] end
handle_abort(e)
click to toggle source
Shorthand for exception handling
@param e [Exception] the exception to handle
# File lib/avodeploy/task/task_execution_environment.rb, line 93 def handle_abort(e) AvoDeploy::Deployment.instance.handle_abort(e) end
log()
click to toggle source
Returns the logger instance
@return [Logger] log instance
# File lib/avodeploy/task/task_execution_environment.rb, line 70 def log AvoDeploy::Deployment.instance.log end
run(task_name)
click to toggle source
Runs a task chain
@param task_name [Symbol] task name to invoke
# File lib/avodeploy/task/task_execution_environment.rb, line 45 def run(task_name) AvoDeploy::Deployment.instance.task_manager.invoke_task_chain_containing(task_name) end
run_nodeps(task_name)
click to toggle source
Runs a task without dependencies
@param task_name [Symbol] task name to execute @return [Object] the task result
# File lib/avodeploy/task/task_execution_environment.rb, line 38 def run_nodeps(task_name) AvoDeploy::Deployment.instance.task_manager.invoke_task_oneshot(task_name) end
set(key, value)
click to toggle source
Sets a configuration item
@param key [Symbol] configuration key @param value [mixed] configuration value
# File lib/avodeploy/task/task_execution_environment.rb, line 78 def set(key, value) @config[key] = value end