Method: Inspec::DSL.get_reference_profile

Defined in:
lib/inspec/dsl.rb

.get_reference_profile(id, opts) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/inspec/dsl.rb', line 65

def self.get_reference_profile(id, opts)
  profiles_path = opts['profiles_path'] ||
                  fail('You must supply a --profiles-path to inherit from other profiles.')
  abs_path = File.expand_path(profiles_path.to_s)
  unless File.directory? abs_path
    fail("Cannot find profiles path #{abs_path}")
  end

  id_path = File.join(abs_path, id)
  unless File.directory? id_path
    fail("Cannot find referenced profile #{id} in #{id_path}")
  end

  id_path
end