rubygems-update 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: 05d5301cfbc5a49e476ca099643c8958b5a62f3c89307a1b52348427d853fb28
4
- data.tar.gz: aba1853ae1be6dd908d0335103497d6495c245ce0781427eed62d5b659b72b0e
3
+ metadata.gz: 28ee6cf18b2dd8595c173ed33216a3138e827f4a0cf2edabdd1241602d91f322
4
+ data.tar.gz: c0846629675967ffc8194b81f931b35c1bcba82e45c89c99ae3fa77e865ce9d4
5
5
  SHA512:
6
- metadata.gz: db3a9dad410dc490762039bfdb7df7178f5e79e398c9e791eea90334acc5241b4349554cc5e1390d6e003f944e8016569c3d8345c40fe92dce37c508ac3f9d5b
7
- data.tar.gz: c2e116316498b0c86db14e0d2cfd6f3d4e54ea183f6f8cd59904baede6f8d02a7299f9eebe7589886055b312562445fdfddc74f89e72466f65080a3f90c3024a
6
+ metadata.gz: c64d7c5069f669fd15fb3db88ddcc41fb46b427b523b86c628de4156aa256e5af13605b6437698ee012cdd6d336a01f226d79c22ce0f2f78611ef435d2eb7d34
7
+ data.tar.gz: ef84ccf16a33b1c0efc0e68607c06c86996485d69e4c5c61f50b00881932d29b7d028fe6e7fb5201a2ac8bf23c1e2709a6132d1a9e97da61d53526a8ac13dc8b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.3 / 2025-12-23
4
+
5
+ ### Enhancements:
6
+
7
+ * Installs bundler 4.0.3 as a default gem.
8
+
9
+ ### Documentation:
10
+
11
+ * Fix broken documentation links. Pull request
12
+ [#9208](https://github.com/ruby/rubygems/pull/9208) by eileencodes
13
+
14
+ ## 4.0.2 / 2025-12-17
15
+
16
+ ### Enhancements:
17
+
18
+ * Pass down value of `BUNDLE_JOBS` to RubyGems before compiling &
19
+ introduce a new `gem install -j` flag. Pull request
20
+ [#9171](https://github.com/ruby/rubygems/pull/9171) by Edouard-chin
21
+ * Installs bundler 4.0.2 as a default gem.
22
+
3
23
  ## 4.0.1 / 2025-12-09
4
24
 
5
25
  ### Enhancements:
data/bundler/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
@@ -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
@@ -83,6 +83,7 @@ class Gem::DependencyInstaller
83
83
  @user_install = options[:user_install]
84
84
  @wrappers = options[:wrappers]
85
85
  @build_args = options[:build_args]
86
+ @build_jobs = options[:build_jobs]
86
87
  @build_docs_in_background = options[:build_docs_in_background]
87
88
  @dir_mode = options[:dir_mode]
88
89
  @data_mode = options[:data_mode]
@@ -154,6 +155,7 @@ class Gem::DependencyInstaller
154
155
  options = {
155
156
  bin_dir: @bin_dir,
156
157
  build_args: @build_args,
158
+ build_jobs: @build_jobs,
157
159
  document: @document,
158
160
  env_shebang: @env_shebang,
159
161
  force: @force,
@@ -22,7 +22,7 @@ class Gem::Ext::Builder
22
22
  end
23
23
 
24
24
  def self.make(dest_path, results, make_dir = Dir.pwd, sitedir = nil, targets = ["clean", "", "install"],
25
- target_rbconfig: Gem.target_rbconfig)
25
+ target_rbconfig: Gem.target_rbconfig, n_jobs: nil)
26
26
  unless File.exist? File.join(make_dir, "Makefile")
27
27
  # No makefile exists, nothing to do.
28
28
  raise NoMakefileError, "No Makefile found in #{make_dir}"
@@ -34,8 +34,18 @@ class Gem::Ext::Builder
34
34
  make_program_name ||= RUBY_PLATFORM.include?("mswin") ? "nmake" : "make"
35
35
  make_program = shellsplit(make_program_name)
36
36
 
37
+ is_nmake = /\bnmake/i.match?(make_program_name)
37
38
  # The installation of the bundled gems is failed when DESTDIR is empty in mswin platform.
38
- destdir = /\bnmake/i !~ make_program_name || ENV["DESTDIR"] && ENV["DESTDIR"] != "" ? format("DESTDIR=%s", ENV["DESTDIR"]) : ""
39
+ destdir = !is_nmake || ENV["DESTDIR"] && ENV["DESTDIR"] != "" ? format("DESTDIR=%s", ENV["DESTDIR"]) : ""
40
+
41
+ # nmake doesn't support parallel build
42
+ unless is_nmake
43
+ have_make_arguments = make_program.size > 1
44
+
45
+ if !have_make_arguments && !ENV["MAKEFLAGS"] && n_jobs
46
+ make_program << "-j#{n_jobs}"
47
+ end
48
+ end
39
49
 
40
50
  env = [destdir]
41
51
 
@@ -147,11 +157,12 @@ class Gem::Ext::Builder
147
157
  # have build arguments, saved, set +build_args+ which is an ARGV-style
148
158
  # array.
149
159
 
150
- def initialize(spec, build_args = spec.build_args, target_rbconfig = Gem.target_rbconfig)
160
+ def initialize(spec, build_args = spec.build_args, target_rbconfig = Gem.target_rbconfig, build_jobs = nil)
151
161
  @spec = spec
152
162
  @build_args = build_args
153
163
  @gem_dir = spec.full_gem_path
154
164
  @target_rbconfig = target_rbconfig
165
+ @build_jobs = build_jobs
155
166
 
156
167
  @ran_rake = false
157
168
  end
@@ -208,7 +219,7 @@ EOF
208
219
  FileUtils.mkdir_p dest_path
209
220
 
210
221
  results = builder.build(extension, dest_path,
211
- results, @build_args, lib_dir, extension_dir, @target_rbconfig)
222
+ results, @build_args, lib_dir, extension_dir, @target_rbconfig, n_jobs: @build_jobs)
212
223
 
213
224
  verbose { results.join("\n") }
214
225
 
@@ -15,7 +15,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
15
15
  end
16
16
 
17
17
  def build(extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd,
18
- target_rbconfig = Gem.target_rbconfig)
18
+ target_rbconfig = Gem.target_rbconfig, n_jobs: nil)
19
19
  require "tempfile"
20
20
  require "fileutils"
21
21
 
@@ -37,7 +37,7 @@ class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
37
37
  end
38
38
 
39
39
  def build(extension, dest_path, results, args = [], lib_dir = nil, cmake_dir = Dir.pwd,
40
- target_rbconfig = Gem.target_rbconfig)
40
+ target_rbconfig = Gem.target_rbconfig, n_jobs: nil)
41
41
  if target_rbconfig.path
42
42
  warn "--target-rbconfig is not yet supported for CMake extensions. Ignoring"
43
43
  end
@@ -8,7 +8,7 @@
8
8
 
9
9
  class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
10
10
  def self.build(extension, dest_path, results, args = [], lib_dir = nil, configure_dir = Dir.pwd,
11
- target_rbconfig = Gem.target_rbconfig)
11
+ target_rbconfig = Gem.target_rbconfig, n_jobs: nil)
12
12
  if target_rbconfig.path
13
13
  warn "--target-rbconfig is not yet supported for configure-based extensions. Ignoring"
14
14
  end
@@ -19,7 +19,7 @@ class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
19
19
  run cmd, results, class_name, configure_dir
20
20
  end
21
21
 
22
- make dest_path, results, configure_dir, target_rbconfig: target_rbconfig
22
+ make dest_path, results, configure_dir, target_rbconfig: target_rbconfig, n_jobs: n_jobs
23
23
 
24
24
  results
25
25
  end
@@ -8,7 +8,7 @@
8
8
 
9
9
  class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
10
10
  def self.build(extension, dest_path, results, args = [], lib_dir = nil, extension_dir = Dir.pwd,
11
- target_rbconfig = Gem.target_rbconfig)
11
+ target_rbconfig = Gem.target_rbconfig, n_jobs: nil)
12
12
  require "fileutils"
13
13
  require "tempfile"
14
14
 
@@ -40,11 +40,8 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
40
40
  end
41
41
 
42
42
  ENV["DESTDIR"] = nil
43
- unless RUBY_PLATFORM.include?("mswin") && RbConfig::CONFIG["configure_args"]&.include?("nmake")
44
- ENV["MAKEFLAGS"] ||= "-j#{Etc.nprocessors + 1}"
45
- end
46
43
 
47
- make dest_path, results, extension_dir, tmp_dest_relative, target_rbconfig: target_rbconfig
44
+ make dest_path, results, extension_dir, tmp_dest_relative, target_rbconfig: target_rbconfig, n_jobs: n_jobs
48
45
 
49
46
  full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
50
47
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  class Gem::Ext::RakeBuilder < Gem::Ext::Builder
10
10
  def self.build(extension, dest_path, results, args = [], lib_dir = nil, extension_dir = Dir.pwd,
11
- target_rbconfig = Gem.target_rbconfig)
11
+ target_rbconfig = Gem.target_rbconfig, n_jobs: nil)
12
12
  if target_rbconfig.path
13
13
  warn "--target-rbconfig is not yet supported for Rake extensions. Ignoring"
14
14
  end
@@ -31,6 +31,15 @@ module Gem::InstallUpdateOptions
31
31
  options[:bin_dir] = File.expand_path(value)
32
32
  end
33
33
 
34
+ add_option(:"Install/Update", "-j", "--build-jobs VALUE", Integer,
35
+ "Specify the number of jobs to pass to `make` when installing",
36
+ "gems with native extensions.",
37
+ "Defaults to the number of processors.",
38
+ "This option is ignored on the mswin platform or",
39
+ "if the MAKEFLAGS environment variable is set.") do |value, options|
40
+ options[:build_jobs] = value
41
+ end
42
+
34
43
  add_option(:"Install/Update", "--document [TYPES]", Array,
35
44
  "Generate documentation for installed gems",
36
45
  "List the documentation types you wish to",
@@ -635,6 +635,7 @@ class Gem::Installer
635
635
  @build_root = options[:build_root]
636
636
 
637
637
  @build_args = options[:build_args]
638
+ @build_jobs = options[:build_jobs]
638
639
 
639
640
  @gem_home = @install_dir || user_install_dir || Gem.dir
640
641
 
@@ -803,7 +804,7 @@ class Gem::Installer
803
804
  # configure scripts and rakefiles or mkrf_conf files.
804
805
 
805
806
  def build_extensions
806
- builder = Gem::Ext::Builder.new spec, build_args, Gem.target_rbconfig
807
+ builder = Gem::Ext::Builder.new spec, build_args, Gem.target_rbconfig, build_jobs
807
808
 
808
809
  builder.build_extensions
809
810
  end
@@ -941,6 +942,10 @@ class Gem::Installer
941
942
  end
942
943
  end
943
944
 
945
+ def build_jobs
946
+ @build_jobs ||= Etc.nprocessors + 1
947
+ end
948
+
944
949
  def rb_config
945
950
  Gem.target_rbconfig
946
951
  end
@@ -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.1"
12
+ VERSION = "4.0.3"
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.1
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -722,7 +722,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
722
722
  - !ruby/object:Gem::Version
723
723
  version: '0'
724
724
  requirements: []
725
- rubygems_version: 4.0.0
725
+ rubygems_version: 3.6.9
726
726
  specification_version: 4
727
727
  summary: RubyGems is a package management framework for Ruby. This gem is downloaded
728
728
  and installed by `gem update --system`, so that the `gem` CLI can update itself.