Method: Inspec::Requirement.from_metadata

Defined in:
lib/inspec/dependencies/requirement.rb

.from_metadata(dep, cache, opts) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/inspec/dependencies/requirement.rb', line 10

def self.(dep, cache, opts)
  raise "Cannot load empty dependency." if dep.nil? || dep.empty?

  req_path = opts[:cwd]

  if dep[:path]
    req_path = File.expand_path(dep[:path], req_path)
  end
  config = {
    cache: cache,
    cwd: req_path,
  }

  new(dep[:name],
    dep[:version],
    config,
    opts.merge(dep))
end