rubygems-update 4.0.21 → 4.0.23

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/Manifest.txt +1 -1
  4. data/bundler/CHANGELOG.md +28 -0
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/lock.rb +14 -3
  7. data/bundler/lib/bundler/cli/platform.rb +15 -1
  8. data/bundler/lib/bundler/cli.rb +17 -5
  9. data/bundler/lib/bundler/fetcher/downloader.rb +10 -4
  10. data/bundler/lib/bundler/installer.rb +4 -0
  11. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  12. data/bundler/lib/bundler/man/bundle-lock.1.ronn +1 -1
  13. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  14. data/bundler/lib/bundler/man/bundle-outdated.1.ronn +1 -1
  15. data/bundler/lib/bundler/man/bundle-update.1 +2 -2
  16. data/bundler/lib/bundler/man/bundle-update.1.ronn +2 -2
  17. data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  18. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +14 -4
  19. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  20. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -0
  21. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +54 -29
  22. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +1 -1
  23. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +10 -1
  24. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +12 -6
  25. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +35 -2
  26. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +2 -1
  27. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +14 -6
  28. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +2 -0
  29. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  30. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +34 -1
  31. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +1 -1
  32. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +15 -3
  33. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  34. data/bundler/lib/bundler/version.rb +1 -1
  35. data/bundler/lib/bundler.rb +1 -3
  36. data/lib/rubygems/commands/exec_command.rb +3 -0
  37. data/lib/rubygems/ext/builder.rb +7 -2
  38. data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +9 -0
  39. data/lib/rubygems/installer.rb +4 -0
  40. data/lib/rubygems/package.rb +36 -5
  41. data/lib/rubygems/uninstaller.rb +1 -0
  42. data/lib/rubygems/vendor/net-http/lib/net/http/exceptions.rb +2 -1
  43. data/lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb +15 -7
  44. data/lib/rubygems/vendor/net-http/lib/net/http/header.rb +64 -19
  45. data/lib/rubygems/vendor/net-http/lib/net/http/request.rb +1 -0
  46. data/lib/rubygems/vendor/net-http/lib/net/http/requests.rb +74 -25
  47. data/lib/rubygems/vendor/net-http/lib/net/http/response.rb +42 -16
  48. data/lib/rubygems/vendor/net-http/lib/net/http/responses.rb +68 -0
  49. data/lib/rubygems/vendor/net-http/lib/net/http.rb +129 -37
  50. data/lib/rubygems/vendor/net-protocol/COPYING +56 -0
  51. data/lib/rubygems/vendor/net-protocol/lib/net/protocol.rb +95 -26
  52. data/lib/rubygems/vendor/optparse/lib/optparse.rb +23 -30
  53. data/lib/rubygems/vendor/timeout/lib/timeout.rb +190 -77
  54. data/lib/rubygems/vendor/uri/lib/uri/common.rb +1 -1
  55. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +15 -3
  56. data/lib/rubygems/vendor/uri/lib/uri/version.rb +1 -1
  57. data/lib/rubygems.rb +1 -1
  58. metadata +2 -2
  59. data/lib/rubygems/vendor/net-protocol/LICENSE.txt +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2ba10366f24f2128455224d595b4f144427d183daa7e729fa030baa5145abdf
4
- data.tar.gz: 4e918f6f931c6979330094869a027604f951c0848a66e2677e2fdd5fec8e6453
3
+ metadata.gz: 2260352c2624a3ae9cf0e6097f01885b629db9bc4bb4896e8ba2553ecf18f49d
4
+ data.tar.gz: da371b40f613b3681bcc75cbc9f1a13e4813ee7bfd1f7808ebaf41d76080d8db
5
5
  SHA512:
6
- metadata.gz: f4a911ffd341da70726247e72f242d4c9f8eb2ca4dfe366b0b60628e26f497505ad1e497516c4e1d472a04fd19bf5d67a8a83ad38f9a89b48bf8eca82df077c6
7
- data.tar.gz: 02f63cf60c57dfceb1e49ef7997273d23ffe449de39ade9c2b85f81803e1ed5e092d99fc98569943d8b9c794a60360f9ff3027dda3a055ecc8f78dd380446421
6
+ metadata.gz: 4f7bc18982adcbcf73382c37cea141c266e0d5fd1b2c3814c337fc04cac281f6d774c129312665dafad70fb8aa65e69ba389c8bd7dabd315d5feb8988e9f00ca
7
+ data.tar.gz: 4f4be770ef448f4ab13a3bccf91305148edc604327190c0dccbbdcab3ebf36bb46af49b1b2681e2922b792cb75e7c82301dce04371ef79e840190eb4d6d61670
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.23 / 2026-10-14
4
+
5
+ ### Enhancements:
6
+
7
+ * Update vendored gems to latest versions. Pull request [#9948](https://github.com/ruby/rubygems/pull/9948) by Hiroshi SHIBATA
8
+ * Drop setuid, setgid and sticky bits when extracting gems. Pull request [#9929](https://github.com/ruby/rubygems/pull/9929) by Hiroshi SHIBATA
9
+ * Improve handling of paths with invalid Windows characters. Pull request [#9276](https://github.com/ruby/rubygems/pull/9276) by Said Kaldybaev and Hiroshi SHIBATA
10
+ * Installs bundler 4.0.23 as a default gem.
11
+
12
+ ## 4.0.22 / 2026-09-30
13
+
14
+ ### Enhancements:
15
+
16
+ * Add --source option to gem exec command. Pull request [#9765](https://github.com/ruby/rubygems/pull/9765) by Akshay Birajdar
17
+ * Keep credentials on redirects only within the same origin. Pull request [#9909](https://github.com/ruby/rubygems/pull/9909) by Hiroshi SHIBATA
18
+ * Validate the version field in Gem::Installer#verify_spec. Pull request [#9890](https://github.com/ruby/rubygems/pull/9890) by Hiroshi SHIBATA
19
+ * Installs bundler 4.0.22 as a default gem.
20
+
21
+ ### Bug fixes:
22
+
23
+ * Remove the build_info file on uninstall and stop gem build from logging unknown extensions. Pull request [#9894](https://github.com/ruby/rubygems/pull/9894) by Hiroshi SHIBATA
24
+
3
25
  ## 4.0.21 / 2026-09-16
4
26
 
5
27
  ### Enhancements:
data/Manifest.txt CHANGED
@@ -566,7 +566,7 @@ lib/rubygems/vendor/net-http/lib/net/http/response.rb
566
566
  lib/rubygems/vendor/net-http/lib/net/http/responses.rb
567
567
  lib/rubygems/vendor/net-http/lib/net/http/status.rb
568
568
  lib/rubygems/vendor/net-http/lib/net/https.rb
569
- lib/rubygems/vendor/net-protocol/LICENSE.txt
569
+ lib/rubygems/vendor/net-protocol/COPYING
570
570
  lib/rubygems/vendor/net-protocol/lib/net/protocol.rb
571
571
  lib/rubygems/vendor/optparse/COPYING
572
572
  lib/rubygems/vendor/optparse/lib/optionparser.rb
data/bundler/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.23 / 2026-10-14
4
+
5
+ ### Enhancements:
6
+
7
+ * Update vendored gems to latest versions. Pull request [#9948](https://github.com/ruby/rubygems/pull/9948) by Hiroshi SHIBATA
8
+
9
+ ### Bug fixes:
10
+
11
+ * Stop retrying a 416 response to a request without Range. Pull request [#9938](https://github.com/ruby/rubygems/pull/9938) by Hiroshi SHIBATA
12
+ * Respect Gemfile lockfile in `bundle lock`. Pull request [#9661](https://github.com/ruby/rubygems/pull/9661) by David Stosik and Hiroshi SHIBATA
13
+
14
+ ## 4.0.22 / 2026-09-30
15
+
16
+ ### Enhancements:
17
+
18
+ * Report the effective platform in `bundle platform`. Pull request [#9898](https://github.com/ruby/rubygems/pull/9898) by Islam Elsayed
19
+ * Keep credentials on redirects only within the same origin. Pull request [#9909](https://github.com/ruby/rubygems/pull/9909) by Hiroshi SHIBATA
20
+ * Update Magnus version in Rust extension gem template. Pull request [#9904](https://github.com/ruby/rubygems/pull/9904) by Mat Sadler and Hiroshi SHIBATA
21
+
22
+ ### Bug fixes:
23
+
24
+ * Stop `Bundler.bin_path` creating the directory it reports. Pull request [#9887](https://github.com/ruby/rubygems/pull/9887) by Islam Elsayed and Hiroshi SHIBATA
25
+ * Look up `bundler-<command>` executables only in PATH. Pull request [#9874](https://github.com/ruby/rubygems/pull/9874) by Hiroshi SHIBATA
26
+
27
+ ### Documentation:
28
+
29
+ * Describe `--major` as preferring the latest major version. Pull request [#9891](https://github.com/ruby/rubygems/pull/9891) by Hiroshi SHIBATA
30
+
3
31
  ## 4.0.21 / 2026-09-16
4
32
 
5
33
  ### 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-09-16".freeze
8
- @git_commit_sha = "a15d54ed692".freeze
7
+ @built_at = "2026-10-14".freeze
8
+ @git_commit_sha = "642a23e".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -75,10 +75,21 @@ module Bundler
75
75
  puts definition.to_lock
76
76
  else
77
77
  file = options[:lockfile]
78
- file = file ? Pathname.new(file).expand_path : Bundler.default_lockfile
78
+ file = if file
79
+ Pathname.new(file).expand_path
80
+ elsif ENV["BUNDLE_LOCKFILE"].to_s.empty?
81
+ definition.lockfile
82
+ else
83
+ # BUNDLE_LOCKFILE outranks the lockfile method in the Gemfile, see gemfile(5)
84
+ Bundler.default_lockfile
85
+ end
79
86
 
80
- puts "Writing lockfile to #{file}"
81
- definition.write_lock(file, false)
87
+ if file
88
+ puts "Writing lockfile to #{file}"
89
+ definition.write_lock(file, false)
90
+ else
91
+ Bundler.ui.warn "Not writing a lockfile because the Gemfile sets `lockfile false`"
92
+ end
82
93
  end
83
94
 
84
95
  Bundler::CLI::Common.output_cooldown_skipped_summary(definition)
@@ -25,7 +25,7 @@ module Bundler
25
25
  else
26
26
  platforms = Bundler.definition.platforms.map {|p| "* #{p}" }
27
27
 
28
- output << "Your platform is: #{Gem::Platform.local}"
28
+ output << platform_info
29
29
  output << "Your app has gems that work on these platforms:\n#{platforms.join("\n")}"
30
30
 
31
31
  if ruby_version
@@ -44,5 +44,19 @@ module Bundler
44
44
 
45
45
  Bundler.ui.info output.join("\n\n")
46
46
  end
47
+
48
+ private
49
+
50
+ def platform_info
51
+ info = "Your platform is: #{Gem::Platform.local}"
52
+ return info if Bundler.local_platform == Gem::Platform.local
53
+
54
+ info + "\nHowever, your effective platform is: #{Bundler.local_platform} " \
55
+ "(because force_ruby_platform is #{force_ruby_platform_origin})"
56
+ end
57
+
58
+ def force_ruby_platform_origin
59
+ Bundler.settings.pretty_values_for(:force_ruby_platform).first.sub(/\ASet /, "set ")
60
+ end
47
61
  end
48
62
  end
@@ -177,7 +177,7 @@ module Bundler
177
177
  else
178
178
  puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
179
179
  end
180
- elsif command_path = Bundler.which("bundler-#{cli}")
180
+ elsif command_path = self.class.bundler_command_path(cli)
181
181
  Kernel.exec(command_path, "--help")
182
182
  else
183
183
  super
@@ -189,11 +189,23 @@ module Bundler
189
189
  return Bundler::Plugin.exec_command(command, ARGV[1..-1])
190
190
  end
191
191
 
192
- return super unless command_path = Bundler.which("bundler-#{command}")
192
+ return super unless command_path = bundler_command_path(command)
193
193
 
194
194
  Kernel.exec(command_path, *ARGV[1..-1])
195
195
  end
196
196
 
197
+ # Only PATH is searched, unlike Bundler.which, which also finds a file in
198
+ # the current directory and returns a bare name that Kernel.exec cannot run.
199
+ def self.bundler_command_path(command)
200
+ ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).each do |path|
201
+ path = path[1..-2] if path.start_with?('"') && path.end_with?('"')
202
+ command_path = Bundler.find_executable(File.expand_path("bundler-#{command}", path))
203
+ return command_path if command_path
204
+ end
205
+
206
+ nil
207
+ end
208
+
197
209
  desc "init [OPTIONS]", "Generates a Gemfile into the current working directory"
198
210
  long_desc <<-D
199
211
  Init generates a default Gemfile in the current working directory. When adding a
@@ -320,7 +332,7 @@ module Bundler
320
332
  method_option "bundler", type: :string, lazy_default: ">= #{Bundler::VERSION}", banner: "Update the locked version of bundler"
321
333
  method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
322
334
  method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
323
- method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
335
+ method_option "major", type: :boolean, banner: "Prefer updating to latest major version (default)"
324
336
  method_option "pre", type: :boolean, banner: "Always choose the highest allowed version when updating gems, regardless of prerelease status"
325
337
  method_option "strict", type: :boolean, banner: "Do not allow any gem to be updated past latest --patch | --minor | --major"
326
338
  method_option "conservative", type: :boolean, banner: "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
@@ -431,7 +443,7 @@ module Bundler
431
443
  method_option "filter-strict", type: :boolean, aliases: "--strict", banner: "Only list newer versions allowed by your Gemfile requirements"
432
444
  method_option "update-strict", type: :boolean, banner: "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
433
445
  method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
434
- method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
446
+ method_option "major", type: :boolean, banner: "Prefer updating to latest major version (default)"
435
447
  method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
436
448
  method_option "filter-major", type: :boolean, banner: "Only list major newer versions"
437
449
  method_option "filter-minor", type: :boolean, banner: "Only list minor newer versions"
@@ -638,7 +650,7 @@ module Bundler
638
650
  method_option "normalize-platforms", type: :boolean, default: false, banner: "Normalize lockfile platforms"
639
651
  method_option "patch", type: :boolean, banner: "If updating, prefer updating only to next patch version"
640
652
  method_option "minor", type: :boolean, banner: "If updating, prefer updating only to next minor version"
641
- method_option "major", type: :boolean, banner: "If updating, prefer updating to next major version (default)"
653
+ method_option "major", type: :boolean, banner: "If updating, prefer updating to latest major version (default)"
642
654
  method_option "pre", type: :boolean, banner: "If updating, always choose the highest allowed version, regardless of prerelease status"
643
655
  method_option "strict", type: :boolean, banner: "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
644
656
  method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
@@ -51,12 +51,14 @@ module Bundler
51
51
  if https?(uri) && !https?(new_uri)
52
52
  raise HTTPError, "Redirecting to a non-https URI is not allowed: #{URICredentialsFilter.credential_filtered_uri(new_uri)}"
53
53
  end
54
- if new_uri.host == uri.host
54
+ if [new_uri.scheme, new_uri.host, new_uri.port] == [uri.scheme, uri.host, uri.port]
55
55
  new_uri.user = uri.user
56
56
  new_uri.password = uri.password
57
57
  end
58
58
  fetch(new_uri, headers, counter + 1)
59
59
  when Gem::Net::HTTPRequestedRangeNotSatisfiable
60
+ raise bad_response(response) unless headers.key?("Range")
61
+
60
62
  new_headers = headers.dup
61
63
  new_headers.delete("Range")
62
64
  fetch(uri, new_headers)
@@ -72,9 +74,7 @@ module Bundler
72
74
  when Gem::Net::HTTPNotFound
73
75
  raise FallbackError, "Gem::Net::HTTPNotFound: #{filtered_uri}"
74
76
  else
75
- message = "Gem::#{response.class.name.gsub(/\AGem::/, "")}"
76
- message += ": #{response.body}" unless response.body.empty?
77
- raise HTTPError, message
77
+ raise bad_response(response)
78
78
  end
79
79
  end
80
80
 
@@ -110,6 +110,12 @@ module Bundler
110
110
 
111
111
  private
112
112
 
113
+ def bad_response(response)
114
+ message = "Gem::#{response.class.name.gsub(/\AGem::/, "")}"
115
+ message += ": #{response.body}" unless response.body.empty?
116
+ HTTPError.new(message)
117
+ end
118
+
113
119
  def https?(uri)
114
120
  uri.scheme&.casecmp("https")&.zero?
115
121
  end
@@ -127,6 +127,8 @@ module Bundler
127
127
  template_path = File.expand_path("templates/Executable", __dir__)
128
128
  template = File.read(template_path)
129
129
 
130
+ Bundler.mkdir_p(bin_path)
131
+
130
132
  exists = []
131
133
  spec.executables.each do |executable|
132
134
  binstub_path = "#{bin_path}/#{executable}"
@@ -173,6 +175,8 @@ module Bundler
173
175
  ruby_command = Thor::Util.ruby_command
174
176
  ruby_command = ruby_command
175
177
 
178
+ Bundler.mkdir_p(bin_path)
179
+
176
180
  spec.executables.each do |executable|
177
181
  next if executable == "bundle"
178
182
  executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
@@ -49,7 +49,7 @@ If updating, prefer updating only to next patch version\.
49
49
  If updating, prefer updating only to next minor version\.
50
50
  .TP
51
51
  \fB\-\-major\fR
52
- If updating, prefer updating to next major version (default)\.
52
+ If updating, prefer updating to latest major version (default)\.
53
53
  .TP
54
54
  \fB\-\-pre\fR
55
55
  If updating, always choose the highest allowed version, regardless of prerelease status\.
@@ -75,7 +75,7 @@ Lock the gems specified in Gemfile.
75
75
  If updating, prefer updating only to next minor version.
76
76
 
77
77
  * `--major`:
78
- If updating, prefer updating to next major version (default).
78
+ If updating, prefer updating to latest major version (default).
79
79
 
80
80
  * `--pre`:
81
81
  If updating, always choose the highest allowed version, regardless of prerelease status.
@@ -37,7 +37,7 @@ List gems organized by groups\.
37
37
  Prefer updating only to next minor version\.
38
38
  .TP
39
39
  \fB\-\-major\fR
40
- Prefer updating to next major version (default)\.
40
+ Prefer updating to latest major version (default)\.
41
41
  .TP
42
42
  \fB\-\-patch\fR
43
43
  Prefer updating only to next patch version\.
@@ -55,7 +55,7 @@ are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1.
55
55
  Prefer updating only to next minor version.
56
56
 
57
57
  * `--major`:
58
- Prefer updating to next major version (default).
58
+ Prefer updating to latest major version (default).
59
59
 
60
60
  * `--patch`:
61
61
  Prefer updating only to next patch version.
@@ -54,7 +54,7 @@ Prefer updating only to next patch version\.
54
54
  Prefer updating only to next minor version\.
55
55
  .TP
56
56
  \fB\-\-major\fR
57
- Prefer updating to next major version (default)\.
57
+ Prefer updating to latest major version (default)\.
58
58
  .TP
59
59
  \fB\-\-pre\fR
60
60
  Always choose the highest allowed version, regardless of prerelease status\.
@@ -175,7 +175,7 @@ Prefer updating only to next patch version\.
175
175
  Prefer updating only to next minor version\.
176
176
  .TP
177
177
  \fB\-\-major\fR
178
- Prefer updating to next major version (default)\.
178
+ Prefer updating to latest major version (default)\.
179
179
  .TP
180
180
  \fB\-\-strict\fR
181
181
  Do not allow any gem to be updated past latest \fB\-\-patch\fR | \fB\-\-minor\fR | \fB\-\-major\fR\.
@@ -83,7 +83,7 @@ gem.
83
83
  Prefer updating only to next minor version.
84
84
 
85
85
  * `--major`:
86
- Prefer updating to next major version (default).
86
+ Prefer updating to latest major version (default).
87
87
 
88
88
  * `--pre`:
89
89
  Always choose the highest allowed version, regardless of prerelease status.
@@ -238,7 +238,7 @@ versions are resolved. One of the following options can be used: `--patch`,
238
238
  Prefer updating only to next minor version.
239
239
 
240
240
  * `--major`:
241
- Prefer updating to next major version (default).
241
+ Prefer updating to latest major version (default).
242
242
 
243
243
  * `--strict`:
244
244
  Do not allow any gem to be updated past latest `--patch` | `--minor` | `--major`.
@@ -12,7 +12,7 @@ publish = false
12
12
  crate-type = ["cdylib"]
13
13
 
14
14
  [dependencies]
15
- magnus = { version = "0.8.2" }
15
+ magnus = { version = "0.9" }
16
16
  rb-sys = { version = "0.9", features = ["stable-api-compiled-fallback"] }
17
17
 
18
18
  [build-dependencies]
@@ -54,9 +54,12 @@ class Bundler::ConnectionPool::TimedStack
54
54
  # immediately returned. If no connection is available within the given
55
55
  # timeout a Bundler::ConnectionPool::TimeoutError is raised.
56
56
  #
57
- # +:timeout+ is the only checked entry in +options+ and is preferred over
58
- # the +timeout+ argument (which will be removed in a future release). Other
59
- # options may be used by subclasses that extend TimedStack.
57
+ # @option options [Float] :timeout (0.5) Wait this many seconds for an available entry
58
+ # @option options [Class] :exception (Bundler::ConnectionPool::TimeoutError) Exception class to raise
59
+ # if an entry was not available within the timeout period. Use `exception: false` to return nil.
60
+ #
61
+ # The +timeout+ argument will be removed in 3.0.
62
+ # Other options may be used by subclasses that extend TimedStack.
60
63
  def pop(timeout = 0.5, options = {})
61
64
  options, timeout = timeout, 0.5 if Hash === timeout
62
65
  timeout = options.fetch :timeout, timeout
@@ -73,7 +76,14 @@ class Bundler::ConnectionPool::TimedStack
73
76
  return connection if connection
74
77
 
75
78
  to_wait = deadline - current_time
76
- raise Bundler::ConnectionPool::TimeoutError, "Waited #{timeout} sec, #{length}/#{@max} available" if to_wait <= 0
79
+ if to_wait <= 0
80
+ exc = options.fetch(:exception, Bundler::ConnectionPool::TimeoutError)
81
+ if exc
82
+ raise Bundler::ConnectionPool::TimeoutError, "Waited #{timeout} sec, #{length}/#{@max} available"
83
+ else
84
+ return nil
85
+ end
86
+ end
77
87
  @resource.wait(@mutex, to_wait)
78
88
  end
79
89
  end
@@ -1,3 +1,3 @@
1
1
  class Bundler::ConnectionPool
2
- VERSION = "2.5.4"
2
+ VERSION = "2.5.5"
3
3
  end
@@ -104,6 +104,9 @@ class Bundler::ConnectionPool
104
104
  end
105
105
 
106
106
  def with(options = {})
107
+ # We need to manage exception handling manually here in order
108
+ # to work correctly with `Gem::Timeout.timeout` and `Thread#raise`.
109
+ # Otherwise an interrupted Thread can leak connections.
107
110
  Thread.handle_interrupt(Exception => :never) do
108
111
  conn = checkout(options)
109
112
  begin
@@ -181,7 +181,7 @@ end
181
181
  #
182
182
  module Bundler::FileUtils
183
183
  # The version number.
184
- VERSION = "1.8.0"
184
+ VERSION = "1.8.1"
185
185
 
186
186
  def self.private_module_function(name) #:nodoc:
187
187
  module_function name
@@ -279,38 +279,67 @@ module Bundler::FileUtils
279
279
  end
280
280
  private_module_function :remove_trailing_slash
281
281
 
282
+ # :markup: markdown
282
283
  #
283
- # Creates directories at the paths in the given +list+
284
- # (a single path or an array of paths);
285
- # returns +list+ if it is an array, <tt>[list]</tt> otherwise.
284
+ # call-seq:
285
+ # Bundler::FileUtils.mkdir(*paths, mode: 0775, noop: nil, verbose: nil) -> array_of_paths or nil
286
286
  #
287
- # Argument +list+ or its elements
288
- # should be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments].
287
+ # Argument `paths` may be one path or an array of paths;
288
+ # each must be {interpretable as a path}[rdoc-ref:FileUtils@Path+Arguments].
289
289
  #
290
- # With no keyword arguments, creates a directory at each +path+ in +list+
291
- # by calling: <tt>Dir.mkdir(path, mode)</tt>;
292
- # see {Dir.mkdir}[https://docs.ruby-lang.org/en/master/Dir.html#method-c-mkdir]:
290
+ # By default, creates a directory entry at each of the given `paths`;
291
+ # each directory has permissions `0775`;
292
+ # returns an array of the paths:
293
293
  #
294
- # Bundler::FileUtils.mkdir(%w[tmp0 tmp1]) # => ["tmp0", "tmp1"]
295
- # Bundler::FileUtils.mkdir('tmp4') # => ["tmp4"]
294
+ # ```ruby
295
+ # Bundler::FileUtils.mkdir('foo') # => ["foo"]
296
+ # Bundler::FileUtils.mkdir(%w[bar baz]) # => ["bar", "baz"]
297
+ # File.stat(Dir.new('foo')).mode.to_s(8) # => "40775"
298
+ # File.stat(Dir.new('bar')).mode.to_s(8) # => "40775"
299
+ # File.stat(Dir.new('baz')).mode.to_s(8) # => "40775"
300
+ # Bundler::FileUtils.rmdir(%w[foo bar baz]) # => ["foo", "bar", "baz"]
301
+ # ```
296
302
  #
297
- # Keyword arguments:
303
+ # Raises an exception if for any reason a directory cannot be created;
304
+ # a common reason is that the directory already exists.
298
305
  #
299
- # - <tt>mode: <i>mode</i></tt> - also calls <tt>File.chmod(mode, path)</tt>;
300
- # see {File.chmod}[https://docs.ruby-lang.org/en/master/File.html#method-c-chmod].
301
- # - <tt>noop: true</tt> - does not create directories.
302
- # - <tt>verbose: true</tt> - prints an equivalent command:
306
+ # With keyword argument `mode` given,
307
+ # creates directories with the given permissions:
303
308
  #
304
- # Bundler::FileUtils.mkdir(%w[tmp0 tmp1], verbose: true)
305
- # Bundler::FileUtils.mkdir(%w[tmp2 tmp3], mode: 0700, verbose: true)
309
+ # ```ruby
310
+ # Bundler::FileUtils.mkdir('bar', mode: 0664)
311
+ # File.stat(Dir.new('bar')).mode.to_s(8) # => "40664"
312
+ # Bundler::FileUtils.rmdir('bar')
313
+ # ```
306
314
  #
307
- # Output:
315
+ # With keyword argument `noop` given as `true`,
316
+ # does not create directories;
317
+ # returns `nil`
318
+ #
319
+ # ```ruby
320
+ # Bundler::FileUtils.mkdir('foo', noop: true) # => nil
321
+ # Dir.exist?('foo') # => false
322
+ # ```
323
+ #
324
+ # With keyword argument `verbose` given as `true`,
325
+ # prints a shell command:
308
326
  #
309
- # mkdir tmp0 tmp1
310
- # mkdir -m 700 tmp2 tmp3
327
+ # ```ruby
328
+ # Bundler::FileUtils.mkdir('foo', verbose: true)
329
+ # Bundler::FileUtils.mkdir(%w[bar baz], mode: 0644, verbose: true)
330
+ # Bundler::FileUtils.mkdir(%w[bar baz], mode: 0644, verbose: true, noop: true)
331
+ # ```
311
332
  #
312
- # Raises an exception if any path points to an existing
313
- # file or directory, or if for any reason a directory cannot be created.
333
+ # Output:
334
+ #
335
+ # ```text
336
+ # mkdir foo
337
+ # mkdir -m 644 bar baz
338
+ # mkdir -m 644 bar baz
339
+ # ```
340
+ #
341
+ # Note that in the last call above (containing `noop: true`)
342
+ # the existence of the directory is not checked.
314
343
  #
315
344
  # Related: Bundler::FileUtils.mkdir_p.
316
345
  #
@@ -686,7 +715,7 @@ module Bundler::FileUtils
686
715
  # Keyword arguments:
687
716
  #
688
717
  # - <tt>force: true</tt> - overwrites +dest+ if it exists.
689
- # - <tt>relative: false</tt> - create links relative to +dest+.
718
+ # - <tt>relative: true</tt> - create links relative to +dest+.
690
719
  # - <tt>noop: true</tt> - does not create links.
691
720
  # - <tt>verbose: true</tt> - prints an equivalent command:
692
721
  #
@@ -754,7 +783,7 @@ module Bundler::FileUtils
754
783
  n = real_ddirs.size - i
755
784
  n -= 1 unless target_directory
756
785
  link2 = fu_clean_components(*Array.new([n, 0].max, '..'), *real_sdirs[i..-1])
757
- link1 = link2 if link1.size > link2.size
786
+ link1 = link2 if !link2.empty? and link1.size > link2.size
758
787
  end
759
788
  s = File.join(link1)
760
789
  fu_output_message [cmd, s, d].flatten.join(' ') if verbose
@@ -2037,10 +2066,6 @@ module Bundler::FileUtils
2037
2066
  def fu_windows?; false end #:nodoc:
2038
2067
  end
2039
2068
 
2040
- def fu_copy_stream0(src, dest, blksize = nil) #:nodoc:
2041
- IO.copy_stream(src, dest)
2042
- end
2043
-
2044
2069
  def fu_stream_blksize(*streams) #:nodoc:
2045
2070
  streams.each do |s|
2046
2071
  next unless s.respond_to?(:stat)
@@ -4,7 +4,7 @@ class Gem::Net::HTTP::Persistent::Pool < Bundler::ConnectionPool # :nodoc:
4
4
  attr_reader :key # :nodoc:
5
5
 
6
6
  def initialize(options = {}, &block)
7
- super
7
+ super(**options, &block)
8
8
 
9
9
  @available = Gem::Net::HTTP::Persistent::TimedStackMulti.new(@size, &block)
10
10
  @key = "current-#{@available.object_id}"
@@ -1,5 +1,10 @@
1
1
  class Gem::Net::HTTP::Persistent::TimedStackMulti < Bundler::ConnectionPool::TimedStack # :nodoc:
2
2
 
3
+ ##
4
+ # Detects if Bundler::ConnectionPool 3.0+ is being used (needed for TimedStack subclass compatibility)
5
+
6
+ CP_USES_KEYWORD_ARGS = Gem::Version.new(Bundler::ConnectionPool::VERSION) >= Gem::Version.new('3.0.0') # :nodoc:
7
+
3
8
  ##
4
9
  # Returns a new hash that has arrays for keys
5
10
  #
@@ -11,7 +16,11 @@ class Gem::Net::HTTP::Persistent::TimedStackMulti < Bundler::ConnectionPool::Tim
11
16
  end
12
17
 
13
18
  def initialize(size = 0, &block)
14
- super
19
+ if CP_USES_KEYWORD_ARGS
20
+ super(size: size, &block)
21
+ else
22
+ super(size, &block)
23
+ end
15
24
 
16
25
  @enqueued = 0
17
26
  @ques = self.class.hash_of_arrays
@@ -1,10 +1,7 @@
1
1
  require_relative '../../../../../vendored_net_http'
2
2
  require_relative '../../../../../vendored_uri'
3
- begin
4
- require 'cgi/escape'
5
- rescue LoadError
6
- require 'cgi/util' # for escaping
7
- end
3
+ require 'cgi/escape'
4
+ require 'cgi/util' unless defined?(CGI::EscapeExt)
8
5
  require_relative '../../../../connection_pool/lib/connection_pool'
9
6
 
10
7
  autoload :OpenSSL, 'openssl'
@@ -180,7 +177,7 @@ class Gem::Net::HTTP::Persistent
180
177
  ##
181
178
  # The version of Gem::Net::HTTP::Persistent you are using
182
179
 
183
- VERSION = '4.0.6'
180
+ VERSION = '4.0.8'
184
181
 
185
182
  ##
186
183
  # Error class for errors raised by Gem::Net::HTTP::Persistent. Various
@@ -475,6 +472,13 @@ class Gem::Net::HTTP::Persistent
475
472
 
476
473
  attr_reader :verify_hostname
477
474
 
475
+
476
+ ##
477
+ # Sets whether to ignore end-of-file when reading a response body
478
+ # with Content-Length headers.
479
+
480
+ attr_accessor :ignore_eof
481
+
478
482
  ##
479
483
  # Creates a new Gem::Net::HTTP::Persistent.
480
484
  #
@@ -514,6 +518,7 @@ class Gem::Net::HTTP::Persistent
514
518
  @max_retries = 1
515
519
  @socket_options = []
516
520
  @ssl_generation = 0 # incremented when SSL session variables change
521
+ @ignore_eof = nil
517
522
 
518
523
  @socket_options << [Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1] if
519
524
  Socket.const_defined? :TCP_NODELAY
@@ -642,6 +647,7 @@ class Gem::Net::HTTP::Persistent
642
647
  reset connection
643
648
  end
644
649
 
650
+ http.ignore_eof = @ignore_eof if @ignore_eof
645
651
  http.keep_alive_timeout = @idle_timeout if @idle_timeout
646
652
  http.max_retries = @max_retries if http.respond_to?(:max_retries=)
647
653
  http.read_timeout = @read_timeout if @read_timeout