In Files

  • rubygems/source/git.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

Gem::Source::Git

A git gem for use in a gem dependencies file.

Example:

source =
  Gem::Source::Git.new 'rake', 'git@example:rake.git', 'rake-10.1.0', false

source.specs

Attributes

name[R]

The name of the gem created by this git gem.

need_submodules[R]

Does this repository need submodules checked out too?

reference[R]

The commit reference used for checking out this git gem.

repository[R]

The git repository this gem is sourced from.

root_dir[RW]

The directory for cache and git gem installation

Public Class Methods

new(name, repository, reference, submodules = false) click to toggle source

Creates a new git gem source for a gems from loaded from repository at the given reference. The name is only used to track the repository back to a gem dependencies file, it has no real significance as a git repository may contain multiple gems. If submodules is true, submodules will be checked out when the gem is installed.

 
               # File rubygems/source/git.rb, line 48
def initialize name, repository, reference, submodules = false
  super(nil)

  @name            = name
  @repository      = repository
  @reference       = reference
  @need_submodules = submodules

  @root_dir = Gem.dir
  @git      = ENV['git'] || 'git'
end
            

Public Instance Methods

<=>(other) click to toggle source
 
               # File rubygems/source/git.rb, line 60
def <=> other
  case other
  when Gem::Source::Git then
    0
  when Gem::Source::Installed,
       Gem::Source::Lock then
    -1
  when Gem::Source then
    1
  else
    nil
  end
end
            
specs() click to toggle source

Loads all gemspecs in the repository

 
               # File rubygems/source/git.rb, line 177
def specs
  checkout

  Dir.chdir install_dir do
    Dir['{,*,*/*}.gemspec'].map do |spec_file|
      directory = File.dirname spec_file
      file      = File.basename spec_file

      Dir.chdir directory do
        spec = Gem::Specification.load file
        if spec then
          spec.base_dir = base_dir

          spec.extension_dir =
            File.join base_dir, 'extensions', Gem::Platform.local.to_s,
              Gem.extension_api_version, "#{name}-#{dir_shortref}"

          spec.full_gem_path = File.dirname spec.loaded_from if spec
        end
        spec
      end
    end.compact
  end
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus