Class: Gem::Source::Git
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::Gem::Source
|
|
Instance Chain:
self,
::Gem::Source,
Comparable
|
|
Inherits: |
Gem::Source
|
Defined in: | lib/rubygems/source/git.rb |
Overview
Class Method Summary
-
.new(name, repository, reference, submodules = false) ⇒ Git
constructor
Creates a new git gem source for a gems from loaded from #repository at the given #reference.
::Gem::Source - Inherited
.new | Creates a new ::Gem::Source which will use the index located at #uri. |
Instance Attribute Summary
-
#remote
rw
When false the cache for this repository will not be updated.
-
#root_dir
rw
The directory for cache and git gem installation.
-
#name
readonly
The name of the gem created by this git gem.
-
#need_submodules
readonly
Does this repository need submodules checked out too?
-
#reference
readonly
The commit reference used for checking out this git gem.
-
#repository
readonly
The git repository this gem is sourced from.
::Gem::Source - Inherited
#update_cache? | Returns true when it is possible and safe to update the cache directory. |
#uri | The URI this source will fetch gems from. |
Instance Method Summary
- #<=>(other)
-
#specs
Loads all gemspecs in the repository.
::Gem::Source - Inherited
#<=> | Sources are ordered by installation preference. |
#cache_dir | Returns the local directory to write #uri to. |
#download | Downloads |
#fetch_spec | Fetches a specification for the given |
#load_specs | Loads |
Constructor Details
.new(name, repository, reference, submodules = false) ⇒ Git
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 'lib/rubygems/source/git.rb', line 54
def initialize name, repository, reference, submodules = false super repository @name = name @repository = repository @reference = reference @need_submodules = submodules @remote = true @root_dir = Gem.dir @git = ENV['git'] || 'git' end
Instance Attribute Details
#name (readonly)
The name of the gem created by this git gem.
# File 'lib/rubygems/source/git.rb', line 20
attr_reader :name
#need_submodules (readonly)
Does this repository need submodules checked out too?
# File 'lib/rubygems/source/git.rb', line 45
attr_reader :need_submodules
#reference (readonly)
The commit reference used for checking out this git gem.
# File 'lib/rubygems/source/git.rb', line 25
attr_reader :reference
#remote (rw)
When false the cache for this repository will not be updated.
# File 'lib/rubygems/source/git.rb', line 30
attr_accessor :remote
#repository (readonly)
The git repository this gem is sourced from.
# File 'lib/rubygems/source/git.rb', line 35
attr_reader :repository
#root_dir (rw)
The directory for cache and git gem installation
# File 'lib/rubygems/source/git.rb', line 40
attr_accessor :root_dir
Instance Method Details
#<=>(other)
[ GitHub ]#specs
Loads all gemspecs in the repository
# File 'lib/rubygems/source/git.rb', line 198
def specs checkout return [] unless install_dir 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