aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Moore <tmoore@incrementalism.net>2014-09-29 23:03:27 +1000
committerTim Moore <tmoore@incrementalism.net>2014-10-11 18:00:28 +1100
commit802832864a19cd8c9d81b1123dce1d8acc8cc805 (patch)
treeed62a0a4494abb2690be45f56ba1d2b4d3ef943d
parent8e2f2ded68397a7402d4507b713e026504a4df0a (diff)
downloadbundler-802832864a19cd8c9d81b1123dce1d8acc8cc805.tar.gz
Normalize sources to lock format when comparing.
Fixes #3167. Also moves the reversing of Rubygems remotes for the lock file out of SourceList#combine_rubygems_sources and into Rubygems#to_lock.
-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 e5b6b243..870fe48d 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 f3b8b7c8..044b3632 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 0d9fb516..c0eeaf3a 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 67d4ef6a..4acaa9da 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