aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/source/git.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-04 00:48:31 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-04 00:48:31 +0000
commitea2a00d785576a7dc45c0f6e965de605929e889d (patch)
tree567e52888b17aacb404c59eb64519d927fb8894f /lib/rubygems/source/git.rb
parentbd950a75b512a7d6243d1f0bb5e944a06a2e1f94 (diff)
downloadruby-ea2a00d785576a7dc45c0f6e965de605929e889d.tar.gz
* lib/rubygems: Update to RubyGems 2.2.2 prerelease to check fixes to
CI. * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/source/git.rb')
-rw-r--r--lib/rubygems/source/git.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb
index 28178a5f4f..2e3fa03730 100644
--- a/lib/rubygems/source/git.rb
+++ b/lib/rubygems/source/git.rb
@@ -24,6 +24,11 @@ class Gem::Source::Git < Gem::Source
attr_reader :reference
##
+ # When false the cache for this repository will not be updated.
+
+ attr_accessor :remote
+
+ ##
# The git repository this gem is sourced from.
attr_reader :repository
@@ -53,6 +58,7 @@ class Gem::Source::Git < Gem::Source
@reference = reference
@need_submodules = submodules
+ @remote = true
@root_dir = Gem.dir
@git = ENV['git'] || 'git'
end
@@ -85,6 +91,8 @@ class Gem::Source::Git < Gem::Source
def checkout # :nodoc:
cache
+ return false unless File.exist? repo_cache_dir
+
unless File.exist? install_dir then
system @git, 'clone', '--quiet', '--no-checkout',
repo_cache_dir, install_dir
@@ -107,6 +115,8 @@ class Gem::Source::Git < Gem::Source
# Creates a local cache repository for the git gem.
def cache # :nodoc:
+ return unless @remote
+
if File.exist? repo_cache_dir then
Dir.chdir repo_cache_dir do
system @git, 'fetch', '--quiet', '--force', '--tags',
@@ -142,6 +152,8 @@ class Gem::Source::Git < Gem::Source
# The directory where the git gem will be installed.
def install_dir # :nodoc:
+ return unless File.exist? repo_cache_dir
+
File.join base_dir, 'gems', "#{@name}-#{dir_shortref}"
end
@@ -177,6 +189,8 @@ class Gem::Source::Git < Gem::Source
def specs
checkout
+ return [] unless install_dir
+
Dir.chdir install_dir do
Dir['{,*,*/*}.gemspec'].map do |spec_file|
directory = File.dirname spec_file