123456789_123456789_123456789_123456789_123456789_

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'

Instance Attribute Summary

  • #root_dir rw

    The root directory for git gems in this set.

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.

Instance Method Summary

Set - Inherited

#find_all

The find_all method must be implemented.

#prefetch

The #prefetch method may be overridden, but this is not necessary.

Instance Attribute Details

#root_dir (rw)

The root directory for git gems in this set. This is usually Gem.dir, the installation directory for regular gems.

[ GitHub ]

  
# File 'lib/rubygems/resolver/git_set.rb', line 18

attr_accessor :root_dir

Instance Method Details

#find_all(req)

Finds all git gems matching req

[ GitHub ]

  
# File 'lib/rubygems/resolver/git_set.rb', line 80

def find_all req
  prefetch nil

  specs.values.select do |spec|
    req.match? spec
  end
end

#prefetch(reqs)

Prefetches specifications from the git repositories in this set.

[ GitHub ]

  
# 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