зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Fix newline=false being ignored by Shell#warn
https://github.com/rubygems/rubygems/commit/e021ff33a8
This commit is contained in:
Родитель
cfad1f95d5
Коммит
2066482684
|
@ -50,7 +50,7 @@ module Bundler
|
||||||
end
|
end
|
||||||
return true unless name
|
return true unless name
|
||||||
Bundler.ui.info "" unless Bundler.ui.debug? # Add new line in case dots preceded this
|
Bundler.ui.info "" unless Bundler.ui.debug? # Add new line in case dots preceded this
|
||||||
Bundler.ui.warn "Retrying #{name} due to error (#{current_run.next}/#{total_runs}): #{e.class} #{e.message}", Bundler.ui.debug?
|
Bundler.ui.warn "Retrying #{name} due to error (#{current_run.next}/#{total_runs}): #{e.class} #{e.message}", true
|
||||||
end
|
end
|
||||||
|
|
||||||
def keep_trying?
|
def keep_trying?
|
||||||
|
|
|
@ -130,7 +130,7 @@ module Bundler
|
||||||
def tell_err(message, color = nil, newline = nil)
|
def tell_err(message, color = nil, newline = nil)
|
||||||
return if @shell.send(:stderr).closed?
|
return if @shell.send(:stderr).closed?
|
||||||
|
|
||||||
newline ||= !message.to_s.match?(/( |\t)\Z/)
|
newline = !message.to_s.match?(/( |\t)\Z/) if newline.nil?
|
||||||
message = word_wrap(message) if newline.is_a?(Hash) && newline[:wrap]
|
message = word_wrap(message) if newline.is_a?(Hash) && newline[:wrap]
|
||||||
|
|
||||||
color = nil if color && !$stderr.tty?
|
color = nil if color && !$stderr.tty?
|
||||||
|
|
|
@ -68,7 +68,7 @@ RSpec.describe Bundler::Retry do
|
||||||
it "print error message with newlines" do
|
it "print error message with newlines" do
|
||||||
allow(Bundler.ui).to receive(:debug?).and_return(false)
|
allow(Bundler.ui).to receive(:debug?).and_return(false)
|
||||||
expect(Bundler.ui).to receive(:info).with("").twice
|
expect(Bundler.ui).to receive(:info).with("").twice
|
||||||
expect(Bundler.ui).to receive(:warn).with(failure_message, false)
|
expect(Bundler.ui).to receive(:warn).with(failure_message, true)
|
||||||
|
|
||||||
expect do
|
expect do
|
||||||
Bundler::Retry.new("test", [], 1).attempt do
|
Bundler::Retry.new("test", [], 1).attempt do
|
||||||
|
|
|
@ -21,9 +21,12 @@ RSpec.describe Bundler::UI::Shell do
|
||||||
|
|
||||||
describe "#warn" do
|
describe "#warn" do
|
||||||
before { subject.level = "warn" }
|
before { subject.level = "warn" }
|
||||||
it "prints to stderr" do
|
it "prints to stderr, implicitly adding a newline" do
|
||||||
expect { subject.warn("warning") }.to output("warning\n").to_stderr
|
expect { subject.warn("warning") }.to output("warning\n").to_stderr
|
||||||
end
|
end
|
||||||
|
it "can be told not to emit a newline" do
|
||||||
|
expect { subject.warn("warning", false) }.to output("warning").to_stderr
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#debug" do
|
describe "#debug" do
|
||||||
|
|
Загрузка…
Ссылка в новой задаче