Method: Inspec::Runner#initialize

Defined in:
lib/inspec/runner.rb

#initialize(conf = {}) ⇒ Runner

Returns a new instance of Runner.



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
# File 'lib/inspec/runner.rb', line 35

def initialize(conf = {})
  @rules = []
  @conf = conf.dup
  @conf[:logger] ||= Logger.new(nil)
  @target_profiles = []
  @controls = @conf[:controls] || []
  @depends = @conf[:depends] || []
  @ignore_supports = @conf[:ignore_supports]
  @create_lockfile = @conf[:create_lockfile]
  @cache = Inspec::Cache.new(@conf[:vendor_cache])

  # parse any ad-hoc runners reporter formats
  # this has to happen before we load the test_collector
  @conf = Inspec::BaseCLI.parse_reporters(@conf) if @conf[:type].nil?

  @test_collector = @conf.delete(:test_collector) || begin
    require 'inspec/runner_rspec'
    RunnerRspec.new(@conf)
  end

  # list of profile attributes
  @attributes = []

  load_attributes(@conf)
  configure_transport
end