Class: Rootage::StandardCommand

Inherits:
Command show all
Defined in:
lib/rootage/command.rb

Overview

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

Direct Known Subclasses

Pione::Command::BasicCommand

Instance Attribute Summary

Attributes inherited from Command

#argument_definition, #argv, #option_definition

Attributes inherited from Scenario

#args, #current_phase, #exit_status, #info, #model, #running_thread

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#<<, define_subcommand, #exit, has_subcommands?, inherited, init, #initialize, #program_name, #run, #scenario_name, toplevel?

Methods inherited from Scenario

#<<, #abort, define_action, #exit, inherited, #initialize, make, require, #run, run, scenario_name

Methods included from ScenarioInterface

#define, #define_phase, #desc, #phase, #phase_class, #process_context_class, #scenario_name

Constructor Details

This class inherits a constructor from Rootage::Command

Class Method Details

.execution(action, &b) ⇒ Object

Define an action to phase "execution".



193
194
195
# File 'lib/rootage/command.rb', line 193

def execution(action, &b)
  define_action(:execution, action, &b)
end

.setup(action, &b) ⇒ Object

Define an action to phase "setup".



188
189
190
# File 'lib/rootage/command.rb', line 188

def setup(action, &b)
  define_action(:setup, action, &b)
end

.termination(action, &b) ⇒ Object

Define an action to phase "termination".



198
199
200
# File 'lib/rootage/command.rb', line 198

def termination(action, &b)
  define_action(:termination, action, &b)
end

Instance Method Details

#terminateObject

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



205
206
207
208
# File 'lib/rootage/command.rb', line 205

def terminate
  enter_phase(:termination)
  self.exit # end with status code
end