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 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.
-
#scm_provider=(scm_provider) ⇒ Object
Assigns the scm provider.
-
#set(key, value) ⇒ Object
Sets a configuration item.
Constructor Details
#initialize(config) ⇒ TaskExecutionEnvironment
Initialized the environment
26 27 28 29 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 26 def initialize(config) # @todo check @config = config end |
Instance Method Details
#check_util_availability(utils, system_name) ⇒ Object
Checks, if all utilities are available for the deployment process to be executed
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 42 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
75 76 77 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 75 def get(key) @config[key] end |
#handle_abort(e) ⇒ Object
Shorthand for exception handling
82 83 84 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 82 def handle_abort(e) AvoDeploy::Deployment.instance.handle_abort(e) end |
#log ⇒ Logger
Returns the logger instance
59 60 61 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 59 def log AvoDeploy::Deployment.instance.log end |
#scm_provider=(scm_provider) ⇒ Object
Assigns the scm provider
34 35 36 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 34 def scm_provider=(scm_provider) @scm = scm_provider end |
#set(key, value) ⇒ Object
Sets a configuration item
67 68 69 |
# File 'lib/avodeploy/task/task_execution_environment.rb', line 67 def set(key, value) @config[key] = value end |