diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-04-11 17:58:21 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-04-13 20:40:29 -0500 |
commit | 756ef2ccbbfb67f9cba3ee96d03e69fe108290dc (patch) | |
tree | b8017df01ea78b65ee82cac9f18a996e255f86c1 | |
parent | b05df750e92a2c12b0d47c0b9bff619bb024a0d5 (diff) | |
download | bundler-756ef2ccbbfb67f9cba3ee96d03e69fe108290dc.tar.gz |
[SharedHelpers] Restore debug message for dep mismatch
-rw-r--r-- | lib/bundler/endpoint_specification.rb | 2 | ||||
-rw-r--r-- | lib/bundler/remote_specification.rb | 2 | ||||
-rw-r--r-- | lib/bundler/shared_helpers.rb | 17 | ||||
-rw-r--r-- | spec/bundler/remote_specification_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/gems/compact_index_spec.rb | 6 |
5 files changed, 16 insertions, 13 deletions
diff --git a/lib/bundler/endpoint_specification.rb b/lib/bundler/endpoint_specification.rb index 1fb5b29732..5a1deeea47 100644 --- a/lib/bundler/endpoint_specification.rb +++ b/lib/bundler/endpoint_specification.rb @@ -91,7 +91,7 @@ module Bundler end def __swap__(spec) - SharedHelpers.ensure_same_dependencies(spec, dependencies, spec.dependencies) + SharedHelpers.ensure_same_dependencies(self, dependencies, spec.dependencies) @remote_specification = spec end diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb index cd076939c4..d89abd98ab 100644 --- a/lib/bundler/remote_specification.rb +++ b/lib/bundler/remote_specification.rb @@ -51,7 +51,7 @@ module Bundler # once the remote gem is downloaded, the backend specification will # be swapped out. def __swap__(spec) - SharedHelpers.ensure_same_dependencies(spec, dependencies, spec.dependencies) + SharedHelpers.ensure_same_dependencies(self, dependencies, spec.dependencies) @_remote_specification = spec end diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index cb8e142769..74700cde35 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -152,18 +152,21 @@ module Bundler end end - def ensure_same_dependencies(spec, old, new) - new = new.reject {|d| d.type == :development } - old = old.reject {|d| d.type == :development } + def ensure_same_dependencies(spec, old_deps, new_deps) + new_deps = new_deps.reject {|d| d.type == :development } + old_deps = old_deps.reject {|d| d.type == :development } without_type = proc {|d| Gem::Dependency.new(d.name, d.requirements_list.sort) } - new.map!(&without_type) - old.map!(&without_type) + new_deps.map!(&without_type) + old_deps.map!(&without_type) - extra_deps = new - old + extra_deps = new_deps - old_deps return if extra_deps.empty? + + Bundler.ui.debug "#{spec.full_name} from #{spec.remote} has either corrupted API or lockfile dependencies" \ + " (was expecting #{old_deps.map(&:to_s)}, but the real spec has #{new_deps.map(&:to_s)})" raise APIResponseMismatchError, - "Downloading #{spec.full_name} revealed dependencies not in the API or the lockfile (#{extra_deps.map(&:to_s).join(", ")})." \ + "Downloading #{spec.full_name} revealed dependencies not in the API or the lockfile (#{extra_deps.join(", ")})." \ "\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem." end diff --git a/spec/bundler/remote_specification_spec.rb b/spec/bundler/remote_specification_spec.rb index 69a2ab3d67..644814c563 100644 --- a/spec/bundler/remote_specification_spec.rb +++ b/spec/bundler/remote_specification_spec.rb @@ -129,7 +129,7 @@ RSpec.describe Bundler::RemoteSpecification do describe "#__swap__" do let(:spec) { double(:spec, :dependencies => []) } - let(:new_spec) { double(:new_spec, :runtime_dependencies => []) } + let(:new_spec) { double(:new_spec, :dependencies => [], :runtime_dependencies => []) } before { subject.instance_variable_set(:@_remote_specification, spec) } diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index 3ba858ed08..87f59e32c8 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -764,9 +764,9 @@ The checksum of /versions does not match the checksum provided by the server! So Gem::Dependency.new("activerecord", "= 2.3.2"), Gem::Dependency.new("actionmailer", "= 2.3.2"), Gem::Dependency.new("activeresource", "= 2.3.2")] - expect(out).to include(<<-E.strip).and include("rails-2.3.2 from rubygems remote at #{source_uri}/ has corrupted API dependencies") -Downloading rails-2.3.2 revealed dependencies not in the API (#{deps.join(", ")}). -Installing with `--full-index` should fix the problem. + expect(out).to include(<<-E.strip).and include("rails-2.3.2 from rubygems remote at #{source_uri}/ has either corrupted API or lockfile dependencies") +Bundler::APIResponseMismatchError: Downloading rails-2.3.2 revealed dependencies not in the API or the lockfile (#{deps.map(&:to_s).join(", ")}). +Either installing with `--full-index` or running `bundle update rails` should fix the problem. E end end |