Skip to content

Commit a0fc995

Browse files
Merge pull request #8060 from rubygems/release/bundler_2.5.20_rubygems_3.5.20
Prepare RubyGems 3.5.20 and Bundler 2.5.20
2 parents d569990 + b1364cf commit a0fc995

31 files changed

+235
-95
lines changed

.github/workflows/scorecards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ jobs:
4949

5050
# Upload the results to GitHub's code scanning dashboard.
5151
- name: "Upload to code-scanning"
52-
uses: github/codeql-action/upload-sarif@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7
52+
uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8
5353
with:
5454
sarif_file: results.sarif

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 3.5.20 / 2024-09-24
2+
3+
## Enhancements:
4+
5+
* Installs bundler 2.5.20 as a default gem.
6+
17
# 3.5.19 / 2024-09-18
28

39
## Enhancements:

bundler/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# 2.5.20 (September 24, 2024)
2+
3+
## Enhancements:
4+
5+
- Don't try to auto-install dev versions of Bundler not available remotely [#8045](https://github.com/rubygems/rubygems/pull/8045)
6+
- Don't try to install locked bundler when `--local` is passed [#8041](https://github.com/rubygems/rubygems/pull/8041)
7+
8+
## Bug fixes:
9+
10+
- Fix `bundler/inline` overwriting lockfiles [#8055](https://github.com/rubygems/rubygems/pull/8055)
11+
- Ensure refs directory in cached git source [#8047](https://github.com/rubygems/rubygems/pull/8047)
12+
- Fix `bundle outdated` with `--group` option [#8052](https://github.com/rubygems/rubygems/pull/8052)
13+
114
# 2.5.19 (September 18, 2024)
215

316
## Enhancements:

bundler/lib/bundler/cli/install.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ def run
1212

1313
warn_if_root
1414

15-
Bundler.self_manager.install_locked_bundler_and_restart_with_it_if_needed
15+
if options[:local]
16+
Bundler.self_manager.restart_with_locked_bundler_if_needed
17+
else
18+
Bundler.self_manager.install_locked_bundler_and_restart_with_it_if_needed
19+
end
1620

1721
Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Gem.freebsd_platform?
1822

bundler/lib/bundler/cli/outdated.rb

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,28 +97,26 @@ def run
9797
}
9898
end
9999

100-
if outdated_gems.empty?
100+
relevant_outdated_gems = if options_include_groups
101+
outdated_gems.group_by {|g| g[:groups] }.sort.flat_map do |groups, gems|
102+
contains_group = groups.split(", ").include?(options[:group])
103+
next unless options[:groups] || contains_group
104+
105+
gems
106+
end.compact
107+
else
108+
outdated_gems
109+
end
110+
111+
if relevant_outdated_gems.empty?
101112
unless options[:parseable]
102113
Bundler.ui.info(nothing_outdated_message)
103114
end
104115
else
105-
if options_include_groups
106-
relevant_outdated_gems = outdated_gems.group_by {|g| g[:groups] }.sort.flat_map do |groups, gems|
107-
contains_group = groups.split(", ").include?(options[:group])
108-
next unless options[:groups] || contains_group
109-
110-
gems
111-
end.compact
112-
113-
if options[:parseable]
114-
print_gems(relevant_outdated_gems)
115-
else
116-
print_gems_table(relevant_outdated_gems)
117-
end
118-
elsif options[:parseable]
119-
print_gems(outdated_gems)
116+
if options[:parseable]
117+
print_gems(relevant_outdated_gems)
120118
else
121-
print_gems_table(outdated_gems)
119+
print_gems_table(relevant_outdated_gems)
122120
end
123121

124122
exit 1

bundler/lib/bundler/definition.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def groups
317317

318318
def lock(file_or_preserve_unknown_sections = false, preserve_unknown_sections_or_unused = false)
319319
if [true, false, nil].include?(file_or_preserve_unknown_sections)
320-
target_lockfile = lockfile || Bundler.default_lockfile
320+
target_lockfile = lockfile
321321
preserve_unknown_sections = file_or_preserve_unknown_sections
322322
else
323323
target_lockfile = file_or_preserve_unknown_sections

bundler/lib/bundler/self_manager.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ def restart_with(version)
9898

9999
def needs_switching?
100100
autoswitching_applies? &&
101-
released?(lockfile_version) &&
102-
!running?(lockfile_version) &&
103-
!updating? &&
104-
Bundler.settings[:version] != "system"
101+
Bundler.settings[:version] != "system" &&
102+
released?(restart_version) &&
103+
!running?(restart_version) &&
104+
!updating?
105105
end
106106

107107
def autoswitching_applies?

bundler/lib/bundler/source/git.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def local_override!(path)
188188
end
189189

190190
def specs(*)
191-
set_cache_path!(app_cache_path) if use_app_cache?
191+
set_up_app_cache!(app_cache_path) if use_app_cache?
192192

193193
if requires_checkout? && !@copied
194194
FileUtils.rm_rf(app_cache_path) if use_app_cache? && git_proxy.not_a_bare_repository?
@@ -320,6 +320,11 @@ def set_install_path!(path)
320320
@install_path = path
321321
end
322322

323+
def set_up_app_cache!(path)
324+
FileUtils.mkdir_p(path.join("refs"))
325+
set_cache_path!(path)
326+
end
327+
323328
def has_app_cache?
324329
cached_revision && super
325330
end

bundler/lib/bundler/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: false
22

33
module Bundler
4-
VERSION = "2.5.19".freeze
4+
VERSION = "2.5.20".freeze
55

66
def self.bundler_major_version
77
@bundler_major_version ||= VERSION.split(".").first.to_i

bundler/spec/cache/git_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,34 @@
212212
expect(the_bundle).to include_gem "foo 1.0"
213213
end
214214

215+
it "can install after bundle cache without cloning remote repositories with only git tracked files" do
216+
build_git "foo"
217+
218+
gemfile <<-G
219+
source "https://gem.repo1"
220+
gem "foo", :git => '#{lib_path("foo-1.0")}'
221+
G
222+
bundle "config set cache_all true"
223+
bundle :cache, "all-platforms" => true
224+
FileUtils.rm_rf Dir.glob(default_bundle_path("bundler/gems/extensions/**/foo-1.0-*")).first.to_s
225+
FileUtils.rm_rf Dir.glob(default_bundle_path("bundler/gems/foo-1.0-*")).first.to_s
226+
227+
simulate_new_machine
228+
bundle "config set frozen true"
229+
FileUtils.rm_rf "#{default_bundle_path}/cache/bundler/git/foo-1.0-*"
230+
231+
# Remove untracked files (including the empty refs dir in the cache)
232+
Dir.chdir(bundled_app) do
233+
system(*%W[git init --quiet])
234+
system(*%W[git add --all])
235+
system(*%W[git clean -d --force --quiet])
236+
end
237+
238+
bundle "install --local --verbose"
239+
expect(out).to_not include("Fetching")
240+
expect(the_bundle).to include_gem "foo 1.0"
241+
end
242+
215243
it "copies repository to vendor cache" do
216244
# CVE-2022-39253: https://lore.kernel.org/lkml/[email protected]/
217245
system(*%W[git config --global protocol.file.allow always])

0 commit comments

Comments
 (0)