bundler 4.0.1 → 4.0.3

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: b33d66a9c2eb47416c1c3a4b32d7e66a4cf1239e8e899783c35f1cafe8eff20e
4
- data.tar.gz: 82936b62cddb391a1b1f84492a6ef1be7ab4520fb6e51eaf1d016b9f33bb89ee
3
+ metadata.gz: 0b538a3abc5f8651616cf8883d701149ee50457172c532fe11e3c5f0849dca2d
4
+ data.tar.gz: 610279b2dd9c3601d1c9cbf64ccd9a536f3ab5f7871a135014156352932b032e
5
5
  SHA512:
6
- metadata.gz: d8795b477c774ce5552d81c222ce0fa363def747cb224394842b0adfd344846b10dc5d9c2cfe5f1aaaa41da787458f949a83fb1726587e8460b8a1ee8750c02f
7
- data.tar.gz: 502655e746eb8ce71d2282c7487a7ccac711e733ddc64984a4980ddeb684668171ac72c3726884a16aea16309fd4d616d1d5b36576ad54b5e0fc737d23344185
6
+ metadata.gz: 12b40ef7ba38861f20330914c5f6473f7bf6396a6cba0bcae2eef51d4e5c48fbfa1ab8f7a3071ca999f4e1d56a424b42b486f12704fe409fc0e4f2362e1f6552
7
+ data.tar.gz: 8e2fa626c039857ab573a7213732d3a40e7de05d813bc3b197b1466d17fa5d835bb2141e7a74a445ba2fc4f6d48cba2a959373681cdc0bc47fa4dcaa184e3c8d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.3 (2025-12-23)
4
+
5
+ ### Enhancements:
6
+
7
+ - Fall back to ruby platform gem when precompiled variant is incompatible [#9211](https://github.com/ruby/rubygems/pull/9211)
8
+
9
+ ## 4.0.2 (2025-12-17)
10
+
11
+ ### Enhancements:
12
+
13
+ - Support single quotes in mise format ruby version [#9183](https://github.com/ruby/rubygems/pull/9183)
14
+ - Tweak the Bundler's "X gems now installed message": [#9194](https://github.com/ruby/rubygems/pull/9194)
15
+
16
+ ### Bug fixes:
17
+
18
+ - Allow to show cli_help with `bundler` executable [#9198](https://github.com/ruby/rubygems/pull/9198)
19
+ - Allow bundle pristine to work for git gems in the same repo [#9196](https://github.com/ruby/rubygems/pull/9196)
20
+
3
21
  ## 4.0.1 (2025-12-09)
4
22
 
5
23
  ### Performance:
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2025-12-09".freeze
8
- @git_commit_sha = "f3e5ebf5af".freeze
7
+ @built_at = "2025-12-23".freeze
8
+ @git_commit_sha = "28c66ecc1e".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -90,7 +90,7 @@ module Bundler
90
90
  end
91
91
 
92
92
  def gems_installed_for(definition)
93
- count = definition.specs.count
93
+ count = definition.specs.count {|spec| spec.name != "bundler" }
94
94
  "#{count} #{count == 1 ? "gem" : "gems"} now installed"
95
95
  end
96
96
 
@@ -11,6 +11,7 @@ module Bundler
11
11
  definition = Bundler.definition
12
12
  definition.validate_runtime!
13
13
  installer = Bundler::Installer.new(Bundler.root, definition)
14
+ git_sources = []
14
15
 
15
16
  ProcessLock.lock do
16
17
  installed_specs = definition.specs.reject do |spec|
@@ -41,6 +42,9 @@ module Bundler
41
42
  end
42
43
  FileUtils.rm_rf spec.extension_dir
43
44
  FileUtils.rm_rf spec.full_gem_path
45
+
46
+ next if git_sources.include?(source)
47
+ git_sources << source
44
48
  else
45
49
  Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is sourced from local path.")
46
50
  next
data/lib/bundler/cli.rb CHANGED
@@ -104,7 +104,7 @@ module Bundler
104
104
  primary_commands = ["install", "update", "cache", "exec", "config", "help"]
105
105
 
106
106
  list = self.class.printable_commands(true)
107
- by_name = list.group_by {|name, _message| name.match(/^bundle (\w+)/)[1] }
107
+ by_name = list.group_by {|name, _message| name.match(/^bundler? (\w+)/)[1] }
108
108
  utilities = by_name.keys.sort - primary_commands
109
109
  primary_commands.map! {|name| (by_name[name] || raise("no primary command #{name}")).first }
110
110
  utilities.map! {|name| by_name[name].first }
@@ -138,24 +138,16 @@ module Bundler
138
138
  source.local!
139
139
 
140
140
  if use_exact_resolved_specifications?
141
- materialize(self) do |matching_specs|
142
- choose_compatible(matching_specs)
143
- end
144
- else
145
- materialize([name, version]) do |matching_specs|
146
- target_platform = source.is_a?(Source::Path) ? platform : Bundler.local_platform
147
-
148
- installable_candidates = MatchPlatform.select_best_platform_match(matching_specs, target_platform)
149
-
150
- specification = choose_compatible(installable_candidates, fallback_to_non_installable: false)
151
- return specification unless specification.nil?
141
+ spec = materialize(self) {|specs| choose_compatible(specs, fallback_to_non_installable: false) }
142
+ return spec if spec
152
143
 
153
- if target_platform != platform
154
- installable_candidates = MatchPlatform.select_best_platform_match(matching_specs, platform)
155
- end
156
-
157
- choose_compatible(installable_candidates)
144
+ # Exact spec is incompatible; in frozen mode, try to find a compatible platform variant
145
+ # In non-frozen mode, return nil to trigger re-resolution and lockfile update
146
+ if Bundler.frozen_bundle?
147
+ materialize([name, version]) {|specs| resolve_best_platform(specs) }
158
148
  end
149
+ else
150
+ materialize([name, version]) {|specs| resolve_best_platform(specs) }
159
151
  end
160
152
  end
161
153
 
@@ -190,6 +182,39 @@ module Bundler
190
182
  !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
191
183
  end
192
184
 
185
+ # Try platforms in order of preference until finding a compatible spec.
186
+ # Used for legacy lockfiles and as a fallback when the exact locked spec
187
+ # is incompatible. Falls back to frozen bundle behavior if none match.
188
+ def resolve_best_platform(specs)
189
+ find_compatible_platform_spec(specs) || frozen_bundle_fallback(specs)
190
+ end
191
+
192
+ def find_compatible_platform_spec(specs)
193
+ candidate_platforms.each do |plat|
194
+ candidates = MatchPlatform.select_best_platform_match(specs, plat)
195
+ spec = choose_compatible(candidates, fallback_to_non_installable: false)
196
+ return spec if spec
197
+ end
198
+ nil
199
+ end
200
+
201
+ # Platforms to try in order of preference. Ruby platform is last since it
202
+ # requires compilation, but works when precompiled gems are incompatible.
203
+ def candidate_platforms
204
+ target = source.is_a?(Source::Path) ? platform : Bundler.local_platform
205
+ [target, platform, Gem::Platform::RUBY].uniq
206
+ end
207
+
208
+ # In frozen mode, accept any candidate. Will error at install time.
209
+ # When target differs from locked platform, prefer locked platform's candidates
210
+ # to preserve lockfile integrity.
211
+ def frozen_bundle_fallback(specs)
212
+ target = source.is_a?(Source::Path) ? platform : Bundler.local_platform
213
+ fallback_platform = target == platform ? target : platform
214
+ candidates = MatchPlatform.select_best_platform_match(specs, fallback_platform)
215
+ choose_compatible(candidates)
216
+ end
217
+
193
218
  def ruby_platform_materializes_to_ruby_platform?
194
219
  generic_platform = Bundler.generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
195
220
 
@@ -42,18 +42,21 @@ module Bundler
42
42
  # Loads the file relative to the dirname of the Gemfile itself.
43
43
  def normalize_ruby_file(filename)
44
44
  file_content = Bundler.read_file(gemfile.dirname.join(filename))
45
- # match "ruby-3.2.2", ruby = "3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
46
- if /^ # Start of line
47
- ruby # Literal "ruby"
48
- [\s-]* # Optional whitespace or hyphens (for "ruby-3.2.2" format)
49
- (?:=\s*)? # Optional equals sign with whitespace (for ruby = "3.2.2" format)
50
- "? # Optional opening quote
51
- ( # Start capturing group
52
- [^\s#"]+ # One or more chars that aren't spaces, #, or quotes
53
- ) # End capturing group
54
- "? # Optional closing quote
55
- /x.match(file_content)
56
- $1
45
+ # match "ruby-3.2.2", ruby = "3.2.2", ruby = '3.2.2' or "ruby 3.2.2" capturing version string up to the first space or comment
46
+ version_match = /^ # Start of line
47
+ ruby # Literal "ruby"
48
+ [\s-]* # Optional whitespace or hyphens (for "ruby-3.2.2" format)
49
+ (?:=\s*)? # Optional equals sign with whitespace (for ruby = "3.2.2" format)
50
+ (?:
51
+ "([^"]+)" # Double quoted version
52
+ |
53
+ '([^']+)' # Single quoted version
54
+ |
55
+ ([^\s#"']+) # Unquoted version
56
+ )
57
+ /x.match(file_content)
58
+ if version_match
59
+ version_match[1] || version_match[2] || version_match[3]
57
60
  else
58
61
  file_content.strip
59
62
  end
@@ -103,6 +103,10 @@ module Bundler
103
103
  end
104
104
  end
105
105
 
106
+ def build_jobs
107
+ Bundler.settings[:jobs] || super
108
+ end
109
+
106
110
  def build_extensions
107
111
  extension_cache_path = options[:bundler_extension_cache_path]
108
112
  extension_dir = spec.extension_dir
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "4.0.1".freeze
4
+ VERSION = "4.0.3".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.1
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko