Class: AvoDeploy::Task::TaskExecutionEnvironment
- Inherits:
-
Object
- Object
- AvoDeploy::Task::TaskExecutionEnvironment
- Defined in:
- lib/avodeploy/task/task_execution_environment.rb
Direct Known Subclasses
LocalTaskExecutionEnvironment, RemoteTaskExecutionEnvironment
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#scm ⇒ Object
Returns the value of attribute scm.
Instance Method Summary collapse
-
#check_util_availability(utils, system_name) ⇒ Object
Checks, if all utilities are available for the deployment process to be executed.
-
#get(key) ⇒ mixed
Returns a configuration item if set.
-
#handle_abort(e) ⇒ Object
Shorthand for exception handling.
-
#initialize(config) ⇒ TaskExecutionEnvironment
constructor
Initialized the environment.
-
#log ⇒ Logger
Returns the logger instance.
-
#run(task_name) ⇒ Object
Runs a task chain.
-
#run_nodeps(task_name) ⇒ Object
Runs a task without dependencies.
-
#set(key, value) ⇒ Object
Sets a configuration item.
Constructor Details
#initialize(config) ⇒ TaskExecutionEnvironment
Initialized the environment
29 30 31 32 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 29 def initialize(config) # @todo check @config = config end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
24 25 26 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 24 def end |
#scm ⇒ Object
Returns the value of attribute scm.
23 24 25 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 23 def scm @scm end |
Instance Method Details
#check_util_availability(utils, system_name) ⇒ Object
Checks, if all utilities are available for the deployment process to be executed
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# 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) ⇒ mixed
Returns a configuration item if set
86 87 88 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 86 def get(key) @config[key] end |
#handle_abort(e) ⇒ Object
Shorthand for exception handling
93 94 95 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 93 def handle_abort(e) AvoDeploy::Deployment.instance.handle_abort(e) end |
#log ⇒ Logger
Returns the logger instance
70 71 72 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 70 def log AvoDeploy::Deployment.instance.log end |
#run(task_name) ⇒ Object
Runs a task chain
45 46 47 |
# 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) ⇒ Object
Runs a task without dependencies
38 39 40 |
# 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) ⇒ Object
Sets a configuration item
78 79 80 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 78 def set(key, value) @config[key] = value end |