From c00e84327f14845bd484e76b5ee5dfeb1fa9ce3d Mon Sep 17 00:00:00 2001 From: hsbt Date: Sun, 8 Oct 2017 01:32:18 +0000 Subject: Merge rubygems master. This is RC version of Rubygems 2.7.0. https://github.com/rubygems/rubygems/commit/688fb7e83c13c3fe7c2bb03c49a2db4c82852aee git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/source.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/rubygems/source.rb') diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb index 85f5268fa3..bd84c217a7 100644 --- a/lib/rubygems/source.rb +++ b/lib/rubygems/source.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'uri' -require 'fileutils' +autoload :FileUtils, 'fileutils' +autoload :URI, 'uri' ## # A Source knows how to list and fetch gems from a RubyGems marshal index. @@ -67,7 +67,11 @@ class Gem::Source return -1 if !other.uri - @uri.to_s <=> other.uri.to_s + # Returning 1 here ensures that when sorting a list of sources, the + # original ordering of sources supplied by the user is preserved. + return 1 unless @uri.to_s == other.uri.to_s + + 0 else nil end @@ -232,4 +236,3 @@ require 'rubygems/source/specific_file' require 'rubygems/source/local' require 'rubygems/source/lock' require 'rubygems/source/vendor' - -- cgit v1.2.3