diff options
-rw-r--r-- | lib/bundler/retry.rb | 5 | ||||
-rw-r--r-- | spec/bundler/retry_spec.rb | 4 | ||||
-rw-r--r-- | spec/realworld/mirror_probe_spec.rb | 16 |
3 files changed, 22 insertions, 3 deletions
diff --git a/lib/bundler/retry.rb b/lib/bundler/retry.rb index a7a72feed5..092fb866b3 100644 --- a/lib/bundler/retry.rb +++ b/lib/bundler/retry.rb @@ -43,7 +43,10 @@ module Bundler def fail_attempt(e) @failed = true - raise e if last_attempt? || @exceptions.any? {|k| e.is_a?(k) } + if last_attempt? || @exceptions.any? {|k| e.is_a?(k) } + Bundler.ui.info "" unless Bundler.ui.debug? + raise e + end return true unless name Bundler.ui.info "" unless Bundler.ui.debug? # Add new line incase dots preceded this Bundler.ui.warn "Retrying #{name} due to error (#{current_run.next}/#{total_runs}): #{e.class} #{e.message}", Bundler.ui.debug? diff --git a/spec/bundler/retry_spec.rb b/spec/bundler/retry_spec.rb index 665ba9f2df..7f5779a5ca 100644 --- a/spec/bundler/retry_spec.rb +++ b/spec/bundler/retry_spec.rb @@ -65,10 +65,10 @@ describe Bundler::Retry do end end - context "with debugging on" do + context "with debugging off" do it "print error message with newlines" do allow(Bundler.ui).to receive(:debug?).and_return(false) - expect(Bundler.ui).to receive(:info).with("") + expect(Bundler.ui).to receive(:info).with("").twice expect(Bundler.ui).to receive(:warn).with(failure_message, false) expect do diff --git a/spec/realworld/mirror_probe_spec.rb b/spec/realworld/mirror_probe_spec.rb index 0fb93b8ab1..5a4a4a1b0a 100644 --- a/spec/realworld/mirror_probe_spec.rb +++ b/spec/realworld/mirror_probe_spec.rb @@ -79,6 +79,22 @@ describe "fetching dependencies with a not available mirror", :realworld => true expect(out).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}") expect(out).to include("Could not fetch specs from #{mirror}") end + + it "prints each error and warning on a new line" do + gemfile <<-G + source "#{original}" + gem 'weakling' + G + + bundle :install + + expect(out).to eq "Fetching source index from #{mirror}/ + +Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ +Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ +Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ +Could not fetch specs from #{mirror}/" + end end context "with a global mirror without a fallback timeout" do |