Class: TestProf::Autopilot::CLI

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/test_prof/autopilot/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

log

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



13
14
15
# File 'lib/test_prof/autopilot/cli.rb', line 13

def command
  @command
end

#merge_typeObject (readonly)

Returns the value of attribute merge_type.



13
14
15
# File 'lib/test_prof/autopilot/cli.rb', line 13

def merge_type
  @merge_type
end

#modeObject (readonly)

Returns the value of attribute mode.



13
14
15
# File 'lib/test_prof/autopilot/cli.rb', line 13

def mode
  @mode
end

#plan_pathObject (readonly)

Returns the value of attribute plan_path.



13
14
15
# File 'lib/test_prof/autopilot/cli.rb', line 13

def plan_path
  @plan_path
end

#report_pathsObject (readonly)

Returns the value of attribute report_paths.



13
14
15
# File 'lib/test_prof/autopilot/cli.rb', line 13

def report_paths
  @report_paths
end

Instance Method Details

#run(args = ARGV) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/test_prof/autopilot/cli.rb', line 15

def run(args = ARGV)
  @mode = "runner"

  optparser.parse!(args)

  if mode == "runner"
    infer_command! unless command

    raise "Test command must be specified. See -h for options" unless command

    raise "Plan path must be specified. See -h for options" unless plan_path

    raise "Plan #{plan_path} doesn't exist" unless File.file?(plan_path)

    Runner.invoke(plan_path, command)
  elsif mode == "merger"
    raise "Report paths must be specified. See -h for options" unless report_paths

    Merger.invoke(merge_type, report_paths)
  end
end