Method: Inspec::DSL.load_spec_files_for_profile

Defined in:
lib/inspec/dsl.rb

.load_spec_files_for_profile(bind_context, opts, &block) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/inspec/dsl.rb', line 30

def self.load_spec_files_for_profile(bind_context, opts, &block)
  dependencies = opts[:dependencies]
  profile_id = opts[:profile_id]

  dep_entry = dependencies.list[profile_id]
  if dep_entry.nil?
    raise "      Cannot load \#{profile_id} since it is not listed as a dependency of \#{bind_context.profile_name}.\n\n      Dependencies available from this context are:\n          \#{dependencies.list.keys.join(\"\\n    \")}\n    EOF\n  end\n\n  context = dep_entry.profile.runner_context\n  # if we don't want all the rules, then just make 1 pass to get all rule_IDs\n  # that we want to keep from the original\n  filter_included_controls(context, dep_entry.profile, &block) if !opts[:include_all]\n  # interpret the block and skip/modify as required\n  context.load(block) if block_given?\n  bind_context.add_subcontext(context)\nend\n"