Skip to content

Commit 1f80f94

Browse files
Merge pull request #4648 from rubygems/fix_bundle_outdated_when_gems_no_longer_deps_after_update
Fix `bundle outdated` edge case (cherry picked from commit 64168eb)
1 parent be3d0ef commit 1f80f94

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

bundler/lib/bundler/cli/outdated.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ def nothing_outdated_message
147147

148148
def retrieve_active_spec(definition, current_spec)
149149
active_spec = definition.resolve.find_by_name_and_platform(current_spec.name, current_spec.platform)
150+
return unless active_spec
151+
150152
return active_spec if strict
151153

152154
active_specs = active_spec.source.specs.search(current_spec.name).select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)

bundler/spec/commands/outdated_spec.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,4 +1292,53 @@ def test_group_option(group)
12921292
expect(out).to end_with(expected_output)
12931293
end
12941294
end
1295+
1296+
context "when a gem is no longer a dependency after a full update" do
1297+
before do
1298+
build_repo4 do
1299+
build_gem "mini_portile2", "2.5.2" do |s|
1300+
s.add_dependency "net-ftp", "~> 0.1"
1301+
end
1302+
1303+
build_gem "mini_portile2", "2.5.3"
1304+
1305+
build_gem "net-ftp", "0.1.2"
1306+
end
1307+
1308+
gemfile <<~G
1309+
source "#{file_uri_for(gem_repo4)}"
1310+
1311+
gem "mini_portile2"
1312+
G
1313+
1314+
lockfile <<~L
1315+
GEM
1316+
remote: #{file_uri_for(gem_repo4)}/
1317+
specs:
1318+
mini_portile2 (2.5.2)
1319+
net-ftp (~> 0.1)
1320+
net-ftp (0.1.2)
1321+
1322+
PLATFORMS
1323+
#{lockfile_platforms}
1324+
1325+
DEPENDENCIES
1326+
mini_portile2
1327+
1328+
BUNDLED WITH
1329+
#{Bundler::VERSION}
1330+
L
1331+
end
1332+
1333+
it "works" do
1334+
bundle "outdated", :raise_on_error => false
1335+
1336+
expected_output = <<~TABLE.strip
1337+
Gem Current Latest Requested Groups
1338+
mini_portile2 2.5.2 2.5.3 >= 0 default
1339+
TABLE
1340+
1341+
expect(out).to end_with(expected_output)
1342+
end
1343+
end
12951344
end

0 commit comments

Comments
 (0)