rubygems-update 4.0.2 → 4.0.4

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: c9f59269d6d1048c0621c1a5eebf9a11e4bfb2563437a2321ab7ea7cc88112ae
4
- data.tar.gz: cc74dcbadef15de4f55949db6c8260b59a2c32217db792305cbc43f8f9475c2c
3
+ metadata.gz: f46bbce4276140cd482c5f57e651c9e1b5093d0d0d1fa80305a62dd015f13824
4
+ data.tar.gz: ed7311da71b209962ca244fa6b1767ddaf556bb2572b3327825b67e7d68d6dde
5
5
  SHA512:
6
- metadata.gz: dfca31973be9cfacea2aa06e470b47a0c49c4a381c2e5a3fa0cf8ef68bebdb675c62e101cc31bc9c3786fbe3272263792ee77ef13a5869d85fb68e97311d4f91
7
- data.tar.gz: 3da6e226d22a6328348ea79ea704e0c6acb99a1090579707aeacbe1984f823e0c8c02330c1aeb1281c61c4ffef17801325bd6c0061b79fe8502997093b6f9bf8
6
+ metadata.gz: 3be7c427689e3863e1c3e2164758ea267129cdae4ceef0d288d1928bbc686bcb0bb40bf2658da5a6ee7d7699710b7e6d010ccdb731a320ccb8b3ef54b13ca868
7
+ data.tar.gz: ea3b92eb905288d60b330d2a61efe848ef7ebf630ae3dfdafd9f371540854cd0d5f81b2e88eb596f534c6e09d35b154ffa99e0f7e3d57fe7caabe7137445bc1f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.4 / 2026-01-15
4
+
5
+ ### Enhancements:
6
+
7
+ * Remove date require from rebuild command. Pull request
8
+ [#9232](https://github.com/ruby/rubygems/pull/9232) by jeremyevans
9
+ * Installs bundler 4.0.4 as a default gem.
10
+
11
+ ### Bug fixes:
12
+
13
+ * Add a missing "require 'etc'" statement:. Pull request
14
+ [#9242](https://github.com/ruby/rubygems/pull/9242) by Edouard-chin
15
+
16
+ ## 4.0.3 / 2025-12-23
17
+
18
+ ### Enhancements:
19
+
20
+ * Installs bundler 4.0.3 as a default gem.
21
+
22
+ ### Documentation:
23
+
24
+ * Fix broken documentation links. Pull request
25
+ [#9208](https://github.com/ruby/rubygems/pull/9208) by eileencodes
26
+
3
27
  ## 4.0.2 / 2025-12-17
4
28
 
5
29
  ### Enhancements:
data/bundler/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.4 (2026-01-15)
4
+
5
+ ### Enhancements:
6
+
7
+ - Validate more options for add sub-command [#5905](https://github.com/ruby/rubygems/pull/5905)
8
+ - Support Ruby 4.1 [#9219](https://github.com/ruby/rubygems/pull/9219)
9
+
10
+ ### Bug fixes:
11
+
12
+ - Fix dependency source bug in bundler [#9213](https://github.com/ruby/rubygems/pull/9213)
13
+ - Retain current bundler version on `bundle clean` [#9221](https://github.com/ruby/rubygems/pull/9221)
14
+
15
+ ## 4.0.3 (2025-12-23)
16
+
17
+ ### Enhancements:
18
+
19
+ - Fall back to ruby platform gem when precompiled variant is incompatible [#9211](https://github.com/ruby/rubygems/pull/9211)
20
+
3
21
  ## 4.0.2 (2025-12-17)
4
22
 
5
23
  ### Enhancements:
@@ -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-17".freeze
8
- @git_commit_sha = "03359f8b08".freeze
7
+ @built_at = "2026-01-15".freeze
8
+ @git_commit_sha = "49e812f884".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -36,6 +36,16 @@ module Bundler
36
36
  end
37
37
 
38
38
  def validate_options!
39
+ raise InvalidOption, "You cannot specify `--git` and `--github` at the same time." if options["git"] && options["github"]
40
+
41
+ unless options["git"] || options["github"]
42
+ raise InvalidOption, "You cannot specify `--branch` unless `--git` or `--github` is specified." if options["branch"]
43
+
44
+ raise InvalidOption, "You cannot specify `--ref` unless `--git` or `--github` is specified." if options["ref"]
45
+ end
46
+
47
+ raise InvalidOption, "You cannot specify `--branch` and `--ref` at the same time." if options["branch"] && options["ref"]
48
+
39
49
  raise InvalidOption, "You cannot specify `--strict` and `--optimistic` at the same time." if options[:strict] && options[:optimistic]
40
50
 
41
51
  # raise error when no gems are specified
@@ -11,7 +11,7 @@ module Bundler
11
11
  end
12
12
 
13
13
  class CurrentRuby
14
- ALL_RUBY_VERSIONS = [*18..27, *30..34, 40].freeze
14
+ ALL_RUBY_VERSIONS = [*18..27, *30..34, *40..41].freeze
15
15
  KNOWN_MINOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.reverse.join(".") }.freeze
16
16
  KNOWN_MAJOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.last.to_s }.uniq.freeze
17
17
  PLATFORM_MAP = {
@@ -1066,7 +1066,22 @@ module Bundler
1066
1066
 
1067
1067
  deps << dep if !replacement_source || lockfile_source.include?(replacement_source) || new_deps.include?(dep)
1068
1068
  else
1069
- replacement_source = sources.get(lockfile_source)
1069
+ parent_dep = @dependencies.find do |d|
1070
+ next unless d.source && d.source != lockfile_source
1071
+ next if d.source.is_a?(Source::Gemspec)
1072
+
1073
+ parent_locked_specs = @originally_locked_specs[d.name]
1074
+
1075
+ parent_locked_specs.any? do |parent_spec|
1076
+ parent_spec.runtime_dependencies.any? {|rd| rd.name == s.name }
1077
+ end
1078
+ end
1079
+
1080
+ if parent_dep
1081
+ replacement_source = parent_dep.source
1082
+ else
1083
+ replacement_source = sources.get(lockfile_source)
1084
+ end
1070
1085
  end
1071
1086
 
1072
1087
  # Replace the locked dependency's source with the equivalent source from the Gemfile
@@ -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
 
@@ -432,7 +432,7 @@ module Bundler
432
432
  end
433
433
 
434
434
  def find_bundler(version)
435
- find_name("bundler").find {|s| s.version.to_s == version }
435
+ find_name("bundler").find {|s| s.version.to_s == version.to_s }
436
436
  end
437
437
 
438
438
  def find_name(name)
@@ -174,7 +174,14 @@ module Bundler
174
174
  spec_cache_paths = []
175
175
  spec_gemspec_paths = []
176
176
  spec_extension_paths = []
177
- Bundler.rubygems.add_default_gems_to(specs).values.each do |spec|
177
+ specs_to_keep = Bundler.rubygems.add_default_gems_to(specs).values
178
+
179
+ current_bundler = Bundler.rubygems.find_bundler(Bundler.gem_version)
180
+ if current_bundler
181
+ specs_to_keep << current_bundler
182
+ end
183
+
184
+ specs_to_keep.each do |spec|
178
185
  spec_gem_paths << spec.full_gem_path
179
186
  # need to check here in case gems are nested like for the rails git repo
180
187
  md = %r{(.+bundler/gems/.+-[a-f0-9]{7,12})}.match(spec.full_gem_path)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "4.0.2".freeze
4
+ VERSION = "4.0.4".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= gem_version.segments.first
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "date"
4
3
  require "digest"
5
4
  require "fileutils"
6
5
  require "tmpdir"
@@ -943,7 +943,12 @@ class Gem::Installer
943
943
  end
944
944
 
945
945
  def build_jobs
946
- @build_jobs ||= Etc.nprocessors + 1
946
+ @build_jobs ||= begin
947
+ require "etc"
948
+ Etc.nprocessors + 1
949
+ rescue LoadError
950
+ 1
951
+ end
947
952
  end
948
953
 
949
954
  def rb_config
@@ -22,7 +22,7 @@ module Gem
22
22
  def register(target, obj)
23
23
  end
24
24
 
25
- # This is ported over from the yaml_tree in 1.9.3
25
+ # This is ported over from the YAMLTree implementation in Ruby 1.9.3
26
26
  def format_time(time)
27
27
  if time.utc?
28
28
  time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
@@ -38,7 +38,7 @@ class Gem::RequestSet::Lockfile
38
38
  end
39
39
 
40
40
  ##
41
- # Creates a new Lockfile for the given +request_set+ and +gem_deps_file+
41
+ # Creates a new Lockfile for the given Gem::RequestSet and +gem_deps_file+
42
42
  # location.
43
43
 
44
44
  def self.build(request_set, gem_deps_file, dependencies = nil)
@@ -143,7 +143,7 @@ class Gem::Security::Policy
143
143
  end
144
144
 
145
145
  ##
146
- # Ensures the root of +chain+ has a trusted certificate in +trust_dir+ and
146
+ # Ensures the root of +chain+ has a trusted certificate in Gem::Security.trust_dir and
147
147
  # the digests of the two certificates match according to +digester+
148
148
 
149
149
  def check_trust(chain, digester, trust_dir)
@@ -102,7 +102,7 @@ class Gem::Source
102
102
  end
103
103
 
104
104
  ##
105
- # Fetches a specification for the given +name_tuple+.
105
+ # Fetches a specification for the given Gem::NameTuple.
106
106
 
107
107
  def fetch_spec(name_tuple)
108
108
  fetcher = Gem::RemoteFetcher.fetcher
data/lib/rubygems.rb CHANGED
@@ -9,7 +9,7 @@
9
9
  require "rbconfig"
10
10
 
11
11
  module Gem
12
- VERSION = "4.0.2"
12
+ VERSION = "4.0.4"
13
13
  end
14
14
 
15
15
  require_relative "rubygems/defaults"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich