Module: Wukong::Runner::BootSequence

Includes:
HelpMessage
Included in:
Wukong::Runner
Defined in:
lib/wukong/runner/boot_sequence.rb

Overview

The boot sequence of a runner consists of the following phases, each corresponding to a method provided by this module.

  • #load -- loads all application code
  • #configure -- configures settings from core Wukong, any loaded plugins, and any application code
  • #resolve -- resolves settings
  • #setup -- boots core Wukong and all loaded plugins
  • #validate -- validates command-line args
  • #run -- starts the runner running

Each method can be separately overriden, allowing for a lot of customizability for different kinds of runners.

Instance Method Summary collapse

Methods included from HelpMessage

#dump_help, #dump_help_and_exit!, #help_given?, #strip_help_param!

Instance Method Details

#boot!(override_settings = nil) ⇒ Object

Boot this Runner, calling in order:

  • #load
  • #configure
  • #resolve
  • #setup
  • #validate
  • #run or #die

If override_settings is passed then merge it over the Runner's usual settings (this is useful for unit tests where settings are injected in ways different from the usual workflow).



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/wukong/runner/boot_sequence.rb', line 36

def boot!(override_settings=nil)
  load
  configure
  resolve
  setup
  settings.merge!(override_settings) if override_settings
  
  case
  when help_given? then dump_help_and_exit!
  when validate    then run
  else
    die("Invalid arguments")
  end
end