Class: Gem::Resolver::GitSet
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/git_set.rb |
Overview
A GitSet represents gems that are sourced from git repositories.
This is used for gem dependency file support.
Example:
set = Gem::Resolver::GitSet.new
set.add_git_gem 'rake', 'git://example/rake.git', tag: 'rake-10.1.0'
Class Method Summary
Instance Attribute Summary
-
#root_dir
rw
The root directory for git gems in this set.
-
#need_submodules
readonly
Internal use only
Contains repositories needing submodules.
-
#repositories
readonly
Internal use only
A Hash containing git gem names for keys and a Hash of repository and git commit reference as values.
-
#specs
readonly
Internal use only
A hash of gem names to
Gem::Resolver::GitSpecifications
Set - Inherited
#errors | Errors encountered when resolving gems. |
#prerelease | When true, allows matching of requests to prerelease gems. |
#remote | Set to true to disable network access for this set. |
#remote? | When true, this set is allowed to access the network when looking up specifications or dependencies. |
Instance Method Summary
-
#find_all(req)
Finds all git gems matching
req
-
#prefetch(reqs)
Prefetches specifications from the git repositories in this set.
- #add_git_gem(name, repository, reference, submodules) Internal use only
-
#add_git_spec(name, version, repository, reference, submodules)
Internal use only
Adds and returns a GitSpecification with the given
name
andversion
which came from arepository
at the givenreference
. - #pretty_print(q) Internal use only
Set - Inherited
Constructor Details
.new ⇒ GitSet
Instance Attribute Details
#need_submodules (readonly)
Contains repositories needing submodules
# File 'lib/rubygems/resolver/git_set.rb', line 23
attr_reader :need_submodules # :nodoc:
#repositories (readonly)
A Hash containing git gem names for keys and a Hash of repository and git commit reference as values.
# File 'lib/rubygems/resolver/git_set.rb', line 29
attr_reader :repositories # :nodoc:
#root_dir (rw)
The root directory for git gems in this set. This is usually Gem.dir, the installation directory for regular gems.
# File 'lib/rubygems/resolver/git_set.rb', line 18
attr_accessor :root_dir
#specs (readonly)
A hash of gem names to Gem::Resolver::GitSpecifications
# File 'lib/rubygems/resolver/git_set.rb', line 34
attr_reader :specs # :nodoc:
Instance Method Details
#add_git_gem(name, repository, reference, submodules)
# File 'lib/rubygems/resolver/git_set.rb', line 46
def add_git_gem name, repository, reference, submodules # :nodoc: @repositories[name] = [repository, reference] @need_submodules[repository] = submodules end
#add_git_spec(name, version, repository, reference, submodules)
Adds and returns a GitSpecification with the given name
and version
which came from a repository
at the given reference
. If submodules
is true they are checked out along with the repository.
This fills in the prefetch information as enough information about the gem is present in the arguments.
# File 'lib/rubygems/resolver/git_set.rb', line 59
def add_git_spec name, version, repository, reference, submodules # :nodoc: add_git_gem name, repository, reference, submodules source = Gem::Source::Git.new name, repository, reference source.root_dir = @root_dir spec = Gem::Specification.new do |s| s.name = name s.version = version end git_spec = Gem::Resolver::GitSpecification.new self, spec, source @specs[spec.name] = git_spec git_spec end
#find_all(req)
Finds all git gems matching req
#prefetch(reqs)
Prefetches specifications from the git repositories in this set.
# File 'lib/rubygems/resolver/git_set.rb', line 91
def prefetch reqs return unless @specs.empty? @repositories.each do |name, (repository, reference)| source = Gem::Source::Git.new name, repository, reference source.root_dir = @root_dir source.remote = @remote source.specs.each do |spec| git_spec = Gem::Resolver::GitSpecification.new self, spec, source @specs[spec.name] = git_spec end end end
#pretty_print(q)
# File 'lib/rubygems/resolver/git_set.rb', line 107
def pretty_print q # :nodoc: q.group 2, '[GitSet', ']' do next if @repositories.empty? q.breakable repos = @repositories.map do |name, (repository, reference)| "#{name}: #{repository}@#{reference}" end q.seplist repos do |repo| q.text repo end end end