Class: Gem::Resolver::VendorSet
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Set
|
|
Instance Chain:
self,
Set
|
|
Inherits: |
Gem::Resolver::Set
|
Defined in: | lib/rubygems/resolver/vendor_set.rb |
Overview
A VendorSet represents gems that have been unpacked into a specific directory that contains a gemspec.
This is used for gem dependency file support.
Example:
set = Gem::Resolver::VendorSet.new
set.add_vendor_gem 'rake', 'vendor/rake'
The directory vendor/rake must contain an unpacked rake gem along with a rake.gemspec (watching the given name).
Class Method Summary
Instance Attribute Summary
-
#specs
readonly
Internal use only
The specifications for this set.
Set
- Inherited
#errors | Errors encountered when resolving gems. |
#prerelease | When true, allows matching of requests to prerelease gems. |
#remote |
|
#remote? | When true, this set is allowed to access the network when looking up specifications or dependencies. |
Instance Method Summary
-
#find_all(req)
Returns an Array of
VendorSpecification
objects matching theDependencyRequest
req
. -
#add_vendor_gem(name, directory)
Internal use only
Adds a specification to the set with the given
name
which has been unpacked into the givendirectory
. -
#load_spec(name, version, platform, source)
Internal use only
Loads a spec with the given
name
. - #pretty_print(q) Internal use only
Set
- Inherited
Constructor Details
.new ⇒ VendorSet
# File 'lib/rubygems/resolver/vendor_set.rb', line 23
def initialize # :nodoc: super() @directories = {} @specs = {} end
Instance Attribute Details
#specs (readonly)
The specifications for this set.
# File 'lib/rubygems/resolver/vendor_set.rb', line 21
attr_reader :specs # :nodoc:
Instance Method Details
#add_vendor_gem(name, directory)
Adds a specification to the set with the given name
which has been unpacked into the given directory
.
# File 'lib/rubygems/resolver/vendor_set.rb', line 34
def add_vendor_gem(name, directory) # :nodoc: gemspec = File.join directory, "#{name}.gemspec" spec = Gem::Specification.load gemspec raise Gem::GemNotFoundException, "unable to find #{gemspec} for gem #{name}" unless spec spec.full_gem_path = File. directory @specs[spec.name] = spec @directories[spec] = directory spec end
#find_all(req)
Returns an Array of VendorSpecification
objects matching the DependencyRequest
req
.
#load_spec(name, version, platform, source)
Loads a spec with the given name
. version
, platform
and source
are ignored.
# File 'lib/rubygems/resolver/vendor_set.rb', line 67
def load_spec(name, version, platform, source) # :nodoc: @specs.fetch name end