From cc3558650ed94c110ee1ab50ea75cd556dc188e9 Mon Sep 17 00:00:00 2001 From: James Wen Date: Mon, 25 Apr 2016 01:51:03 -0400 Subject: Only report same platform gem updates for `bundle outdated` - `bundle outdated` will now only show updates for a gem if there are available updates for that gem on the same platform - ex. gem `laduradura` is being used on ruby platform but updates are available on gem `laduradura` for java platform = do not display potential update versions for java --- lib/bundler/cli/outdated.rb | 4 ++-- spec/commands/outdated_spec.rb | 14 ++++++++++++++ spec/support/builders.rb | 10 ++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index ba2ba90de4..09b2d71453 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -48,9 +48,9 @@ module Bundler dependency = current_dependencies[current_spec.name] if options["strict"] - active_spec = definition.specs.detect {|spec| spec.name == current_spec.name } + active_spec = definition.specs.detect {|spec| spec.name == current_spec.name && spec.platform == current_spec.platform } else - active_specs = definition.index[current_spec.name].sort_by(&:version) + active_specs = definition.index[current_spec.name].select {|spec| spec.platform == current_spec.platform }.sort_by(&:version) if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1 active_spec = active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? } end diff --git a/spec/commands/outdated_spec.rb b/spec/commands/outdated_spec.rb index d61d316011..6420c28ac7 100644 --- a/spec/commands/outdated_spec.rb +++ b/spec/commands/outdated_spec.rb @@ -243,6 +243,20 @@ describe "bundle outdated" do end end + context "update available for a gem on a different platform" do + before do + install_gemfile <<-G + source "file://#{gem_repo2}" + gem "laduradura", '= 5.15.2' + G + end + + it "reports that no updates are available" do + bundle "outdated" + expect(out).to include("Bundle up to date!") + end + end + shared_examples_for "version update is detected" do it "reports that a gem has a newer version" do subject diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 6b7edbf85a..eaa68f51df 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -120,6 +120,16 @@ module Spec s.add_dependency "weakling", ">= 0.0.3" end + build_gem "laduradura", "5.15.2" + build_gem "laduradura", "5.15.2" do |s| + s.platform = "java" + s.write "lib/laduradura.rb", "LADURADURA = '5.15.2 JAVA'" + end + build_gem "laduradura", "5.15.3" do |s| + s.platform = "java" + s.write "lib/laduradura.rb", "LADURADURA = '5.15.2 JAVA'" + end + build_gem "weakling", "0.0.3" build_gem "terranova", "8" -- cgit v1.2.1