class Leeroy::Task::Base

Public Class Methods

new(params = {}) click to toggle source
# 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))

    if self.global_options.fetch(:stdin, true)
      @state = Leeroy::State.new(state_from_pipe(params.fetch(:state, {})))
      rotate_task_metadata
    else
      @state = Leeroy::State.new
    end

  rescue StandardError => e
    raise e
  end
end

Public Instance Methods

perform(args = self.args, options = self.options, global_options = self.global_options) click to toggle source
# File lib/leeroy/task/base.rb, line 41
def perform(args = self.args, options = self.options, global_options = self.global_options)
  begin
    logger.info("performing #{self.class.to_s}")
    logger.debug("args: #{args.inspect}")
    logger.debug("options: #{options.inspect}")
    logger.debug("global_options: #{global_options.inspect}")

  rescue StandardError => e
    raise e
  end
end