class Gem::Resolver::GitSet

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'

Attributes

root_dir[RW]

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

Public Instance Methods

find_all(req) click to toggle source

Finds all git gems matching req

# 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) click to toggle source

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

  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

end