summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-10-16 09:58:58 +0000
committerSamuel Giddins <segiddins@segiddins.me>2017-10-30 13:54:15 -0500
commit6b5ac1869efe3e93695096d4ff767b79764c073f (patch)
treea39353dc8b1928688cfce39fc9cdf05d91f281d0
parent2378060cacdca7eaae0383f90dfba2169401dc37 (diff)
downloadbundler-6b5ac1869efe3e93695096d4ff767b79764c073f.tar.gz
Auto merge of #6098 - akhramov:fix/doubled-message-in-verbose-mode, r=segiddins
Fix doubled message in verbose mode The problem was doubled informative message in verbose mode (#6028) `Bundler::Definition#missing_specs?` clears the `@resolve` ivar due to the fact that `ensure` clause evaluates regardless whether exception occurred. That results in repeated resolution, and, therefore, in repeated debug messages. This change moves ivars clearing into the `rescue` clause, so `@resolve` will be cleared only in case when `BundlerError` occurs I chose this fix because running deps resolution twice is a bad idea anyway and it needs to be prevented. (cherry picked from commit 6c90bcb2969a302c33c8117b50c06543f3ba4741)
-rw-r--r--lib/bundler/definition.rb10
-rw-r--r--spec/install/gemfile/gemspec_spec.rb8
2 files changed, 11 insertions, 7 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 2fbc3d87d7..f872baa3ce 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -206,18 +206,18 @@ module Bundler
end
def missing_specs?
- missing = []
- resolve.materialize(requested_dependencies, missing)
+ missing = missing_specs
return false if missing.empty?
Bundler.ui.debug "The definition is missing #{missing.map(&:full_name)}"
true
rescue BundlerError => e
- Bundler.ui.debug "The definition is missing dependencies, failed to resolve & materialize locally (#{e})"
- true
- ensure
@index = nil
@resolve = nil
@specs = nil
+ @gem_version_promoter = nil
+
+ Bundler.ui.debug "The definition is missing dependencies, failed to resolve & materialize locally (#{e})"
+ true
end
def requested_specs
diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb
index 6ab974ee41..1dc016ed23 100644
--- a/spec/install/gemfile/gemspec_spec.rb
+++ b/spec/install/gemfile/gemspec_spec.rb
@@ -145,7 +145,9 @@ RSpec.describe "bundle install from an existing gemspec" do
G
bundle! "install", :verbose => true
- expect(out).to include("Found no changes, using resolution from the lockfile")
+
+ message = "Found no changes, using resolution from the lockfile"
+ expect(out.scan(message).size).to eq(1)
end
it "should match a lockfile without needing to re-resolve with development dependencies" do
@@ -162,7 +164,9 @@ RSpec.describe "bundle install from an existing gemspec" do
G
bundle! "install", :verbose => true
- expect(out).to include("Found no changes, using resolution from the lockfile")
+
+ message = "Found no changes, using resolution from the lockfile"
+ expect(out.scan(message).size).to eq(1)
end
it "should match a lockfile on non-ruby platforms with a transitive platform dependency" do