Class: Most::Starter

Inherits:
Object show all
Defined in:
lib/most/starter.rb

Constant Summary collapse

CLI_OPTIONS =
{:submission_flag =>
['-s', '--submission PATH', "Specifies the submission file"],
       :submission_parameters_flag =>
['-p', '--parameters value[ value]', "Specifies parameters for the submission"],
       :output_file_flag =>
['-f', '--file PATH', "Specifies the file where to output the report"],
       :version_flag =>
['-v', '--version', 'Displays version information and exits.'],
       :help_flag =>
['-h', '--help', 'Displays this help message and exits.'],
       :quiet_flag =>
['-q', '--quiet', 'Starts in quiet mode.'],
       :verbose_flag =>
['-V', '--verbose', 'Starts in verbose mode (ignored in quiet mode).'],
       :debug_flag =>
['-d', '--debug', 'Starts in debug mode.']}

Instance Method Summary collapse

Constructor Details

#initializeStarter

Returns a new instance of Starter.



43
44
45
46
47
48
49
50
51
# File 'lib/most/starter.rb', line 43

def initialize()
  @environment = SERVICES[:environment]

  @options = @environment.options
  @modes   = @environment.modes
  @tasks   = @environment.tasks

  @parser = OptionParser.new()
end

Instance Method Details

#optionsObject



71
72
73
# File 'lib/most/starter.rb', line 71

def options()
  CLI_OPTIONS
end

#runObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/most/starter.rb', line 53

def run()
  if options_parsed?()
    begin
      if @modes[:verbose]
        @environment.show_message("#{FULL_NAME} has started on #{Time.now}", true)
      end

      SERVICES[:executor].run()

      if @modes[:verbose]
        @environment.show_message("#{FULL_NAME} has finished all tasks on #{Time.now}", true)
      end
    rescue Exception => e
      @environment.log_error(e, 'Command line interface failure')
    end
  end
end