1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] The --quiet should still display warnings

The is the previous intentional behaviour until
ca0676cb1c.

In my opinion, that previous behaviour was better and should be
restored, because we want our users to always see warnings and fix them.
And the original issue that motivated the change is fixable by other
means, namely through `BUNDLE_SILENCE_ROOT_WARNING`, or through
`BUNDLE_SILENCE_DEPRECATIONS` in general. Finally, the --quiet option is
still documented as "only print errors and warnings".

So this PR essentially reverts
ca0676cb1c
for the above reasons.

https://github.com/rubygems/rubygems/commit/35f2254dfc
This commit is contained in:
David Rodríguez 2021-07-25 13:03:09 +02:00 committed by Hiroshi SHIBATA
parent 24aca87def
commit 9ac89fe35e
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
5 changed files with 20 additions and 6 deletions

View file

@ -9,7 +9,7 @@ module Bundler
end
def run
Bundler.ui.level = "error" if options[:quiet]
Bundler.ui.level = "warn" if options[:quiet]
Bundler.settings.set_command_option_if_given :path, options[:path]
Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]

View file

@ -61,7 +61,7 @@ module Bundler
end
def run
Bundler.ui.level = "error" if options[:quiet]
Bundler.ui.level = "warn" if options[:quiet]
Bundler.settings.validate!
check!

View file

@ -8,7 +8,7 @@ module Bundler
end
def run
Bundler.ui.level = "error" if options[:quiet]
Bundler.ui.level = "warn" if options[:quiet]
warn_if_root

View file

@ -9,7 +9,7 @@ module Bundler
end
def run
Bundler.ui.level = "error" if options[:quiet]
Bundler.ui.level = "warn" if options[:quiet]
Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?

View file

@ -585,7 +585,20 @@ RSpec.describe "bundle install with gem sources" do
end
describe "when requesting a quiet install via --quiet" do
it "should be quiet" do
it "should be quiet if there are no warnings" do
bundle "config set force_ruby_platform true"
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'rack'
G
bundle :install, :quiet => true
expect(out).to be_empty
expect(err).to be_empty
end
it "should still display warnings and errors" do
bundle "config set force_ruby_platform true"
create_file("install_with_warning.rb", <<~RUBY)
@ -611,8 +624,9 @@ RSpec.describe "bundle install with gem sources" do
G
bundle :install, :quiet => true, :raise_on_error => false, :env => { "RUBYOPT" => "-r#{bundled_app("install_with_warning.rb")}" }
expect(out).to be_empty
expect(err).to include("Could not find gem 'non-existing-gem'")
expect(err).not_to include("BOOOOO")
expect(err).to include("BOOOOO")
end
end