Method: Inspec::Profile.for_path

Defined in:
lib/inspec/profile.rb

.for_path(path, opts) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/inspec/profile.rb', line 51

def self.for_path(path, opts)
  file_provider = FileProvider.for_path(path)
  rp = file_provider.relative_provider

  # copy embedded dependecies into global cache
  copy_deps_into_cache(rp, opts) unless opts[:cache].nil?

  reader = Inspec::SourceReader.resolve(rp)
  if reader.nil?
    fail("Don't understand inspec profile in #{path}, it " \
         "doesn't look like a supported profile structure.")
  end
  new(reader, opts)
end