Class: Leeroy::Task::Base
- Inherits:
-
Object
- Object
- Leeroy::Task::Base
- Includes:
- Helpers, Helpers::Env, Helpers::Logging, Helpers::State, Leeroy::Task
- Defined in:
- lib/leeroy/task/base.rb
Constant Summary
Constants included from Helpers::Logging
Helpers::Logging::TRACE_FORMAT, Helpers::Logging::TRACE_LEVELS, Helpers::Logging::TRUNCATE_THRESHOLD
Instance Attribute Summary
Attributes included from Helpers::State
Attributes included from Helpers::Env
Attributes included from Leeroy::Task
#args, #global_options, #options
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
- #perform(args = self.args, options = self.options, global_options = self.global_options) ⇒ Object
Methods included from Helpers::State
#dump_state, #load_state, #rotate_task_metadata, #state_from_pipe, #to_s
Methods included from Helpers::Logging
Methods included from Helpers::Env
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/leeroy/task/base.rb', line 21 def initialize(params = {}) begin @global_options = params.fetch(:global_options, {}) @options = params.fetch(:options, {}) @args = params.fetch(:args, {}) @env = Leeroy::Env.new({}, params.fetch(:env, ENV)) @state = Leeroy::State.new(state_from_pipe(params.fetch(:state, {}))) rescue StandardError => e raise e end end |
Instance Method Details
#perform(args = self.args, options = self.options, global_options = self.global_options) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/leeroy/task/base.rb', line 37 def perform(args = self.args, = self., = self.) begin logger.info("performing #{self.class.to_s}") logger.debug("args: #{args.inspect}") logger.debug("options: #{.inspect}") logger.debug("global_options: #{.inspect}") rescue StandardError => e raise e end end |