summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-07-05 02:43:55 +0000
committerThe Bundler Bot <bot@bundler.io>2017-07-05 02:43:55 +0000
commit955c131ceb3c6238babea4a65e9e35c534dd7ebf (patch)
tree17a699a004bb4073070356e62692bbd34727abd3 /lib
parent6aa1f3b891a137f6eb97e139077f0da9604ea679 (diff)
parent762227012e61e45af9241019732cf8036305171d (diff)
downloadbundler-955c131ceb3c6238babea4a65e9e35c534dd7ebf.tar.gz
Auto merge of #5790 - bundler:seg-suppress-using-messages, r=indirect
[2.0] Suppress `Using …` messages during installation when a version has not changed ### What was the end-user problem that led to this PR? The problem was that `bundle install` output can get very verbose, even when Bundler is not doing anything. See https://github.com/bundler/bundler-features/issues/33. ### Was was your diagnosis of the problem? My diagnosis was that bundler was printing a bunch of `Using name (version)` messages, even when we were already using that gem at the same version. ### What is your fix for the problem, implemented in this PR? My fix is to introduce a feature flag (enabled by default on 2.0), that will only print those extra `Using` messages when `--verbose` is passed, and will continue to print them when there was an old version we can tell users about. Note that we still print a message when installing a gem for the first time. ### Why did you choose this fix out of the possible options? I chose this fix because it was essentially what had been done in https://github.com/bundler/bundler/pull/3872, and allows for easy feature-flagging.
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/feature_flag.rb1
-rw-r--r--lib/bundler/settings.rb1
-rw-r--r--lib/bundler/source.rb8
-rw-r--r--lib/bundler/source/git.rb2
-rw-r--r--lib/bundler/source/metadata.rb2
-rw-r--r--lib/bundler/source/path.rb2
-rw-r--r--lib/bundler/source/rubygems.rb2
7 files changed, 14 insertions, 4 deletions
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb
index 318ad5dee7..bca2c615b3 100644
--- a/lib/bundler/feature_flag.rb
+++ b/lib/bundler/feature_flag.rb
@@ -38,6 +38,7 @@ module Bundler
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
settings_flag(:prefer_gems_rb) { bundler_2_mode? }
settings_flag(:skip_default_git_sources) { bundler_2_mode? }
+ settings_flag(:suppress_install_using_messages) { bundler_2_mode? }
settings_flag(:unlock_source_unlocks_spec) { !bundler_2_mode? }
settings_flag(:update_requires_all_flag) { bundler_2_mode? }
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 8521f8658d..092cd26c22 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -36,6 +36,7 @@ module Bundler
prefer_gems_rb
silence_root_warning
skip_default_git_sources
+ suppress_install_using_messages
unlock_source_unlocks_spec
update_requires_all_flag
].freeze
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index cb5f2da83e..f3d50adecf 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -60,5 +60,13 @@ module Bundler
def earlier_version?(spec_version, locked_spec_version)
Gem::Version.new(spec_version) < Gem::Version.new(locked_spec_version)
end
+
+ def print_using_message(message)
+ if !message.include?("(was ") && Bundler.feature_flag.suppress_install_using_messages?
+ Bundler.ui.debug message
+ else
+ Bundler.ui.info message
+ end
+ end
end
end
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index c331af967e..d1e32946eb 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -169,7 +169,7 @@ module Bundler
def install(spec, options = {})
force = options[:force]
- Bundler.ui.info "Using #{version_message(spec)} from #{self}"
+ print_using_message "Using #{version_message(spec)} from #{self}"
if requires_checkout? && !@copied && !force
Bundler.ui.debug " * Checking out revision: #{ref}"
diff --git a/lib/bundler/source/metadata.rb b/lib/bundler/source/metadata.rb
index f6d2f0729d..1d62a1f76a 100644
--- a/lib/bundler/source/metadata.rb
+++ b/lib/bundler/source/metadata.rb
@@ -36,7 +36,7 @@ module Bundler
end
def install(spec, _opts = {})
- Bundler.ui.info "Using #{version_message(spec)}"
+ print_using_message "Using #{version_message(spec)}"
nil
end
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 99808d2ef2..84a98420a9 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -76,7 +76,7 @@ module Bundler
end
def install(spec, options = {})
- Bundler.ui.info "Using #{version_message(spec)} from #{self}"
+ print_using_message "Using #{version_message(spec)} from #{self}"
generate_bin(spec, :disable_extensions => true)
nil # no post-install message
end
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 70f7819f3a..e76a00361a 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -106,7 +106,7 @@ module Bundler
end
if installed?(spec) && !force
- Bundler.ui.info "Using #{version_message(spec)}"
+ print_using_message "Using #{version_message(spec)}"
return nil # no post-install message
end