Class: Inspec::DependencyInstaller

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/inspec/dependency_installer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem_path = nil, requested_gems = []) ⇒ DependencyInstaller

Returns a new instance of DependencyInstaller.



15
16
17
18
19
# File 'lib/inspec/dependency_installer.rb', line 15

def initialize(gem_path = nil, requested_gems = [])
  @dependency_loader = Inspec::DependencyLoader.new
  @gem_path = gem_path || inspec_gem_path
  @requested_gems = requested_gems
end

Instance Attribute Details

#dependency_loaderObject (readonly)

Returns the value of attribute dependency_loader.



11
12
13
# File 'lib/inspec/dependency_installer.rb', line 11

def dependency_loader
  @dependency_loader
end

#gem_pathObject (readonly)

Returns the value of attribute gem_path.



11
12
13
# File 'lib/inspec/dependency_installer.rb', line 11

def gem_path
  @gem_path
end

#requested_gemsObject (readonly)

Returns the value of attribute requested_gems.



11
12
13
# File 'lib/inspec/dependency_installer.rb', line 11

def requested_gems
  @requested_gems
end

Instance Method Details

#installObject



21
22
23
24
25
26
# File 'lib/inspec/dependency_installer.rb', line 21

def install
  requested_gems.each do |requested_gem|
    version = requested_gem[:version].nil? ? "> 0" : requested_gem[:version]
    install_from_remote_gems(requested_gem[:name], { version: version })
  end
end