rubygems-update 3.5.21 → 3.5.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +69 -0
  3. data/bundler/CHANGELOG.md +34 -0
  4. data/bundler/lib/bundler/build_metadata.rb +2 -2
  5. data/bundler/lib/bundler/cli/add.rb +2 -0
  6. data/bundler/lib/bundler/cli/check.rb +2 -2
  7. data/bundler/lib/bundler/cli.rb +1 -0
  8. data/bundler/lib/bundler/definition.rb +10 -16
  9. data/bundler/lib/bundler/dsl.rb +38 -22
  10. data/bundler/lib/bundler/inline.rb +12 -8
  11. data/bundler/lib/bundler/installer.rb +1 -1
  12. data/bundler/lib/bundler/lazy_specification.rb +9 -2
  13. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  14. data/bundler/lib/bundler/man/bundle-add.1 +5 -2
  15. data/bundler/lib/bundler/man/bundle-add.1.ronn +4 -1
  16. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  17. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  18. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  19. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  20. data/bundler/lib/bundler/man/bundle-config.1 +1 -5
  21. data/bundler/lib/bundler/man/bundle-config.1.ronn +0 -7
  22. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  23. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  24. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  25. data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
  26. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  27. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  28. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  29. data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
  30. data/bundler/lib/bundler/man/bundle-install.1 +2 -2
  31. data/bundler/lib/bundler/man/bundle-install.1.ronn +1 -2
  32. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  33. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  34. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  35. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  36. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  39. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  40. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  41. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  42. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  43. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  44. data/bundler/lib/bundler/man/bundle.1 +1 -1
  45. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  46. data/bundler/lib/bundler/plugin/api/source.rb +1 -1
  47. data/bundler/lib/bundler/plugin.rb +20 -1
  48. data/bundler/lib/bundler/process_lock.rb +10 -14
  49. data/bundler/lib/bundler/resolver/base.rb +4 -0
  50. data/bundler/lib/bundler/rubygems_ext.rb +35 -3
  51. data/bundler/lib/bundler/rubygems_gem_installer.rb +3 -1
  52. data/bundler/lib/bundler/rubygems_integration.rb +2 -51
  53. data/bundler/lib/bundler/settings.rb +5 -1
  54. data/bundler/lib/bundler/shared_helpers.rb +27 -15
  55. data/bundler/lib/bundler/source/git.rb +2 -2
  56. data/bundler/lib/bundler/source/metadata.rb +2 -3
  57. data/bundler/lib/bundler/source/path.rb +1 -1
  58. data/bundler/lib/bundler/source/rubygems.rb +1 -4
  59. data/bundler/lib/bundler/stub_specification.rb +11 -0
  60. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +0 -3
  61. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -15
  62. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -4
  63. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +46 -8
  64. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +2 -0
  65. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  66. data/bundler/lib/bundler/version.rb +1 -1
  67. data/bundler/lib/bundler.rb +1 -1
  68. data/lib/rubygems/basic_specification.rb +11 -6
  69. data/lib/rubygems/command_manager.rb +7 -2
  70. data/lib/rubygems/commands/contents_command.rb +15 -8
  71. data/lib/rubygems/commands/pristine_command.rb +16 -6
  72. data/lib/rubygems/commands/setup_command.rb +6 -0
  73. data/lib/rubygems/dependency.rb +1 -1
  74. data/lib/rubygems/gem_runner.rb +9 -0
  75. data/lib/rubygems/gemcutter_utilities.rb +8 -2
  76. data/lib/rubygems/installer.rb +6 -7
  77. data/lib/rubygems/package/tar_header.rb +11 -0
  78. data/lib/rubygems/package/tar_reader/entry.rb +1 -5
  79. data/lib/rubygems/spec_fetcher.rb +35 -7
  80. data/lib/rubygems/specification.rb +2 -2
  81. data/lib/rubygems/specification_record.rb +1 -1
  82. data/lib/rubygems/stub_specification.rb +11 -10
  83. data/lib/rubygems/vendor/net-http/lib/net/http.rb +1 -1
  84. data/lib/rubygems/vendor/uri/lib/uri/common.rb +2 -0
  85. data/lib/rubygems/vendor/uri/lib/uri/version.rb +1 -1
  86. data/lib/rubygems.rb +4 -4
  87. data/rubygems-update.gemspec +1 -1
  88. metadata +3 -3
@@ -136,8 +136,7 @@ automatically and that requires `bundler` to silently remember them. Since
136
136
  This option is deprecated in favor of the `path` setting.
137
137
 
138
138
  * `--quiet`:
139
- Do not print progress information to the standard output. Instead, Bundler
140
- will exit using a status code (`$?`).
139
+ Do not print progress information to the standard output.
141
140
 
142
141
  * `--retry=[<number>]`:
143
142
  Retry failed network or git requests for <number> times.
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-LIST" "1" "September 2024" ""
3
+ .TH "BUNDLE\-LIST" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-list\fR \- List all the gems in the bundle
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-LOCK" "1" "September 2024" ""
3
+ .TH "BUNDLE\-LOCK" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-OPEN" "1" "September 2024" ""
3
+ .TH "BUNDLE\-OPEN" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-OUTDATED" "1" "September 2024" ""
3
+ .TH "BUNDLE\-OUTDATED" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-outdated\fR \- List installed gems with newer versions available
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-PLATFORM" "1" "September 2024" ""
3
+ .TH "BUNDLE\-PLATFORM" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-platform\fR \- Displays platform compatibility information
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-PLUGIN" "1" "September 2024" ""
3
+ .TH "BUNDLE\-PLUGIN" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-plugin\fR \- Manage Bundler plugins
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-PRISTINE" "1" "September 2024" ""
3
+ .TH "BUNDLE\-PRISTINE" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-REMOVE" "1" "September 2024" ""
3
+ .TH "BUNDLE\-REMOVE" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-remove\fR \- Removes gems from the Gemfile
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-SHOW" "1" "September 2024" ""
3
+ .TH "BUNDLE\-SHOW" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-UPDATE" "1" "September 2024" ""
3
+ .TH "BUNDLE\-UPDATE" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-update\fR \- Update your gems to the latest available versions
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-VERSION" "1" "September 2024" ""
3
+ .TH "BUNDLE\-VERSION" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-version\fR \- Prints Bundler version information
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-VIZ" "1" "September 2024" ""
3
+ .TH "BUNDLE\-VIZ" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE" "1" "September 2024" ""
3
+ .TH "BUNDLE" "1" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\fR \- Ruby Dependency Management
6
6
  .SH "SYNOPSIS"
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "GEMFILE" "5" "September 2024" ""
3
+ .TH "GEMFILE" "5" "October 2024" ""
4
4
  .SH "NAME"
5
5
  \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
6
6
  .SH "SYNOPSIS"
@@ -131,7 +131,7 @@ module Bundler
131
131
  Bundler::Index.build do |index|
132
132
  files.each do |file|
133
133
  next unless spec = Bundler.load_gemspec(file)
134
- Bundler.rubygems.set_installed_by_version(spec)
134
+ spec.installed_by_version = Gem::VERSION
135
135
 
136
136
  spec.source = self
137
137
  Bundler.rubygems.validate(spec)
@@ -342,7 +342,26 @@ module Bundler
342
342
  # done to avoid conflicts
343
343
  path = index.plugin_path(name)
344
344
 
345
- Gem.add_to_load_path(*index.load_paths(name))
345
+ paths = index.load_paths(name)
346
+ invalid_paths = paths.reject {|p| File.directory?(p) }
347
+
348
+ if invalid_paths.any?
349
+ Bundler.ui.warn <<~MESSAGE
350
+ The following plugin paths don't exist: #{invalid_paths.join(", ")}.
351
+
352
+ This can happen if the plugin was installed with a different version of Ruby that has since been uninstalled.
353
+
354
+ If you would like to reinstall the plugin, run:
355
+
356
+ bundler plugin uninstall #{name} && bundler plugin install #{name}
357
+
358
+ Continuing without installing plugin #{name}.
359
+ MESSAGE
360
+
361
+ return
362
+ end
363
+
364
+ Gem.add_to_load_path(*paths)
346
365
 
347
366
  load path.join(PLUGIN_FILE_NAME)
348
367
 
@@ -2,23 +2,19 @@
2
2
 
3
3
  module Bundler
4
4
  class ProcessLock
5
- def self.lock(bundle_path = Bundler.bundle_path)
5
+ def self.lock(bundle_path = Bundler.bundle_path, &block)
6
6
  lock_file_path = File.join(bundle_path, "bundler.lock")
7
- has_lock = false
7
+ base_lock_file_path = lock_file_path.delete_suffix(".lock")
8
8
 
9
- File.open(lock_file_path, "w") do |f|
10
- f.flock(File::LOCK_EX)
11
- has_lock = true
12
- yield
13
- f.flock(File::LOCK_UN)
9
+ require "fileutils" if Bundler.rubygems.provides?("< 3.5.23")
10
+
11
+ begin
12
+ SharedHelpers.filesystem_access(lock_file_path, :write) do
13
+ Gem.open_file_with_lock(base_lock_file_path, &block)
14
+ end
15
+ rescue PermissionError
16
+ block.call
14
17
  end
15
- rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP, Errno::EPERM, Errno::EROFS
16
- # In the case the user does not have access to
17
- # create the lock file or is using NFS where
18
- # locks are not available we skip locking.
19
- yield
20
- ensure
21
- FileUtils.rm_f(lock_file_path) if has_lock
22
18
  end
23
19
  end
24
20
  end
@@ -107,6 +107,10 @@ module Bundler
107
107
  def build_base_requirements
108
108
  base_requirements = {}
109
109
  @base.each do |ls|
110
+ if ls.source_changed? && ls.source.specs.search(ls.name).empty?
111
+ raise GemNotFound, "Could not find gem '#{ls.name}' in #{ls.source}"
112
+ end
113
+
110
114
  req = Gem::Requirement.new(ls.version)
111
115
  base_requirements[ls.name] = req
112
116
  end
@@ -36,15 +36,14 @@ module Gem
36
36
  remove_method :open_file_with_flock if Gem.respond_to?(:open_file_with_flock)
37
37
 
38
38
  def open_file_with_flock(path, &block)
39
- mode = IO::RDONLY | IO::APPEND | IO::CREAT | IO::BINARY
39
+ # read-write mode is used rather than read-only in order to support NFS
40
+ mode = IO::RDWR | IO::APPEND | IO::CREAT | IO::BINARY
40
41
  mode |= IO::SHARE_DELETE if IO.const_defined?(:SHARE_DELETE)
41
42
 
42
43
  File.open(path, mode) do |io|
43
44
  begin
44
45
  io.flock(File::LOCK_EX)
45
46
  rescue Errno::ENOSYS, Errno::ENOTSUP
46
- rescue Errno::ENOLCK # NFS
47
- raise unless Thread.main == Thread.current
48
47
  end
49
48
  yield io
50
49
  end
@@ -267,6 +266,16 @@ module Gem
267
266
  end
268
267
  out
269
268
  end
269
+
270
+ if Gem.rubygems_version < Gem::Version.new("3.5.22")
271
+ module FilterIgnoredSpecs
272
+ def matching_specs(platform_only = false)
273
+ super.reject(&:ignored?)
274
+ end
275
+ end
276
+
277
+ prepend FilterIgnoredSpecs
278
+ end
270
279
  end
271
280
 
272
281
  # Requirements using lambda operator differentiate trailing zeros since rubygems 3.2.6
@@ -389,6 +398,15 @@ module Gem
389
398
  end
390
399
  end
391
400
  end
401
+
402
+ # Can be removed once RubyGems 3.5.22 support is dropped
403
+ unless new.respond_to?(:ignored?)
404
+ def ignored?
405
+ return @ignored unless @ignored.nil?
406
+
407
+ @ignored = missing_extensions?
408
+ end
409
+ end
392
410
  end
393
411
 
394
412
  require "rubygems/name_tuple"
@@ -434,4 +452,18 @@ module Gem
434
452
  end
435
453
  end
436
454
  end
455
+
456
+ unless Gem.rubygems_version >= Gem::Version.new("3.5.23")
457
+ class Package; end
458
+ require "rubygems/package/tar_reader"
459
+ require "rubygems/package/tar_reader/entry"
460
+
461
+ module FixFullNameEncoding
462
+ def full_name
463
+ super.force_encoding(Encoding::UTF_8)
464
+ end
465
+ end
466
+
467
+ Package::TarReader::Entry.prepend(FixFullNameEncoding)
468
+ end
437
469
  end
@@ -23,7 +23,9 @@ module Bundler
23
23
  FileUtils.mkdir_p gem_dir, mode: 0o755
24
24
  end
25
25
 
26
- extract_files
26
+ SharedHelpers.filesystem_access(gem_dir, :write) do
27
+ extract_files
28
+ end
27
29
 
28
30
  build_extensions if spec.extensions.any?
29
31
  write_build_info_file
@@ -57,28 +57,6 @@ module Bundler
57
57
  nil
58
58
  end
59
59
 
60
- def set_installed_by_version(spec, installed_by_version = Gem::VERSION)
61
- return unless spec.respond_to?(:installed_by_version=)
62
- spec.installed_by_version = Gem::Version.create(installed_by_version)
63
- end
64
-
65
- def spec_missing_extensions?(spec, default = true)
66
- return spec.missing_extensions? if spec.respond_to?(:missing_extensions?)
67
-
68
- return false if spec.default_gem?
69
- return false if spec.extensions.empty?
70
-
71
- default
72
- end
73
-
74
- def spec_matches_for_glob(spec, glob)
75
- return spec.matches_for_glob(glob) if spec.respond_to?(:matches_for_glob)
76
-
77
- spec.load_paths.flat_map do |lp|
78
- Dir["#{lp}/#{glob}#{suffix_pattern}"]
79
- end
80
- end
81
-
82
60
  def stub_set_spec(stub, spec)
83
61
  stub.instance_variable_set(:@spec, spec)
84
62
  end
@@ -242,9 +220,7 @@ module Bundler
242
220
  end
243
221
  end
244
222
 
245
- # Used to make bin stubs that are not created by bundler work
246
- # under bundler. The new Gem.bin_path only considers gems in
247
- # +specs+
223
+ # Used to give better error messages when activating specs outside of the current bundle
248
224
  def replace_bin_path(specs_by_name)
249
225
  gem_class = (class << Gem; self; end)
250
226
 
@@ -283,31 +259,6 @@ module Bundler
283
259
 
284
260
  spec
285
261
  end
286
-
287
- redefine_method(gem_class, :activate_bin_path) do |name, *args|
288
- exec_name = args.first
289
- return ENV["BUNDLE_BIN_PATH"] if exec_name == "bundle"
290
-
291
- # Copy of Rubygems activate_bin_path impl
292
- requirement = args.last
293
- spec = find_spec_for_exe name, exec_name, [requirement]
294
-
295
- gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
296
- gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name)
297
- File.exist?(gem_bin) ? gem_bin : gem_from_path_bin
298
- end
299
-
300
- redefine_method(gem_class, :bin_path) do |name, *args|
301
- exec_name = args.first
302
- return ENV["BUNDLE_BIN_PATH"] if exec_name == "bundle"
303
-
304
- spec = find_spec_for_exe(name, *args)
305
- exec_name ||= spec.default_executable
306
-
307
- gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
308
- gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name)
309
- File.exist?(gem_bin) ? gem_bin : gem_from_path_bin
310
- end
311
262
  end
312
263
 
313
264
  # Replace or hook into RubyGems to provide a bundlerized view
@@ -324,7 +275,7 @@ module Bundler
324
275
  Gem::BUNDLED_GEMS.replace_require(specs) if Gem::BUNDLED_GEMS.respond_to?(:replace_require)
325
276
  end
326
277
  replace_gem(specs, specs_by_name)
327
- stub_rubygems(specs)
278
+ stub_rubygems(specs_by_name.values)
328
279
  replace_bin_path(specs_by_name)
329
280
 
330
281
  Gem.clear_paths
@@ -425,8 +425,12 @@ module Bundler
425
425
  Validator.validate!(raw_key, converted_value(value, raw_key), hash)
426
426
 
427
427
  return unless file
428
+
429
+ SharedHelpers.filesystem_access(file.dirname, :create) do |p|
430
+ FileUtils.mkdir_p(p)
431
+ end
432
+
428
433
  SharedHelpers.filesystem_access(file) do |p|
429
- FileUtils.mkdir_p(p.dirname)
430
434
  p.open("w") {|f| f.write(serializer_class.dump(hash)) }
431
435
  end
432
436
  end
@@ -96,14 +96,16 @@ module Bundler
96
96
  # given block
97
97
  #
98
98
  # @example
99
- # filesystem_access("vendor/cache", :write) do
99
+ # filesystem_access("vendor/cache", :create) do
100
100
  # FileUtils.mkdir_p("vendor/cache")
101
101
  # end
102
102
  #
103
103
  # @see {Bundler::PermissionError}
104
104
  def filesystem_access(path, action = :write, &block)
105
105
  yield(path.dup)
106
- rescue Errno::EACCES
106
+ rescue Errno::EACCES => e
107
+ raise unless e.message.include?(path.to_s) || action == :create
108
+
107
109
  raise PermissionError.new(path, action)
108
110
  rescue Errno::EAGAIN
109
111
  raise TemporaryResourceError.new(path, action)
@@ -116,7 +118,7 @@ module Bundler
116
118
  rescue Errno::EEXIST, Errno::ENOENT
117
119
  raise
118
120
  rescue SystemCallError => e
119
- raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
121
+ raise GenericSystemCallError.new(e, "There was an error #{[:create, :write].include?(action) ? "creating" : "accessing"} `#{path}`.")
120
122
  end
121
123
 
122
124
  def major_deprecation(major_version, message, removed_message: nil, print_caller_location: false)
@@ -274,15 +276,7 @@ module Bundler
274
276
  until !File.directory?(current) || current == previous
275
277
  if ENV["BUNDLER_SPEC_RUN"]
276
278
  # avoid stepping above the tmp directory when testing
277
- gemspec = if ENV["GEM_COMMAND"]
278
- # for Ruby Core
279
- "lib/bundler/bundler.gemspec"
280
- else
281
- "bundler.gemspec"
282
- end
283
-
284
- # avoid stepping above the tmp directory when testing
285
- return nil if File.file?(File.join(current, gemspec))
279
+ return nil if File.directory?(File.join(current, "tmp"))
286
280
  end
287
281
 
288
282
  names.each do |name|
@@ -314,18 +308,36 @@ module Bundler
314
308
 
315
309
  def bundle_bin_path
316
310
  # bundler exe & lib folders have same root folder, typical gem installation
317
- exe_file = File.expand_path("../../exe/bundle", __dir__)
311
+ exe_file = File.join(source_root, "exe/bundle")
318
312
 
319
313
  # for Ruby core repository testing
320
- exe_file = File.expand_path("../../libexec/bundle", __dir__) unless File.exist?(exe_file)
314
+ exe_file = File.join(source_root, "libexec/bundle") unless File.exist?(exe_file)
321
315
 
322
316
  # bundler is a default gem, exe path is separate
323
- exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)
317
+ exe_file = Gem.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)
324
318
 
325
319
  exe_file
326
320
  end
327
321
  public :bundle_bin_path
328
322
 
323
+ def gemspec_path
324
+ # inside a gem repository, typical gem installation
325
+ gemspec_file = File.join(source_root, "../../specifications/bundler-#{VERSION}.gemspec")
326
+
327
+ # for Ruby core repository testing
328
+ gemspec_file = File.expand_path("bundler.gemspec", __dir__) unless File.exist?(gemspec_file)
329
+
330
+ # bundler is a default gem
331
+ gemspec_file = File.join(Gem.default_specifications_dir, "bundler-#{VERSION}.gemspec") unless File.exist?(gemspec_file)
332
+
333
+ gemspec_file
334
+ end
335
+ public :gemspec_path
336
+
337
+ def source_root
338
+ File.expand_path("../..", __dir__)
339
+ end
340
+
329
341
  def set_path
330
342
  validate_bundle_path
331
343
  paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
@@ -210,7 +210,7 @@ module Bundler
210
210
  checkout
211
211
  end
212
212
 
213
- generate_bin_options = { disable_extensions: !Bundler.rubygems.spec_missing_extensions?(spec), build_args: options[:build_args] }
213
+ generate_bin_options = { disable_extensions: !spec.missing_extensions?, build_args: options[:build_args] }
214
214
  generate_bin(spec, generate_bin_options)
215
215
 
216
216
  requires_checkout? ? spec.post_install_message : nil
@@ -299,7 +299,7 @@ module Bundler
299
299
  # The gemspecs we cache should already be evaluated.
300
300
  spec = Bundler.load_gemspec(spec_path)
301
301
  next unless spec
302
- Bundler.rubygems.set_installed_by_version(spec)
302
+ spec.installed_by_version = Gem::VERSION
303
303
  Bundler.rubygems.validate(spec)
304
304
  File.open(spec_path, "wb") {|file| file.write(spec.to_ruby) }
305
305
  end
@@ -24,9 +24,8 @@ module Bundler
24
24
  s.bindir = "exe"
25
25
  s.homepage = "https://bundler.io"
26
26
  s.summary = "The best way to manage your application's dependencies"
27
- s.executables = %w[bundle]
28
- # can't point to the actual gemspec or else the require paths will be wrong
29
- s.loaded_from = __dir__
27
+ s.executables = %w[bundle bundler]
28
+ s.loaded_from = SharedHelpers.gemspec_path
30
29
  end
31
30
  end
32
31
 
@@ -150,7 +150,7 @@ module Bundler
150
150
 
151
151
  def load_gemspec(file)
152
152
  return unless spec = Bundler.load_gemspec(file)
153
- Bundler.rubygems.set_installed_by_version(spec)
153
+ spec.installed_by_version = Gem::VERSION
154
154
  spec
155
155
  end
156
156
 
@@ -357,10 +357,7 @@ module Bundler
357
357
  @installed_specs ||= Index.build do |idx|
358
358
  Bundler.rubygems.installed_specs.reverse_each do |spec|
359
359
  spec.source = self
360
- if Bundler.rubygems.spec_missing_extensions?(spec, false)
361
- Bundler.ui.debug "Source #{self} is ignoring #{spec} because it is missing extensions"
362
- next
363
- end
360
+ next if spec.ignored?
364
361
  idx << spec
365
362
  end
366
363
  end
@@ -28,6 +28,17 @@ module Bundler
28
28
 
29
29
  # @!group Stub Delegates
30
30
 
31
+ def ignored?
32
+ return @ignored unless @ignored.nil?
33
+
34
+ @ignored = missing_extensions?
35
+ return false unless @ignored
36
+
37
+ warn "Source #{source} is ignoring #{self} because it is missing extensions"
38
+
39
+ true
40
+ end
41
+
31
42
  def manually_installed?
32
43
  # This is for manually installed gems which are gems that were fixed in place after a
33
44
  # failed installation. Once the issue was resolved, the user then manually created
@@ -9,9 +9,6 @@ gem "rake", "~> 13.0"
9
9
  <%- if config[:ext] -%>
10
10
 
11
11
  gem "rake-compiler"
12
- <%- if config[:ext] == 'rust' -%>
13
- gem "rb_sys", "~> 0.9.63"
14
- <%- end -%>
15
12
  <%- end -%>
16
13
  <%- if config[:test] -%>
17
14
 
@@ -17,21 +17,21 @@ jobs:
17
17
  - '<%= RUBY_VERSION %>'
18
18
 
19
19
  steps:
20
- - uses: actions/checkout@v4
20
+ - uses: actions/checkout@v4
21
21
  <%- if config[:ext] == 'rust' -%>
22
- - name: Set up Ruby & Rust
23
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
24
- with:
25
- ruby-version: ${{ matrix.ruby }}
26
- bundler-cache: true
27
- cargo-cache: true
28
- rubygems: '<%= ::Gem.rubygems_version %>'
22
+ - name: Set up Ruby & Rust
23
+ uses: oxidize-rb/actions/setup-ruby-and-rust@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ bundler-cache: true
27
+ cargo-cache: true
28
+ rubygems: '<%= ::Gem.rubygems_version %>'
29
29
  <%- else -%>
30
- - name: Set up Ruby
31
- uses: ruby/setup-ruby@v1
32
- with:
33
- ruby-version: ${{ matrix.ruby }}
34
- bundler-cache: true
30
+ - name: Set up Ruby
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby }}
34
+ bundler-cache: true
35
35
  <%- end -%>
36
- - name: Run the default task
37
- run: bundle exec rake
36
+ - name: Run the default task
37
+ run: bundle exec rake
@@ -37,15 +37,15 @@ Gem::Specification.new do |spec|
37
37
  spec.bindir = "exe"
38
38
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
39
39
  spec.require_paths = ["lib"]
40
- <%- if config[:ext] == 'c' -%>
40
+ <%- if config[:ext] == 'c' || config[:ext] == 'rust' -%>
41
41
  spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"]
42
42
  <%- end -%>
43
- <%- if config[:ext] == 'rust' -%>
44
- spec.extensions = ["ext/<%= config[:underscored_name] %>/Cargo.toml"]
45
- <%- end -%>
46
43
 
47
44
  # Uncomment to register a new dependency of your gem
48
45
  # spec.add_dependency "example-gem", "~> 1.0"
46
+ <%- if config[:ext] == 'rust' -%>
47
+ spec.add_dependency "rb_sys", "~> 0.9.91"
48
+ <%- end -%>
49
49
 
50
50
  # For more information and examples about making a new gem, check out our
51
51
  # guide at: https://bundler.io/guides/creating_gem.html