rubygems-update 4.0.4 → 4.0.5

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: f46bbce4276140cd482c5f57e651c9e1b5093d0d0d1fa80305a62dd015f13824
4
- data.tar.gz: ed7311da71b209962ca244fa6b1767ddaf556bb2572b3327825b67e7d68d6dde
3
+ metadata.gz: d730c5ee36ec22bfd59911344435184146b89ae65ead9e33cdfa762498831a6f
4
+ data.tar.gz: ac09d3a9681fc79ebb9f08de62c3ed253f60718b397ac3819d1c91921886c4db
5
5
  SHA512:
6
- metadata.gz: 3be7c427689e3863e1c3e2164758ea267129cdae4ceef0d288d1928bbc686bcb0bb40bf2658da5a6ee7d7699710b7e6d010ccdb731a320ccb8b3ef54b13ca868
7
- data.tar.gz: ea3b92eb905288d60b330d2a61efe848ef7ebf630ae3dfdafd9f371540854cd0d5f81b2e88eb596f534c6e09d35b154ffa99e0f7e3d57fe7caabe7137445bc1f
6
+ metadata.gz: 8a6c42c73197f1b496bab3932994638de281ac6006d4500244dfa2ee4c8eb3db4d095043128b4e596611717ba35fde5675276c7a73f5a6127844671d579d8e1f
7
+ data.tar.gz: 500d5d9e6100937d95dd9ea517b01d28c5ef58bf584a6a333bfd82fb085a9396867a5fdd504a622cfb58bd2a7e9b452ab36a39564c8343c5748e0a70e4b61441
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.5 / 2026-01-29
4
+
5
+ ### Enhancements:
6
+
7
+ * Removed unused deprecate loading. Pull request
8
+ [#9266](https://github.com/ruby/rubygems/pull/9266) by hsbt
9
+ * Validate executable names for invalid characters. Pull request
10
+ [#9257](https://github.com/ruby/rubygems/pull/9257) by hsbt
11
+ * Installs bundler 4.0.5 as a default gem.
12
+
13
+ ### Bug fixes:
14
+
15
+ * Fix RubyGems not able to require the right gem:. Pull request
16
+ [#9246](https://github.com/ruby/rubygems/pull/9246) by Edouard-chin
17
+ * Remove special behavior for rake. Pull request
18
+ [#9245](https://github.com/ruby/rubygems/pull/9245) by JasonLunn
19
+
20
+ ### Documentation:
21
+
22
+ * Added another usage of pristine command. Pull request
23
+ [#9255](https://github.com/ruby/rubygems/pull/9255) by hsbt
24
+
3
25
  ## 4.0.4 / 2026-01-15
4
26
 
5
27
  ### Enhancements:
data/bundler/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.5 (2026-01-29)
4
+
5
+ ### Enhancements:
6
+
7
+ - Fix Bundler that re-exec $0 when a `version` is present in the config: [#9249](https://github.com/ruby/rubygems/pull/9249)
8
+
9
+ ### Bug fixes:
10
+
11
+ - Only use parent source with Git and Path sources [#9269](https://github.com/ruby/rubygems/pull/9269)
12
+
3
13
  ## 4.0.4 (2026-01-15)
4
14
 
5
15
  ### 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 = "2026-01-15".freeze
8
- @git_commit_sha = "49e812f884".freeze
7
+ @built_at = "2026-01-29".freeze
8
+ @git_commit_sha = "6d11c1f49d".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -1077,7 +1077,7 @@ module Bundler
1077
1077
  end
1078
1078
  end
1079
1079
 
1080
- if parent_dep
1080
+ if parent_dep && parent_dep.source.is_a?(Source::Path)
1081
1081
  replacement_source = parent_dep.source
1082
1082
  else
1083
1083
  replacement_source = sources.get(lockfile_source)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "4.0.4".freeze
4
+ VERSION = "4.0.5".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= gem_version.segments.first
@@ -10,6 +10,8 @@ module Gem::BundlerVersionFinder
10
10
  v ||= bundle_update_bundler_version
11
11
  return if v == true
12
12
 
13
+ v ||= bundle_config_version
14
+
13
15
  v ||= lockfile_version
14
16
  return unless v
15
17
 
@@ -49,21 +51,7 @@ module Gem::BundlerVersionFinder
49
51
  private_class_method :lockfile_version
50
52
 
51
53
  def self.lockfile_contents
52
- gemfile = ENV["BUNDLE_GEMFILE"]
53
- gemfile = nil if gemfile&.empty?
54
-
55
- unless gemfile
56
- begin
57
- Gem::Util.traverse_parents(Dir.pwd) do |directory|
58
- next unless gemfile = Gem::GEM_DEP_FILES.find {|f| File.file?(f) }
59
-
60
- gemfile = File.join directory, gemfile
61
- break
62
- end
63
- rescue Errno::ENOENT
64
- return
65
- end
66
- end
54
+ gemfile = gemfile_path
67
55
 
68
56
  return unless gemfile
69
57
 
@@ -82,19 +70,24 @@ module Gem::BundlerVersionFinder
82
70
  private_class_method :lockfile_contents
83
71
 
84
72
  def self.bundle_config_version
85
- config_file = bundler_config_file
86
- return unless config_file && File.file?(config_file)
73
+ version = nil
87
74
 
88
- contents = File.read(config_file)
89
- contents =~ /^BUNDLE_VERSION:\s*["']?([^"'\s]+)["']?\s*$/
75
+ [bundler_local_config_file, bundler_global_config_file].each do |config_file|
76
+ next unless config_file && File.file?(config_file)
90
77
 
91
- $1
78
+ contents = File.read(config_file)
79
+ contents =~ /^BUNDLE_VERSION:\s*["']?([^"'\s]+)["']?\s*$/
80
+
81
+ version = $1
82
+ break if version
83
+ end
84
+
85
+ version
92
86
  end
93
87
  private_class_method :bundle_config_version
94
88
 
95
- def self.bundler_config_file
96
- # see Bundler::Settings#global_config_file and local_config_file
97
- # global
89
+ def self.bundler_global_config_file
90
+ # see Bundler::Settings#global_config_file
98
91
  if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
99
92
  ENV["BUNDLE_CONFIG"]
100
93
  elsif ENV["BUNDLE_USER_CONFIG"] && !ENV["BUNDLE_USER_CONFIG"].empty?
@@ -103,10 +96,36 @@ module Gem::BundlerVersionFinder
103
96
  ENV["BUNDLE_USER_HOME"] + "config"
104
97
  elsif Gem.user_home && !Gem.user_home.empty?
105
98
  Gem.user_home + ".bundle/config"
106
- else
107
- # local
108
- "config"
109
99
  end
110
100
  end
111
- private_class_method :bundler_config_file
101
+ private_class_method :bundler_global_config_file
102
+
103
+ def self.bundler_local_config_file
104
+ gemfile = gemfile_path
105
+ return unless gemfile
106
+
107
+ File.join(File.dirname(gemfile), ".bundle", "config")
108
+ end
109
+ private_class_method :bundler_local_config_file
110
+
111
+ def self.gemfile_path
112
+ gemfile = ENV["BUNDLE_GEMFILE"]
113
+ gemfile = nil if gemfile&.empty?
114
+
115
+ unless gemfile
116
+ begin
117
+ Gem::Util.traverse_parents(Dir.pwd) do |directory|
118
+ next unless gemfile = Gem::GEM_DEP_FILES.find {|f| File.file?(f) }
119
+
120
+ gemfile = File.join directory, gemfile
121
+ break
122
+ end
123
+ rescue Errno::ENOENT
124
+ return
125
+ end
126
+ end
127
+
128
+ gemfile
129
+ end
130
+ private_class_method :gemfile_path
112
131
  end
@@ -88,6 +88,10 @@ If you have made modifications to an installed gem, the pristine command
88
88
  will revert them. All extensions are rebuilt and all bin stubs for the gem
89
89
  are regenerated after checking for modifications.
90
90
 
91
+ Rebuilding extensions also refreshes C-extension gems against updated system
92
+ libraries (for example after OS or package upgrades) to avoid mismatches like
93
+ outdated library version warnings.
94
+
91
95
  If the cached gem cannot be found it will be downloaded.
92
96
 
93
97
  If --no-extensions is provided pristine will not attempt to restore a gem
@@ -163,8 +163,6 @@ class Gem::Ext::Builder
163
163
  @gem_dir = spec.full_gem_path
164
164
  @target_rbconfig = target_rbconfig
165
165
  @build_jobs = build_jobs
166
-
167
- @ran_rake = false
168
166
  end
169
167
 
170
168
  ##
@@ -177,7 +175,6 @@ class Gem::Ext::Builder
177
175
  when /configure/ then
178
176
  Gem::Ext::ConfigureBuilder
179
177
  when /rakefile/i, /mkrf_conf/i then
180
- @ran_rake = true
181
178
  Gem::Ext::RakeBuilder
182
179
  when /CMakeLists.txt/ then
183
180
  Gem::Ext::CmakeBuilder.new
@@ -250,8 +247,6 @@ EOF
250
247
  FileUtils.rm_f @spec.gem_build_complete_path
251
248
 
252
249
  @spec.extensions.each do |extension|
253
- break if @ran_rake
254
-
255
250
  build_extension extension, dest_path
256
251
  end
257
252
 
@@ -959,6 +959,15 @@ class Gem::Specification < Gem::BasicSpecification
959
959
  specification_record.find_by_path(path)
960
960
  end
961
961
 
962
+ ##
963
+ # Return the best specification that contains the file matching +path+
964
+ # amongst the specs that are not loaded. This method is different than
965
+ # +find_inactive_by_path+ as it will filter out loaded specs by their name.
966
+
967
+ def self.find_unloaded_by_path(path)
968
+ specification_record.find_unloaded_by_path(path)
969
+ end
970
+
962
971
  ##
963
972
  # Return the best specification that contains the file matching +path+
964
973
  # amongst the specs that are not activated.
@@ -436,6 +436,7 @@ or set it to nil if you don't want to specify a license.
436
436
  warning "deprecated autorequire specified" if @specification.autorequire
437
437
 
438
438
  @specification.executables.each do |executable|
439
+ validate_executable(executable)
439
440
  validate_shebang_line_in(executable)
440
441
  end
441
442
 
@@ -449,6 +450,13 @@ or set it to nil if you don't want to specify a license.
449
450
  warning("no #{attribute} specified") if value.nil? || value.empty?
450
451
  end
451
452
 
453
+ def validate_executable(executable)
454
+ separators = [File::SEPARATOR, File::ALT_SEPARATOR, File::PATH_SEPARATOR].compact.map {|sep| Regexp.escape(sep) }.join
455
+ return unless executable.match?(/[\s#{separators}]/)
456
+
457
+ error "executable \"#{executable}\" contains invalid characters"
458
+ end
459
+
452
460
  def validate_shebang_line_in(executable)
453
461
  executable_path = File.join(@specification.bindir, executable)
454
462
  return if File.read(executable_path, 2) == "#!"
@@ -154,6 +154,19 @@ module Gem
154
154
  spec.to_spec
155
155
  end
156
156
 
157
+ ##
158
+ # Return the best specification that contains the file matching +path+
159
+ # amongst the specs that are not loaded. This method is different than
160
+ # +find_inactive_by_path+ as it will filter out loaded specs by their name.
161
+
162
+ def find_unloaded_by_path(path)
163
+ stub = stubs.find do |s|
164
+ next if Gem.loaded_specs[s.name]
165
+ s.contains_requirable_file? path
166
+ end
167
+ stub&.to_spec
168
+ end
169
+
157
170
  ##
158
171
  # Return the best specification in the record that contains the file
159
172
  # matching +path+ amongst the specs that are not activated.
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "deprecate"
4
-
5
3
  ##
6
4
  # The Version class processes string versions into comparable
7
5
  # values. A version string should normally be a series of numbers
@@ -152,6 +150,9 @@ require_relative "deprecate"
152
150
  # For the last example, single-digit versions are automatically extended with
153
151
  # a zero to give a sensible result.
154
152
 
153
+ # Workaround for directly loading Gem::Version in some cases
154
+ module Gem; end
155
+
155
156
  class Gem::Version
156
157
  include Comparable
157
158
 
data/lib/rubygems.rb CHANGED
@@ -9,7 +9,7 @@
9
9
  require "rbconfig"
10
10
 
11
11
  module Gem
12
- VERSION = "4.0.4"
12
+ VERSION = "4.0.5"
13
13
  end
14
14
 
15
15
  require_relative "rubygems/defaults"
@@ -192,11 +192,12 @@ module Gem
192
192
  begin
193
193
  spec.activate
194
194
  rescue Gem::LoadError => e # this could fail due to gem dep collisions, go lax
195
- spec_by_name = Gem::Specification.find_by_name(spec.name)
196
- if spec_by_name.nil?
195
+ spec = Gem::Specification.find_unloaded_by_path(path)
196
+ spec ||= Gem::Specification.find_by_name(spec.name)
197
+ if spec.nil?
197
198
  raise e
198
199
  else
199
- spec_by_name.activate
200
+ spec.activate
200
201
  end
201
202
  end
202
203
 
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.4
4
+ version: 4.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich