Skip to content

Commit 77fb1bf

Browse files
hsbtk0kubun
authored andcommitted
Merge RubyGems-3.5.20 and Bundler-2.5.20
1 parent 3894841 commit 77fb1bf

File tree

20 files changed

+178
-66
lines changed

20 files changed

+178
-66
lines changed

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

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

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

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?

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

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

lib/rubygems.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
require "rbconfig"
1010

1111
module Gem
12-
VERSION = "3.5.19"
12+
VERSION = "3.5.20"
1313
end
1414

1515
# Must be first since it unloads the prelude from 1.9.2

spec/bundler/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])

spec/bundler/commands/binstubs_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@
115115
build_gem "prints_loaded_gems", "1.0" do |s|
116116
s.executables = "print_loaded_gems"
117117
s.bindir = "exe"
118-
s.write "exe/print_loaded_gems", <<-R
118+
s.write "exe/print_loaded_gems", <<~R
119+
#!/usr/bin/env ruby
119120
specs = Gem.loaded_specs.values.reject {|s| s.default_gem? }
120121
puts specs.map(&:full_name).sort.inspect
121122
R

spec/bundler/commands/outdated_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ def test_group_option(group)
251251
expect(out).to end_with("Bundle up to date!")
252252
end
253253

254+
it "works when only out of date gems are not in given group" do
255+
update_repo2 do
256+
build_gem "terranova", "9"
257+
end
258+
bundle "outdated --group development"
259+
expect(out).to end_with("Bundle up to date!")
260+
end
261+
254262
it "returns a sorted list of outdated gems from one group => 'default'" do
255263
test_group_option("default")
256264

0 commit comments

Comments
 (0)