lib/inspec/profile.rb in inspec-1.22.0 vs lib/inspec/profile.rb in inspec-1.23.0

- old
+ new

@@ -11,10 +11,11 @@ require 'inspec/metadata' require 'inspec/backend' require 'inspec/rule' require 'inspec/log' require 'inspec/profile_context' +require 'inspec/runtime_profile' require 'inspec/dependencies/cache' require 'inspec/dependencies/lockfile' require 'inspec/dependencies/dependency_set' module Inspec @@ -80,22 +81,26 @@ def_delegator :@source_reader, :libraries def_delegator :@source_reader, :metadata # rubocop:disable Metrics/AbcSize def initialize(source_reader, options = {}) + @source_reader = source_reader @target = options[:target] @logger = options[:logger] || Logger.new(nil) @locked_dependencies = options[:dependencies] @controls = options[:controls] || [] @writable = options[:writable] || false @profile_id = options[:id] @cache = options[:cache] || Cache.new @backend = options[:backend] || Inspec::Backend.create(options.select { |k, _| k != 'target' }) @attr_values = options[:attributes] - @source_reader = source_reader @tests_collected = false @libraries_loaded = false Metadata.finalize(@source_reader.metadata, @profile_id, options) + + @runtime_profile = RuntimeProfile.new(self) + @backend.profile = @runtime_profile + @runner_context = options[:profile_context] || Inspec::ProfileContext.for_profile(self, @backend, @attr_values) end