diff options
-rw-r--r-- | lib/rubygems/source/git.rb | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -58,7 +58,7 @@ class Gem::Source::Git < Gem::Source @remote = true @root_dir = Gem.dir - @git = ENV['git'] || 'git' end def <=>(other) @@ -92,18 +92,18 @@ class Gem::Source::Git < Gem::Source return false unless File.exist? repo_cache_dir unless File.exist? install_dir - system @git, 'clone', '--quiet', '--no-checkout', repo_cache_dir, install_dir end Dir.chdir install_dir do - system @git, 'fetch', '--quiet', '--force', '--tags', install_dir - success = system @git, 'reset', '--quiet', '--hard', rev_parse if @need_submodules require "open3" - _, status = Open3.capture2e(@git, 'submodule', 'update', '--quiet', '--init', '--recursive') success &&= status.success? end @@ -120,11 +120,11 @@ class Gem::Source::Git < Gem::Source if File.exist? repo_cache_dir Dir.chdir repo_cache_dir do - system @git, 'fetch', '--quiet', '--force', '--tags', - @repository, 'refs/heads/*:refs/heads/*' end else - system @git, 'clone', '--quiet', '--bare', '--no-hardlinks', @repository, repo_cache_dir end end @@ -133,7 +133,7 @@ class Gem::Source::Git < Gem::Source # Directory where git gems get unpacked and so-forth. def base_dir # :nodoc: - File.join @root_dir, 'bundler' end ## @@ -155,11 +155,11 @@ class Gem::Source::Git < Gem::Source def install_dir # :nodoc: return unless File.exist? repo_cache_dir - File.join base_dir, 'gems', "#{@name}-#{dir_shortref}" end def pretty_print(q) # :nodoc: - q.group 2, '[Git: ', ']' do q.breakable q.text @repository @@ -172,7 +172,7 @@ class Gem::Source::Git < Gem::Source # The directory where the git gem's repository will be cached. def repo_cache_dir # :nodoc: - File.join @root_dir, 'cache', 'bundler', 'git', "#{@name}-#{uri_hash}" end ## @@ -182,7 +182,7 @@ class Gem::Source::Git < Gem::Source hash = nil Dir.chdir repo_cache_dir do - hash = Gem::Util.popen(@git, 'rev-parse', @reference).strip end raise Gem::Exception, @@ -201,7 +201,7 @@ class Gem::Source::Git < Gem::Source 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 @@ -211,7 +211,7 @@ class Gem::Source::Git < Gem::Source 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 @@ -226,11 +226,11 @@ class Gem::Source::Git < Gem::Source # A hash for the git gem based on the git repository URI. def uri_hash # :nodoc: - require_relative '../openssl' normalized = if @repository =~ %r{^\w+://(\w+@)?} - uri = URI(@repository).normalize.to_s.sub %r{/$},'' uri.sub(/\A(\w+)/) { $1.downcase } else @repository |