Class | Gem::SourceIndex |
In: |
lib/rubygems/source_index.rb
|
Parent: | Object |
The SourceIndex object indexes all the gems available from a particular source (e.g. a list of gem directories, or a remote source). A SourceIndex maps a gem full name to a gem specification.
NOTE: | The class used to be named Cache, but that became confusing when cached source fetchers where introduced. The constant Gem::Cache is an alias for this class to allow old YAMLized source index objects to load properly. |
INCREMENTAL_THRESHHOLD | = | 50 |
gems | [R] |
Factory method to construct a source index instance for a
given path.
spec_dirs: | List of directories to search for specifications. Each directory should have a "specifications" subdirectory containing the gem specifications. |
return: | SourceIndex instance |
Factory method to construct a source index instance for a given path.
deprecated: | If supplied, from_installed_gems will act just like from_gems_in. This argument is deprecated and is provided just for backwards compatibility, and should not generally be used. |
return: | SourceIndex instance |
Return a list of directories in the current gem path that contain specifications.
return: | List of directory paths (all ending in "../specifications"). |
Load a specification from a file (eval‘d Ruby code)
file_name: | [String] The .gemspec file |
return: | Specification instance or nil if an error occurs |
Constructs a source index instance from the provided specifications
specifications: | [Hash] hash of [Gem name, Gem::Specification] pairs |
Iterate over the specifications in the source index.
&block: | [yields gem.full_name, Gem::Specification] |
Returns a Hash of name => Specification of the latest versions of each gem in this index.
Search for a gem by short name pattern and optional version
gem_name: | [String] a partial for the (short) name of the gem, or
|
version_requirement: | [String | default=Version::Requirement.new(">= 0")] version to find |
return: | [Array] list of Gem::Specification objects in sorted (version) order. Empty if not found. |