1. Gem::
  2. Source::
  3. Git

class 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',falsesource.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.

remote[RW]

When false the cache for this repository will not be updated.

repository[R]

The git repository this gem is sourced from.

root_dir[RW]

The directory for cache and git gem installation

Public Class Methods

Source
# File lib/rubygems/source/git.rb, line 51definitialize(name,repository,reference,submodules =false)require_relative"../uri"@uri =Gem::Uri.parse(repository)@name            =name@repository      =repository@reference       =reference||"HEAD"@need_submodules =submodules@remote   =true@root_dir =Gem.dirend

Creates a new git gem source for a gems from loaded fromrepository at the givenreference. Thename 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. Ifsubmodules is true, submodules will be checked out when the gem is installed.

Public Instance Methods

Source
# File lib/rubygems/source/git.rb, line 63def<=>(other)caseotherwhenGem::Source::Gitthen0whenGem::Source::Vendor,Gem::Source::Lockthen-1whenGem::Sourcethen1endend
Source
# File lib/rubygems/source/git.rb, line 83defgit_commandENV.fetch("git","git")end
Source
# File lib/rubygems/source/git.rb, line 201defspecscheckoutreturn []unlessinstall_dirDir.chdirinstall_dirdoDir["{,*,*/*}.gemspec"].filter_mapdo|spec_file|directory =File.dirnamespec_filefile      =File.basenamespec_fileDir.chdirdirectorydospec =Gem::Specification.loadfileifspecspec.base_dir =base_dirspec.extension_dir =File.joinbase_dir,"extensions",Gem::Platform.local.to_s,Gem.extension_api_version,"#{name}-#{dir_shortref}"spec.full_gem_path =File.dirnamespec.loaded_fromifspecendspecendendendend

Loads all gemspecs in the repository