summaryrefslogtreecommitdiff
path: root/lib/rubygems/source.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-14 08:59:02 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-14 08:59:02 +0000
commit269503b544247b5b3e30dbe60a0bab4f2ca00e4e (patch)
treea6d0a3a9b34017c4c84d997152a3aaf3086e1ce1 /lib/rubygems/source.rb
parent2614d9ba2fb5ad171200cccc88f42fa659b527c6 (diff)
Revert r42938 "* lib/rubygems: Update to RubyGems 2.1.3"
It breaks build. http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20130913T200302Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/source.rb')
-rw-r--r--lib/rubygems/source.rb36
1 files changed, 28 insertions, 8 deletions
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
index 96d57870e2..f0e2a597b9 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -25,14 +25,23 @@ class Gem::Source
end
def <=>(other)
- if !@uri
- return 0 unless other.uri
- return -1
- end
+ case other
+ when Gem::Source::Installed,
+ Gem::Source::Local,
+ Gem::Source::SpecificFile then
+ -1
+ when Gem::Source then
+ if !@uri
+ return 0 unless other.uri
+ return 1
+ end
- return 1 if !other.uri
+ return -1 if !other.uri
- @uri.to_s <=> other.uri.to_s
+ @uri.to_s <=> other.uri.to_s
+ else
+ nil
+ end
end
include Comparable
@@ -58,8 +67,7 @@ class Gem::Source
def cache_dir(uri)
# Correct for windows paths
escaped_path = uri.path.sub(/^\/([a-z]):\//i, '/\\1-/')
- root = File.join Gem.user_home, '.gem', 'specs'
- File.join root, "#{uri.host}%#{uri.port}", File.dirname(escaped_path)
+ File.join Gem.spec_cache_dir, "#{uri.host}%#{uri.port}", File.dirname(escaped_path)
end
def update_cache?
@@ -141,4 +149,16 @@ class Gem::Source
fetcher = Gem::RemoteFetcher.fetcher
fetcher.download spec, @uri.to_s, dir
end
+
+ def pretty_print q # :nodoc:
+ q.group 2, '[Remote:', ']' do
+ q.breakable
+ q.text @uri.to_s
+ end
+ end
+
end
+
+require 'rubygems/source/installed'
+require 'rubygems/source/specific_file'
+require 'rubygems/source/local'