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

Commit

Permalink
Only report same platform gem updates for bundle outdated
Browse files Browse the repository at this point in the history
- `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
  • Loading branch information
RochesterinNYC committed Apr 25, 2016
1 parent f8c6f25 commit cc35586
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bundler/cli/outdated.rb
Expand Up @@ -48,9 +48,9 @@ def run
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
Expand Down
14 changes: 14 additions & 0 deletions spec/commands/outdated_spec.rb
Expand Up @@ -243,6 +243,20 @@
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
Expand Down
10 changes: 10 additions & 0 deletions spec/support/builders.rb
Expand Up @@ -120,6 +120,16 @@ def build_repo1
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"
Expand Down

0 comments on commit cc35586

Please sign in to comment.