summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/definition.rb2
-rw-r--r--lib/bundler/source/rubygems.rb6
-rw-r--r--lib/bundler/source_list.rb2
-rw-r--r--spec/bundler/source_list_spec.rb12
4 files changed, 11 insertions, 11 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index e5b6b24364..870fe48daf 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -313,7 +313,7 @@ module Bundler
deleted = []
changed = []
- gemfile_sources = sources.all_sources
+ gemfile_sources = sources.lock_sources
if @locked_sources != gemfile_sources
new_sources = gemfile_sources - @locked_sources
deleted_sources = @locked_sources - gemfile_sources
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index f3b8b7c83b..044b363244 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -52,9 +52,9 @@ module Bundler
def to_lock
out = "GEM\n"
- out << remotes.map { |remote|
- " remote: #{suppress_configured_credentials remote}\n"
- }.join
+ remotes.reverse_each do |remote|
+ out << " remote: #{suppress_configured_credentials remote}\n"
+ end
out << " specs:\n"
end
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index 0d9fb516c8..c0eeaf3ae3 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -74,7 +74,7 @@ module Bundler
end
def combine_rubygems_sources
- Source::Rubygems.new("remotes" => rubygems_sources.map(&:remotes).flatten.uniq.reverse)
+ Source::Rubygems.new("remotes" => rubygems_sources.map(&:remotes).flatten.uniq)
end
end
end
diff --git a/spec/bundler/source_list_spec.rb b/spec/bundler/source_list_spec.rb
index 67d4ef6a45..4acaa9da5d 100644
--- a/spec/bundler/source_list_spec.rb
+++ b/spec/bundler/source_list_spec.rb
@@ -277,17 +277,17 @@ describe Bundler::SourceList do
end
describe "#lock_sources" do
- it "combines the rubygems sources into a single instance, removing duplicate remotes from the front" do
+ it "combines the rubygems sources into a single instance, removing duplicate remotes from the end" do
source_list.add_git_source('uri' => 'git://third-git.org/path.git')
- source_list.add_rubygems_source('remotes' => ['https://fourth-rubygems.org']) # intentional duplicate
+ source_list.add_rubygems_source('remotes' => ['https://duplicate-rubygems.org'])
source_list.add_path_source('path' => '/third/path/to/gem')
- source_list.add_rubygems_source('remotes' => ['https://first-rubygems.org'])
+ source_list.add_rubygems_source('remotes' => ['https://third-rubygems.org'])
source_list.add_path_source('path' => '/second/path/to/gem')
source_list.add_rubygems_source('remotes' => ['https://second-rubygems.org'])
source_list.add_git_source('uri' => 'git://second-git.org/path.git')
- source_list.add_rubygems_source('remotes' => ['https://third-rubygems.org'])
+ source_list.add_rubygems_source('remotes' => ['https://first-rubygems.org'])
source_list.add_path_source('path' => '/first/path/to/gem')
- source_list.add_rubygems_source('remotes' => ['https://fourth-rubygems.org'])
+ source_list.add_rubygems_source('remotes' => ['https://duplicate-rubygems.org'])
source_list.add_git_source('uri' => 'git://first-git.org/path.git')
expect(source_list.lock_sources).to eq [
@@ -298,10 +298,10 @@ describe Bundler::SourceList do
Bundler::Source::Path.new('path' => '/second/path/to/gem'),
Bundler::Source::Path.new('path' => '/third/path/to/gem'),
Bundler::Source::Rubygems.new('remotes' => [
+ 'https://duplicate-rubygems.org',
'https://first-rubygems.org',
'https://second-rubygems.org',
'https://third-rubygems.org',
- 'https://fourth-rubygems.org',
]),
]
end