rubygems-update 4.0.1 → 4.0.2

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: c9f59269d6d1048c0621c1a5eebf9a11e4bfb2563437a2321ab7ea7cc88112ae
4
+ data.tar.gz: cc74dcbadef15de4f55949db6c8260b59a2c32217db792305cbc43f8f9475c2c
5
5
  SHA512:
6
- metadata.gz: db3a9dad410dc490762039bfdb7df7178f5e79e398c9e791eea90334acc5241b4349554cc5e1390d6e003f944e8016569c3d8345c40fe92dce37c508ac3f9d5b
7
- data.tar.gz: c2e116316498b0c86db14e0d2cfd6f3d4e54ea183f6f8cd59904baede6f8d02a7299f9eebe7589886055b312562445fdfddc74f89e72466f65080a3f90c3024a
6
+ metadata.gz: dfca31973be9cfacea2aa06e470b47a0c49c4a381c2e5a3fa0cf8ef68bebdb675c62e101cc31bc9c3786fbe3272263792ee77ef13a5869d85fb68e97311d4f91
7
+ data.tar.gz: 3da6e226d22a6328348ea79ea704e0c6acb99a1090579707aeacbe1984f823e0c8c02330c1aeb1281c61c4ffef17801325bd6c0061b79fe8502997093b6f9bf8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.2 / 2025-12-17
4
+
5
+ ### Enhancements:
6
+
7
+ * Pass down value of `BUNDLE_JOBS` to RubyGems before compiling &
8
+ introduce a new `gem install -j` flag. Pull request
9
+ [#9171](https://github.com/ruby/rubygems/pull/9171) by Edouard-chin
10
+ * Installs bundler 4.0.2 as a default gem.
11
+
3
12
  ## 4.0.1 / 2025-12-09
4
13
 
5
14
  ### Enhancements:
data/bundler/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.2 (2025-12-17)
4
+
5
+ ### Enhancements:
6
+
7
+ - Support single quotes in mise format ruby version [#9183](https://github.com/ruby/rubygems/pull/9183)
8
+ - Tweak the Bundler's "X gems now installed message": [#9194](https://github.com/ruby/rubygems/pull/9194)
9
+
10
+ ### Bug fixes:
11
+
12
+ - Allow to show cli_help with `bundler` executable [#9198](https://github.com/ruby/rubygems/pull/9198)
13
+ - Allow bundle pristine to work for git gems in the same repo [#9196](https://github.com/ruby/rubygems/pull/9196)
14
+
3
15
  ## 4.0.1 (2025-12-09)
4
16
 
5
17
  ### 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-17".freeze
8
+ @git_commit_sha = "03359f8b08".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 }
@@ -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.2".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
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.2"
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.2
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.