Class: Leeroy::Task::Stub

Inherits:
Base
  • Object
show all
Defined in:
lib/leeroy/task/stub.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

#state

Attributes included from Helpers::Env

#env

Attributes included from Leeroy::Task

#args, #global_options, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Helpers::State

#dump_state, #load_state, #rotate_task_metadata, #state_from_pipe, #to_s

Methods included from Helpers::Logging

#logger

Methods included from Helpers::Env

#checkEnv

Constructor Details

This class inherits a constructor from Leeroy::Task::Base

Instance Method Details

#perform(args = self.args, options = self.options, global_options = self.global_options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/leeroy/task/stub.rb', line 7

def perform(args = self.args, options = self.options, global_options = self.global_options)
  super

  begin
    message = self.state.message

    increment = self.options[:increment].to_i
    logger.debug "increment: #{increment}"

    logger.info "old message: #{message}"

    if message.nil?
      message = increment
    else
      message = message.to_i + increment
    end

    state.message = message

    logger.info "new message: #{message}"

    dump_state

  rescue StandardError => e
    raise e
  end
end