Class: TestRunner::Cli::App

Inherits:
Object
  • Object
show all
Includes:
GLI::App
Defined in:
lib/test-runner/cli/app.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.getObject



7
8
9
10
11
# File 'lib/test-runner/cli/app.rb', line 7

def self.get
  cli = new
  cli.setup
  cli
end

.runObject



13
14
15
# File 'lib/test-runner/cli/app.rb', line 13

def self.run
  exit(get.run(ARGV))
end

Instance Method Details

#setupObject



17
18
19
20
21
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/test-runner/cli/app.rb', line 17

def setup
  program_desc 'vpsAdminOS test suite evaluator'
  version TestRunner::VERSION
  subcommand_option_handling :normal
  preserve_argv true
  arguments :strict
  hide_commands_without_desc true

  desc 'List available tests'
  arg_name '[path-pattern]'
  command 'ls' do |c|
    c.action &Command.run(:list)
  end

  desc 'Run test'
  arg_name '[path-pattern]'
  command 'test' do |c|
    c.desc 'Assume the answer to confirmations is yes'
    c.switch %w(y yes)

    c.desc 'How many tests to run in parallel'
    c.flag %w(j jobs), type: Integer, default_value: 1

    c.desc 'Default timeout for machine commands, in seconds'
    c.flag %w(t timeout), type: Integer, default_value: 900

    c.desc 'Stop testing when one test fails'
    c.switch 'stop-on-failure', default_value: false

    c.desc 'Determines where machine disk files are kept'
    c.switch 'destructive', default_value: true

    c.desc 'Directory where test logs and state are stored'
    c.flag 'state-dir'

    c.action &Command.run(:test)
  end

  desc 'Debug test'
  arg_name '<test>'
  command 'debug' do |c|
    c.desc 'Directory where test logs and state are stored'
    c.flag 'state-dir'

    c.desc 'Default timeout for machine commands, in seconds'
    c.flag %w(t timeout), type: Integer, default_value: 900

    c.action &Command.run(:debug)
  end

  default_command 'ls'
end