Class
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
Read
The name of the gem created by this git gem.
Read
The commit reference used for checking out this git gem.
Read & Write
When false the cache for this repository will not be updated.
Read
The git repository this gem is sourced from.
Read & Write
The directory for cache and git gem installation
Read
Does this repository need submodules checked out too?
Class Methods
lib/rubygems/source/git.rb
View on GitHub
# File tmp/rubies/ruby-3.4.1/lib/rubygems/source/git.rb, line 51
def initialize(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.dir
end
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.
Instance Methods
lib/rubygems/source/git.rb
View on GitHub
# File tmp/rubies/ruby-3.4.1/lib/rubygems/source/git.rb, line 63
def <=>(other)
case other
when Gem::Source::Git then
0
when Gem::Source::Vendor,
Gem::Source::Lock then
-1
when Gem::Source then
1
end
end
No documentation available
lib/rubygems/source/git.rb
View on GitHub
# File tmp/rubies/ruby-3.4.1/lib/rubygems/source/git.rb, line 83
def git_command
ENV.fetch("git", "git")
end
No documentation available
#
lib/rubygems/source/git.rb
View on GitHub
# File tmp/rubies/ruby-3.4.1/lib/rubygems/source/git.rb, line 201
def specs
checkout
return [] unless install_dir
Dir.chdir install_dir do
Dir["{,*,*/*}.gemspec"].filter_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
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
end
end
Loads all gemspecs in the repository