diff options
author | Andre Arko <andre@arko.net> | 2014-10-20 00:06:40 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2014-10-20 00:37:14 -0700 |
commit | ca0676cb1c638e0b9747ea8c18f28adf82cc01de (patch) | |
tree | 93dc1ba866378b05d5bd0ea1667536eef22d7ca1 | |
parent | fc273b9b192a29037a4edeb6cad1e1140c857af6 (diff) | |
download | bundler-ca0676cb1c638e0b9747ea8c18f28adf82cc01de.tar.gz |
hide all warnings when in --quiet mode
fixes #3186
-rw-r--r-- | lib/bundler/cli/install.rb | 3 | ||||
-rw-r--r-- | lib/bundler/cli/package.rb | 4 | ||||
-rw-r--r-- | lib/bundler/cli/update.rb | 2 | ||||
-rw-r--r-- | spec/install/gems/simple_case_spec.rb | 17 |
4 files changed, 10 insertions, 16 deletions
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index 9bb7f681..80f9fd50 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -6,6 +6,8 @@ module Bundler end def run + Bundler.ui.level = "error" if options[:quiet] + warn_if_root if options[:without] @@ -66,7 +68,6 @@ module Bundler Bundler.settings[:no_prune] = true if options["no-prune"] Bundler.settings[:clean] = options["clean"] if options["clean"] Bundler.settings.without = options[:without] - Bundler.ui.level = "warn" if options[:quiet] Bundler::Fetcher.disable_endpoint = options["full-index"] Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil diff --git a/lib/bundler/cli/package.rb b/lib/bundler/cli/package.rb index b2946038..5adad44c 100644 --- a/lib/bundler/cli/package.rb +++ b/lib/bundler/cli/package.rb @@ -7,10 +7,12 @@ module Bundler end def run - Bundler.ui.level = "warn" if options[:quiet] + Bundler.ui.level = "error" if options[:quiet] Bundler.settings[:path] = File.expand_path(options[:path]) if options[:path] + setup_cache_all install + # TODO: move cache contents here now that all bundles are locked custom_path = Pathname.new(options[:path]) if options[:path] Bundler.load.cache(custom_path) diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index 920221f7..dd15de99 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -7,10 +7,10 @@ module Bundler end def run + Bundler.ui.level = "error" if options[:quiet] sources = Array(options[:source]) groups = Array(options[:group]).map(&:to_sym) - Bundler.ui.level = "warn" if options[:quiet] if gems.empty? && sources.empty? && groups.empty? # We're doing a full update diff --git a/spec/install/gems/simple_case_spec.rb b/spec/install/gems/simple_case_spec.rb index 7fbd9e0e..aac70db6 100644 --- a/spec/install/gems/simple_case_spec.rb +++ b/spec/install/gems/simple_case_spec.rb @@ -291,7 +291,7 @@ describe "bundle install with gem sources" do G bundle :install, :expect_err => true - expect(out).to match(/Your Gemfile has no gem server sources/i) + expect(out).to include("Your Gemfile has no gem server sources") end it "creates a Gemfile.lock on a blank Gemfile" do @@ -363,23 +363,14 @@ describe "bundle install with gem sources" do end describe "when requesting a quiet install via --quiet" do - it "should be quiet if there are no warnings" do - gemfile <<-G - source "file://#{gem_repo1}" - gem 'rack' - G - - bundle :install, :quiet => true - expect(out).to eq("") - end - - it "should still display warnings" do + it "should be quiet" do gemfile <<-G gem 'rack' G bundle :install, :quiet => true - expect(out).to match(/Your Gemfile has no gem server sources/) + expect(out).to include("Could not find gem 'rack (>= 0) ruby'") + expect(out).to_not include("Your Gemfile has no gem server sources") end end |