summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrismo <chrismo@clabs.org>2016-10-13 00:12:48 -0500
committerchrismo <chrismo@clabs.org>2016-10-19 09:47:07 -0500
commit9c1c3a0e3a3cf5b65b5f6d499eb368de4ec23dff (patch)
tree4facc6af85b32e2ba90ec8ea47d4b858a8b15fef
parentb8c23f39399d8a6296ea268e7fcd57d3ac712467 (diff)
downloadbundler-9c1c3a0e3a3cf5b65b5f6d499eb368de4ec23dff.tar.gz
filtered outdated msg shouldn't say 'up to date'
Fixes #5076. When a filter option is in use and it filters out everything in the requested categories, it's safer to say there were no %{level} updates to display rather than "Bundle up to date!" Tracking an additional local variable with the exact info to know that even when filtered there was nothing to update anyway I didn't feel was worth it with the current design.
-rw-r--r--lib/bundler/cli/outdated.rb14
-rw-r--r--spec/commands/outdated_spec.rb10
2 files changed, 18 insertions, 6 deletions
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 60ac869637..1d5b8e0242 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -94,7 +94,7 @@ module Bundler
end
if outdated_gems_list.empty?
- Bundler.ui.info "Bundle up to date!\n" unless options[:parseable]
+ display_nothing_outdated_message
else
unless options[:parseable]
if options[:pre]
@@ -141,6 +141,18 @@ module Bundler
private
+ def display_nothing_outdated_message
+ unless options[:parseable]
+ filter_options = options.keys & %w(filter-major filter-minor filter-patch)
+ if filter_options.any?
+ display = filter_options.map {|o| o.sub("filter-", "") }.join(" or ")
+ Bundler.ui.info "No #{display} updates to display.\n"
+ else
+ Bundler.ui.info "Bundle up to date!\n"
+ end
+ end
+ end
+
def print_gem(current_spec, active_spec, dependency, groups, options_include_groups)
spec_version = "#{active_spec.version}#{active_spec.git_version}"
current_version = "#{current_spec.version}#{current_spec.git_version}"
diff --git a/spec/commands/outdated_spec.rb b/spec/commands/outdated_spec.rb
index f95e0fd774..b3d9a97b82 100644
--- a/spec/commands/outdated_spec.rb
+++ b/spec/commands/outdated_spec.rb
@@ -326,7 +326,7 @@ describe "bundle outdated" do
bundle "outdated --strict --filter-patch"
expect(out).to_not include("activesupport (newest")
- expect(out).to include("(newest 0.0.5, installed 0.0.3)")
+ expect(out).to include("(newest 0.0.5, installed 0.0.3")
end
it "only reports gems that match requirement and minor filter level" do
@@ -344,7 +344,7 @@ describe "bundle outdated" do
bundle "outdated --strict --filter-minor"
expect(out).to_not include("activesupport (newest")
- expect(out).to include("(newest 0.1.5, installed 0.0.3)")
+ expect(out).to include("(newest 0.1.5, installed 0.0.3")
end
it "only reports gems that match requirement and major filter level" do
@@ -362,7 +362,7 @@ describe "bundle outdated" do
bundle "outdated --strict --filter-major"
expect(out).to_not include("activesupport (newest")
- expect(out).to include("(newest 1.1.5, installed 0.0.3)")
+ expect(out).to include("(newest 1.1.5, installed 0.0.3")
end
end
end
@@ -472,7 +472,7 @@ describe "bundle outdated" do
shared_examples_for "no version updates are detected" do
it "does not detect any version updates" do
subject
- expect(out).to include("Bundle up to date!")
+ expect(out).to include("updates to display.")
expect(out).to_not include("ERROR REPORT TEMPLATE")
expect(out).to_not include("activesupport (newest")
expect(out).to_not include("weakling (newest")
@@ -598,7 +598,7 @@ describe "bundle outdated" do
it "shows nothing when patching and filtering to minor" do
bundle "outdated --patch --filter-minor"
- expect(out).to include("Bundle up to date!") # it shouldn't say this, but will get back to this with: #5076
+ expect(out).to include("No minor updates to display.")
expect(out).not_to include("patch (newest")
expect(out).not_to include("minor (newest")
expect(out).not_to include("major (newest")