Method: Supermarket::SupermarketCLI#exec

Defined in:
lib/bundles/inspec-supermarket/cli.rb

#exec(*tests) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/bundles/inspec-supermarket/cli.rb', line 30

def exec(*tests)
  o = config
  diagnose(o)
  configure_logger(o)

  # iterate over tests and add compliance scheme
  tests = tests.map { |t| "supermarket://" + t }

  runner = Inspec::Runner.new(o)
  tests.each { |target| runner.add_target(target) }

  exit runner.run
rescue ArgumentError, RuntimeError, Train::UserError => e
  $stderr.puts e.message
  exit 1
end