Method: Inspec::DSL.get_reference_profile

Defined in:
lib/inspec/dsl.rb

.get_reference_profile(id, opts) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/inspec/dsl.rb', line 96

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