Class: Matrixeval::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/matrixeval/runner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Runner

Returns a new instance of Runner.



15
16
17
18
19
20
# File 'lib/matrixeval/runner.rb', line 15

def initialize(argv)
  @argv = argv
  @command = CommandLine.new(argv)
  @threads ||= []
  @matrixeval_results ||= []
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



13
14
15
# File 'lib/matrixeval/runner.rb', line 13

def argv
  @argv
end

#commandObject (readonly)

Returns the value of attribute command.



13
14
15
# File 'lib/matrixeval/runner.rb', line 13

def command
  @command
end

Class Method Details

.start(argv) ⇒ Object



8
9
10
# File 'lib/matrixeval/runner.rb', line 8

def start(argv)
  new(argv).start
end

Instance Method Details

#startObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/matrixeval/runner.rb', line 22

def start
  load_plugin

  validates

  if command.init?
    init
  elsif command.all?
    run_all_contexts
  else
    run_a_specific_context
  end
rescue OptionParser::InvalidOption => e
  puts <<~ERROR
    #{e.message}
    See 'matrixeval --help'
    ERROR
  exit
rescue Config::YAML::MissingError
  puts "Please run 'matrixeval init' first to generate matrixeval.yml"
  puts "See 'matrixeval init -h'"
  exit
ensure
  turn_on_stty_opost
end