Method: Inspec::Runner#load

Defined in:
lib/inspec/runner.rb

#loadObject



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/inspec/runner.rb', line 78

def load
  all_controls = []

  @target_profiles.each do |profile|
    @test_collector.add_profile(profile)
    next unless profile.supports_platform?

    write_lockfile(profile) if @create_lockfile
    profile.locked_dependencies
    profile_context = profile.load_libraries

    profile_context.dependencies.list.values.each do |requirement|
      unless requirement.profile.supports_platform?
        Inspec::Log.warn "Skipping profile: '#{requirement.profile.name}'" \
         " on unsupported platform: '#{@backend.platform.name}/#{@backend.platform.release}'."
        next
      end
      @test_collector.add_profile(requirement.profile)
    end

    @attributes = profile.runner_context.attributes if @attributes.empty?
    tests = profile.collect_tests
    all_controls += tests unless tests.nil?
  end

  all_controls.each do |rule|
    register_rule(rule) unless rule.nil?
  end
end