Class | Chef::Provider::Package::Rubygems::GemEnvironment
In: | lib/chef/provider/package/rubygems.rb
Parent: | Object

### Methods

candidate_version_from_file candidate_version_from_remote dependency_installer find_newest_remote_version gem_paths gem_source_index install installed_versions uninstall uninstaller with_correct_verbosity with_gem_sources

### Constants

DEFAULT_UNINSTALLER_OPTS | = | {:ignore => true, :executables => true}

### Public Instance methods

candidate_version_from_file(gem_dependency, source)

Determines the candidate version for a gem from a .gem file on disk and checks if it matches the version contraints in `gem_dependency`

### Returns

Gem::Version a singular gem version object is returned if the gem

                  is available

nil returns nil if the gem on disk doesn‘t match the

                  version constraints for +gem_dependency+

candidate_version_from_remote(gem_dependency, *sources)

Finds the newest version that satisfies the constraints of `gem_dependency`. The version is determined from the cache or a round-trip to the server as needed. The architecture and gem sources will be set before making the query.

### Returns

Gem::Version a singular gem version object is returned if the gem

                  is available

nil returns nil if the gem could not be found

dependency_installer(opts={})
find_newest_remote_version(gem_dependency, *sources)

Find the newest gem version available from Gem.sources that satisfies the constraints of `gem_dependency`

gem_paths()

The paths where rubygems should search for installed gems. Implemented by subclasses.

gem_source_index()

A rubygems source index containing the list of gemspecs for all available gems in the gem installation. Implemented by subclasses

### Returns

Gem::SourceIndex

install(gem_dependency, options={})

Installs a gem via the rubygems ruby API.

### Options

:sources rubygems servers to use Other options are passed to Gem::DependencyInstaller.new

installed_versions(gem_dep)

Lists the installed versions of `gem_name`, constrained by the version spec in `gem_dep`

### Arguments

Gem::Dependency `gem_dep` is a Gem::Dependency object, its version

                      specification constrains which gems are returned.

### Returns

Gem::Specification
  an array of Gem::Specification objects

uninstall(gem_name, gem_version=nil, opts={})

Uninstall the gem `gem_name` via the rubygems ruby API. If `gem_version` is provided, only that version will be uninstalled. Otherwise, all versions are uninstalled.

### Options

Options are passed to Gem::Uninstaller.new

uninstaller(gem_name, opts={})
with_correct_verbosity() {|| ...}

Set rubygems’ user interaction to ConsoleUI or SilentUI depending on our current debug level

with_gem_sources(*sources) {|| ...}

Yields to the provided block with rubygems’ source list set to the list provided. Always resets the list when the block returns or raises an exception.

[Validate]