bundler 4.0.16 → 4.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4ec7b35f89e61eb8c603099869df9c107accc057741b52f03b849d31ae0e734
4
- data.tar.gz: 13f346287c2ee66bb2baa3ddfaff121fce05c0f428ae73aa199b148559a80525
3
+ metadata.gz: a0e51552827f6a9e6f69879c84b28b5fc102157385d7b5acc8f76ccf23fc1d02
4
+ data.tar.gz: 580c4732a5106f1ac54652b7399e187a365a6b891e6b1eb5093093b7c0bcbbbd
5
5
  SHA512:
6
- metadata.gz: 6e70a1fb438a201e9864383eba6a47727102581979a7e15902d219cca5939e623e933b728a812308b0cf7e2210237bfcee2be2d99e36eabb24296360be296607
7
- data.tar.gz: 105f3457b4a7f4e69a252ee7857fcbeb7c4c91406c1ad76a693f09e2a3cf2a741bf407a91053fbe57d29afe8c88ded24553b6de33deb76ce11c9abff20d117ec
6
+ metadata.gz: 03f0b65a2e6655251ddd488cfe43983e7e94d1e72be6166ab5c4627f6075ee9d4aabf38e7e6c4514eb906a0ee524aaa6a3fbf2a598fdb7ecc8f3301b803cdf90
7
+ data.tar.gz: 36b037826c24cf525249954629c83c3d131a27a3d009d0a9af749e1108dcd043c151fa7f4f5786edc47a75c5526af6917a7da8ed0b222766e97749a4d298bbfd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.17 / 2026-07-22
4
+
5
+ ### Enhancements:
6
+
7
+ * Open compact index cache in binary mode when appending. Pull request [#9679](https://github.com/ruby/rubygems/pull/9679) by hsbt
8
+
9
+ ### Bug fixes:
10
+
11
+ * Unquote Gem.ruby when spawning it as a separate argv element. Pull request [#9695](https://github.com/ruby/rubygems/pull/9695) by hsbt
12
+ * Escape glob metacharacters in install paths when globbing. Pull request [#9687](https://github.com/ruby/rubygems/pull/9687) by hsbt
13
+ * Avoid space-containing absolute path in RUBYOPT. Pull request [#9696](https://github.com/ruby/rubygems/pull/9696) by hsbt
14
+ * Preserve the locked Bundler checksum when the gem isn't cached. Pull request [#9658](https://github.com/ruby/rubygems/pull/9658) by rwstauner
15
+
16
+ ### Documentation:
17
+
18
+ * Point Bundler gemspec metadata at the moved docs. Pull request [#9648](https://github.com/ruby/rubygems/pull/9648) by hsbt
19
+
3
20
  ## 4.0.16 / 2026-07-10
4
21
 
5
22
  ### Enhancements:
@@ -5,7 +5,7 @@ module Bundler
5
5
  module BuildMetadata
6
6
  # begin ivars
7
7
  @built_at = nil
8
- @git_commit_sha = "fc18079dba".freeze
8
+ @git_commit_sha = "f80cbc4c44".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -18,12 +18,22 @@ module Bundler
18
18
  Bundler.ui.info "Unable to open #{name} because it's a default gem, so the directory it would normally be installed to does not exist."
19
19
  else
20
20
  root_path = spec.full_gem_path
21
- require "shellwords"
22
- command = Shellwords.split(editor) << File.join([root_path, path].compact)
21
+ command = editor_command(editor) << File.join([root_path, path].compact)
23
22
  Bundler.with_original_env do
24
23
  system(*command, { chdir: root_path })
25
24
  end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
26
25
  end
27
26
  end
27
+
28
+ def editor_command(editor)
29
+ # On Windows an editor is often configured with a full path such as
30
+ # C:\Program Files\Microsoft VS Code\Code.exe, which shell splitting
31
+ # would corrupt. Take a value that names an existing file as a
32
+ # single word.
33
+ return [editor] if Gem.win_platform? && File.file?(editor)
34
+
35
+ require "shellwords"
36
+ Shellwords.split(editor)
37
+ end
28
38
  end
29
39
  end
@@ -103,7 +103,7 @@ module Bundler
103
103
  # Returns false without appending when no digests since appending is too error prone to do without digests.
104
104
  def append(data)
105
105
  return false unless digests?
106
- open("a") {|f| f.write data }
106
+ open("ab") {|f| f.write data }
107
107
  verify && commit
108
108
  end
109
109
 
@@ -103,17 +103,40 @@ module Bundler
103
103
  end
104
104
 
105
105
  def bundler_checksum
106
+ # `.dev` versions and `SKIP_BUNDLER_CHECKSUM` are deliberate opt-outs (used
107
+ # by Bundler/RubyGems' own development and release tasks): never record a
108
+ # checksum for Bundler itself in those cases.
106
109
  return [] if Bundler.gem_version.to_s.end_with?(".dev") || ENV["SKIP_BUNDLER_CHECKSUM"]
107
110
 
108
111
  bundler_spec = definition.sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
109
- return [] unless File.exist?(bundler_spec.cache_file)
110
112
 
111
- require "rubygems/package"
113
+ # Record a fresh checksum from the locally cached gem when it's available.
114
+ # When it isn't (e.g. a fresh checkout/CI that never downloaded the bundler
115
+ # gem), fall back to whatever checksum is already locked rather than
116
+ # dropping it, so the entry stays consistent across environments.
117
+ if File.exist?(bundler_spec.cache_file)
118
+ require "rubygems/package"
119
+
120
+ package = Gem::Package.new(bundler_spec.cache_file)
121
+ definition.sources.metadata_source.checksum_store.register(bundler_spec, Checksum.from_gem_package(package))
122
+ elsif bundled_with_changing?
123
+ # We can't compute a fresh checksum (the bundler gem isn't cached) and the
124
+ # BUNDLED WITH version is changing. Keeping the previously locked checksum
125
+ # would leave a `bundler (<old version>) sha256=...` entry that no longer
126
+ # matches the new BUNDLED WITH version, so drop it instead.
127
+ return []
128
+ end
112
129
 
113
- package = Gem::Package.new(bundler_spec.cache_file)
114
- definition.sources.metadata_source.checksum_store.register(bundler_spec, Checksum.from_gem_package(package))
130
+ return [] if definition.sources.metadata_source.checksum_store.missing?(bundler_spec)
115
131
 
116
132
  [definition.sources.metadata_source.checksum_store.to_lock(bundler_spec)]
117
133
  end
134
+
135
+ def bundled_with_changing?
136
+ locked_gems = definition.locked_gems
137
+ return false unless locked_gems
138
+
139
+ locked_gems.bundler_version != definition.bundler_version_to_lock
140
+ end
118
141
  end
119
142
  end
@@ -141,7 +141,7 @@ module Bundler
141
141
  end
142
142
  end
143
143
 
144
- Dir[cache_path.join("*/.git")].each do |git_dir|
144
+ Gem::Util.glob_files_in_dir("*/.git", cache_path.to_s).each do |git_dir|
145
145
  FileUtils.rm_rf(git_dir)
146
146
  FileUtils.touch(File.expand_path("../.bundlecache", git_dir))
147
147
  end
@@ -159,13 +159,13 @@ module Bundler
159
159
  end
160
160
 
161
161
  def clean(dry_run = false)
162
- gem_bins = Dir["#{Gem.dir}/bin/*"]
163
- git_dirs = Dir["#{Gem.dir}/bundler/gems/*"]
164
- git_cache_dirs = Dir["#{Gem.dir}/cache/bundler/git/*"]
165
- gem_dirs = Dir["#{Gem.dir}/gems/*"]
166
- gem_files = Dir["#{Gem.dir}/cache/*.gem"]
167
- gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"]
168
- extension_dirs = Dir["#{Gem.dir}/extensions/*/*/*"] + Dir["#{Gem.dir}/bundler/gems/extensions/*/*/*"]
162
+ gem_bins = Gem::Util.glob_files_in_dir("bin/*", Gem.dir)
163
+ git_dirs = Gem::Util.glob_files_in_dir("bundler/gems/*", Gem.dir)
164
+ git_cache_dirs = Gem::Util.glob_files_in_dir("cache/bundler/git/*", Gem.dir)
165
+ gem_dirs = Gem::Util.glob_files_in_dir("gems/*", Gem.dir)
166
+ gem_files = Gem::Util.glob_files_in_dir("cache/*.gem", Gem.dir)
167
+ gemspec_files = Gem::Util.glob_files_in_dir("specifications/*.gemspec", Gem.dir)
168
+ extension_dirs = Gem::Util.glob_files_in_dir("extensions/*/*/*", Gem.dir) + Gem::Util.glob_files_in_dir("bundler/gems/extensions/*/*/*", Gem.dir)
169
169
  spec_gem_paths = []
170
170
  # need to keep git sources around
171
171
  spec_git_paths = @definition.spec_git_paths
@@ -232,7 +232,7 @@ module Bundler
232
232
  private
233
233
 
234
234
  def prune_gem_cache(resolve, cache_path)
235
- cached = Dir["#{cache_path}/*.gem"]
235
+ cached = Gem::Util.glob_files_in_dir("*.gem", cache_path.to_s)
236
236
 
237
237
  cached = cached.delete_if do |path|
238
238
  spec = Bundler.rubygems.spec_from_gem path
@@ -257,7 +257,7 @@ module Bundler
257
257
  end
258
258
 
259
259
  def prune_git_and_path_cache(resolve, cache_path)
260
- cached = Dir["#{cache_path}/*/.bundlecache"]
260
+ cached = Gem::Util.glob_files_in_dir("*/.bundlecache", cache_path.to_s)
261
261
 
262
262
  cached = cached.delete_if do |path|
263
263
  name = File.basename(File.dirname(path))
@@ -283,7 +283,7 @@ module Bundler
283
283
  # Add man/ subdirectories from activated bundles to MANPATH for man(1)
284
284
  manuals = $LOAD_PATH.filter_map do |path|
285
285
  man_subdir = path.sub(/lib$/, "man")
286
- man_subdir unless Dir[man_subdir + "/man?/"].empty?
286
+ man_subdir unless Dir.glob("man?/", base: man_subdir).empty?
287
287
  end
288
288
 
289
289
  return if manuals.empty?
@@ -75,7 +75,12 @@ module Bundler
75
75
 
76
76
  argv0 = File.exist?($PROGRAM_NAME) ? $PROGRAM_NAME : Process.argv0
77
77
  cmd = [argv0, *ARGV]
78
- cmd.unshift(Gem.ruby) unless File.executable?(argv0)
78
+ unless File.executable?(argv0)
79
+ # Gem.ruby is quoted if it contains whitespace, so split it into argv
80
+ # elements to keep the quotes out of the exec'd command.
81
+ require "shellwords"
82
+ cmd.unshift(*Shellwords.split(Gem.ruby))
83
+ end
79
84
 
80
85
  Bundler.with_original_env do
81
86
  Kernel.exec(
@@ -346,7 +346,12 @@ module Bundler
346
346
 
347
347
  def set_rubyopt
348
348
  rubyopt = [ENV["RUBYOPT"]].compact
349
- setup_require = "-r#{File.expand_path("setup", __dir__)}"
349
+ setup_path = File.expand_path("setup", __dir__)
350
+ # RUBYOPT is split on whitespace with no quoting mechanism, so an
351
+ # absolute path containing spaces would be torn apart. Fall back to
352
+ # requiring by feature name; set_rubylib puts our lib directory first
353
+ # on the child's load path.
354
+ setup_require = /\s/.match?(setup_path) ? "-rbundler/setup" : "-r#{setup_path}"
350
355
  return if !rubyopt.empty? && rubyopt.first.include?(setup_require)
351
356
  rubyopt.unshift setup_require
352
357
  Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
@@ -320,7 +320,7 @@ module Bundler
320
320
 
321
321
  def serialize_gemspecs_in(destination)
322
322
  destination = destination.expand_path(Bundler.root) if destination.relative?
323
- Dir["#{destination}/#{@glob}"].each do |spec_path|
323
+ Gem::Util.glob_files_in_dir(@glob, destination.to_s).each do |spec_path|
324
324
  # Evaluate gemspecs and cache the result. Gemspecs
325
325
  # in git might require git or other dependencies.
326
326
  # The gemspecs we cache should already be evaluated.
@@ -406,7 +406,7 @@ module Bundler
406
406
  @cached_specs ||= begin
407
407
  idx = Index.new
408
408
 
409
- Dir["#{cache_path}/*.gem"].each do |gemfile|
409
+ Gem::Util.glob_files_in_dir("*.gem", cache_path.to_s).each do |gemfile|
410
410
  s ||= Bundler.rubygems.spec_from_gem(gemfile)
411
411
  s.source = self
412
412
  idx << s
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "4.0.16".freeze
4
+ VERSION = "4.0.17".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= gem_version.segments.first
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.16
4
+ version: 4.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -401,7 +401,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
401
401
  - !ruby/object:Gem::Version
402
402
  version: 3.4.1
403
403
  requirements: []
404
- rubygems_version: 4.0.13
404
+ rubygems_version: 4.0.16
405
405
  specification_version: 4
406
406
  summary: The best way to manage your application's dependencies
407
407
  test_files: []