Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
hide all warnings when in --quiet mode
Browse files Browse the repository at this point in the history
fixes #3186
  • Loading branch information
indirect committed Oct 20, 2014
1 parent fc273b9 commit ca0676c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
3 changes: 2 additions & 1 deletion lib/bundler/cli/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ def initialize(options)
end

def run
Bundler.ui.level = "error" if options[:quiet]

warn_if_root

if options[:without]
Expand Down Expand Up @@ -66,7 +68,6 @@ def run
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

Expand Down
4 changes: 3 additions & 1 deletion lib/bundler/cli/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ def initialize(options)
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)
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ def initialize(options, gems)
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
Expand Down
17 changes: 4 additions & 13 deletions spec/install/gems/simple_case_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
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
Expand Down Expand Up @@ -363,23 +363,14 @@
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

Expand Down

0 comments on commit ca0676c

Please sign in to comment.