类 Gem::Source::Git
用于 gem 依赖文件中的 git gem。
示例
source = Gem::Source::Git.new 'rake', 'git@example:rake.git', 'rake-10.1.0', false source.specs
属性
由此 git gem 创建的 gem 的名称。
此仓库是否也需要检出子模块?
用于检出此 git gem 的提交引用。
当为 false 时,此仓库的缓存将不会被更新。
此 gem 的来源的 git 仓库。
用于缓存和 git gem 安装的目录
公共类方法
来源
# File 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
为从给定 reference
处加载的 repository
中的 gem 创建新的 git gem 源。name
仅用于将仓库追溯到 gem 依赖文件,它没有实际意义,因为一个 git 仓库可能包含多个 gem。如果 submodules
为 true,则在安装 gem 时将检出子模块。
公共实例方法
来源
# File 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
来源
# File lib/rubygems/source/git.rb, line 83 def git_command ENV.fetch("git", "git") end
来源
# File 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
加载仓库中的所有 gemspec