class Rootage::StandardCommand

StandardCommand provides 4 phase command scenario. These phases are “init”, “setup”, “execution”, and “termination”.

Public Class Methods

execution(action, &b) click to toggle source

Define an action to phase “execution”.

# File lib/rootage/command.rb, line 193
def execution(action, &b)
  define_action(:execution, action, &b)
end
setup(action, &b) click to toggle source

Define an action to phase “setup”.

# File lib/rootage/command.rb, line 188
def setup(action, &b)
  define_action(:setup, action, &b)
end
termination(action, &b) click to toggle source

Define an action to phase “termination”.

# File lib/rootage/command.rb, line 198
def termination(action, &b)
  define_action(:termination, action, &b)
end

Public Instance Methods

terminate() click to toggle source

Terminate the command. Note that this enters in termination phase first, and command exit.

# File lib/rootage/command.rb, line 205
def terminate
  enter_phase(:termination)
  self.exit # end with status code
end

Private Instance Methods

abort_process() click to toggle source
# File lib/rootage/command.rb, line 212
def abort_process
  unless current_phase == :termination
    enter_phase(:termination)
  end
end