Class: Inspec::Dependencies

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/dependencies.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cwd, vendor_path) ⇒ dependencies

initialize

Parameters:

  • cwd (String)

    current working directory for relative path includes

  • vendor_path (String)

    path which contains vendored dependencies



290
291
292
293
294
# File 'lib/inspec/dependencies.rb', line 290

def initialize(cwd, vendor_path)
  @cwd = cwd
  @vendor_path = vendor_path || File.join(Dir.home, '.inspec', 'cache')
  @list = nil
end

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



283
284
285
# File 'lib/inspec/dependencies.rb', line 283

def list
  @list
end

#vendor_pathObject (readonly)

Returns the value of attribute vendor_path.



283
284
285
# File 'lib/inspec/dependencies.rb', line 283

def vendor_path
  @vendor_path
end

Instance Method Details

#vendor(dependencies) ⇒ nil

  1. Get dependencies, pull things to a local cache if necessary

  2. Resolve dependencies

Parameters:

  • dependencies (Gem::Dependency)

    list of dependencies

Returns:

  • (nil)


301
302
303
304
305
# File 'lib/inspec/dependencies.rb', line 301

def vendor(dependencies)
  return if dependencies.nil? || dependencies.empty?
  @vendor_index ||= VendorIndex.new(@vendor_path)
  @list = Resolver.resolve(dependencies, @vendor_index, @cwd)
end