rubygems-update 4.0.22 → 4.0.24

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -1
  3. data/Manifest.txt +1 -1
  4. data/bundler/CHANGELOG.md +29 -0
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/exec.rb +1 -1
  7. data/bundler/lib/bundler/cli/lock.rb +19 -4
  8. data/bundler/lib/bundler/definition.rb +3 -1
  9. data/bundler/lib/bundler/dsl.rb +6 -2
  10. data/bundler/lib/bundler/fetcher/downloader.rb +9 -3
  11. data/bundler/lib/bundler/fetcher.rb +4 -1
  12. data/bundler/lib/bundler/man/gemfile.5 +2 -0
  13. data/bundler/lib/bundler/man/gemfile.5.ronn +6 -0
  14. data/bundler/lib/bundler/resolver.rb +2 -0
  15. data/bundler/lib/bundler/ruby_dsl.rb +2 -1
  16. data/bundler/lib/bundler/rubygems_ext.rb +15 -4
  17. data/bundler/lib/bundler/source/rubygems.rb +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/lib/rubygems/ext/builder.rb +1 -1
  36. data/lib/rubygems/package.rb +36 -5
  37. data/lib/rubygems/uninstaller.rb +14 -2
  38. data/lib/rubygems/user_interaction.rb +6 -9
  39. data/lib/rubygems/vendor/net-http/lib/net/http/exceptions.rb +2 -1
  40. data/lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb +15 -7
  41. data/lib/rubygems/vendor/net-http/lib/net/http/header.rb +64 -19
  42. data/lib/rubygems/vendor/net-http/lib/net/http/request.rb +1 -0
  43. data/lib/rubygems/vendor/net-http/lib/net/http/requests.rb +74 -25
  44. data/lib/rubygems/vendor/net-http/lib/net/http/response.rb +42 -16
  45. data/lib/rubygems/vendor/net-http/lib/net/http/responses.rb +68 -0
  46. data/lib/rubygems/vendor/net-http/lib/net/http.rb +129 -37
  47. data/lib/rubygems/vendor/net-protocol/COPYING +56 -0
  48. data/lib/rubygems/vendor/net-protocol/lib/net/protocol.rb +95 -26
  49. data/lib/rubygems/vendor/optparse/lib/optparse.rb +23 -30
  50. data/lib/rubygems/vendor/timeout/lib/timeout.rb +190 -77
  51. data/lib/rubygems/vendor/uri/lib/uri/common.rb +1 -1
  52. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +15 -3
  53. data/lib/rubygems/vendor/uri/lib/uri/version.rb +1 -1
  54. data/lib/rubygems.rb +23 -7
  55. metadata +2 -2
  56. 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: 749ce900ad671da4cc10f224bc056fd01abb570ad1ea631796dad9f33025b538
4
- data.tar.gz: 71a19e66013da25a69f73e12f96251f8615463e9f805fbd4be14003ff7f2395a
3
+ metadata.gz: 12a02c6521aff4409e80855dadfcdb2d47008984e7e9b469e4be1d747160a981
4
+ data.tar.gz: 8e53022237b43998ae24f8c8860b6cb10438a4ccc0fb51f95f4e43a449857f57
5
5
  SHA512:
6
- metadata.gz: 0e2f312ea9515fbabdd056db9d9233f8557243c4060cb8ebb15e1394c55624b6d23eaadfd40a512baca8ea70ec1dd1c5e521744d532ce3ef3c256d7e133356ed
7
- data.tar.gz: d961561440e32ad0f6768f2db8a2a73a098df218219c13b3d66dd3b7c013fb7c75fe71ffb8a9ecd52901525e239ef92fb28a897ea317ef337034525029afa070
6
+ metadata.gz: c0efca98d58afb043fcd127dbccdf77d465b555473891fa19214745ce7b0b55312982cd694ac96a7c0b5311df89865fa5a813a990afad52091fb055bc625e9d2
7
+ data.tar.gz: 1100a548b7b270a14f9cea5dbb1cb9d8b71da3991ca501862c32028a2ba1816c9300cbbbe1f66ff89dca5a9bb6dc17fa8fe08e4375ed7e1035da1825542058ed
data/CHANGELOG.md CHANGED
@@ -1,10 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.24 / 2026-11-05
4
+
5
+ ### Enhancements:
6
+
7
+ * Installs bundler 4.0.24 as a default gem.
8
+
9
+ ### Bug fixes:
10
+
11
+ * Skip executable removal gracefully when the bin directory is missing. Pull request [#9963](https://github.com/ruby/rubygems/pull/9963) by Evan Li and Hiroshi SHIBATA
12
+ * Fix file locks letting multiple processes in when lock files are removed. Pull request [#9930](https://github.com/ruby/rubygems/pull/9930) by Richard Janita and Hiroshi SHIBATA
13
+ * Turn off echo before printing the password prompt. Pull request [#9969](https://github.com/ruby/rubygems/pull/9969) by Mike Dalessio
14
+
15
+ ### Documentation:
16
+
17
+ * [DOC] Fix link. Pull request [#10014](https://github.com/ruby/rubygems/pull/10014) by Burdette Lamar
18
+
19
+ ## 4.0.23 / 2026-10-14
20
+
21
+ ### Enhancements:
22
+
23
+ * Update vendored gems to latest versions. Pull request [#9948](https://github.com/ruby/rubygems/pull/9948) by Hiroshi SHIBATA
24
+ * Drop setuid, setgid and sticky bits when extracting gems. Pull request [#9929](https://github.com/ruby/rubygems/pull/9929) by Hiroshi SHIBATA
25
+ * Improve handling of paths with invalid Windows characters. Pull request [#9276](https://github.com/ruby/rubygems/pull/9276) by Said Kaldybaev and Hiroshi SHIBATA
26
+ * Installs bundler 4.0.23 as a default gem.
27
+
3
28
  ## 4.0.22 / 2026-09-30
4
29
 
5
30
  ### Enhancements:
6
31
 
7
- * Add --source option to gem exec command. Pull request [#9765](https://github.com/ruby/rubygems/pull/9765) by Akshay Birajdar and Akshay Birajdar
32
+ * Add --source option to gem exec command. Pull request [#9765](https://github.com/ruby/rubygems/pull/9765) by Akshay Birajdar
8
33
  * Keep credentials on redirects only within the same origin. Pull request [#9909](https://github.com/ruby/rubygems/pull/9909) by Hiroshi SHIBATA
9
34
  * Validate the version field in Gem::Installer#verify_spec. Pull request [#9890](https://github.com/ruby/rubygems/pull/9890) by Hiroshi SHIBATA
10
35
  * Installs bundler 4.0.22 as a default gem.
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,34 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.24 / 2026-11-05
4
+
5
+ ### Enhancements:
6
+
7
+ * Read the Ruby version from mise's inline table form. Pull request [#9991](https://github.com/ruby/rubygems/pull/9991) by Hiroshi SHIBATA
8
+ * Report which locked gems can't be materialized for the current platform. Pull request [#9738](https://github.com/ruby/rubygems/pull/9738) by Muhammad Moussa
9
+
10
+ ### Bug fixes:
11
+
12
+ * Fix `bundle exec` with no arguments for paths containing spaces. Pull request [#9996](https://github.com/ruby/rubygems/pull/9996) by Brandon Weiss
13
+ * Respect enclosing platforms and install_if for gemspec development dependencies. Pull request [#9992](https://github.com/ruby/rubygems/pull/9992) by Hiroshi SHIBATA
14
+ * Respect enclosing group and platforms for gemspec dependencies. Pull request [#9990](https://github.com/ruby/rubygems/pull/9990) by Denis Talakevich
15
+ * Don't report locked gems in the cooldown summary. Pull request [#9981](https://github.com/ruby/rubygems/pull/9981) by Patrik Ragnarsson
16
+ * Make `Bundler::Source::Rubygems#hash` agree with `eql?`. Pull request [#9983](https://github.com/ruby/rubygems/pull/9983) by Hiroshi SHIBATA
17
+ * Add checksums after platform changes in `bundle lock`. Pull request [#9960](https://github.com/ruby/rubygems/pull/9960) by Farid Zakaria
18
+ * Apply BUNDLE_RETRY to lazy gemspec downloads. Pull request [#9868](https://github.com/ruby/rubygems/pull/9868) by Islam Elsayed
19
+ * Fix file locks letting multiple processes in when lock files are removed. Pull request [#9930](https://github.com/ruby/rubygems/pull/9930) by Richard Janita and Hiroshi SHIBATA
20
+
21
+ ## 4.0.23 / 2026-10-14
22
+
23
+ ### Enhancements:
24
+
25
+ * Update vendored gems to latest versions. Pull request [#9948](https://github.com/ruby/rubygems/pull/9948) by Hiroshi SHIBATA
26
+
27
+ ### Bug fixes:
28
+
29
+ * Stop retrying a 416 response to a request without Range. Pull request [#9938](https://github.com/ruby/rubygems/pull/9938) by Hiroshi SHIBATA
30
+ * Respect Gemfile lockfile in `bundle lock`. Pull request [#9661](https://github.com/ruby/rubygems/pull/9661) by David Stosik and Hiroshi SHIBATA
31
+
3
32
  ## 4.0.22 / 2026-09-30
4
33
 
5
34
  ### 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-30".freeze
8
- @git_commit_sha = "ff2bd50".freeze
7
+ @built_at = "2026-11-05".freeze
8
+ @git_commit_sha = "3b396e4".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -24,7 +24,7 @@ module Bundler
24
24
  kernel_load(bin_path, *args)
25
25
  else
26
26
  bin_path = explicit_path(bin_path)
27
- kernel_exec(bin_path, *args)
27
+ kernel_exec([bin_path, bin_path], *args)
28
28
  end
29
29
  else
30
30
  # exec using the given command
@@ -43,7 +43,6 @@ module Bundler
43
43
 
44
44
  Bundler.settings.temporary(frozen: false) do
45
45
  definition = Bundler.definition(update, Bundler.default_lockfile)
46
- definition.add_checksums if options["add-checksums"]
47
46
 
48
47
  Bundler::CLI::Common.configure_gem_version_promoter(definition, options) if options[:update]
49
48
 
@@ -65,6 +64,11 @@ module Bundler
65
64
  raise InvalidOption, "Removing all platforms from the bundle is not allowed"
66
65
  end
67
66
 
67
+ # Adding checksums resolves the bundle to fetch them, so it has to
68
+ # run after every platform change above has been recorded, or the
69
+ # new platforms are listed in the lockfile without their specs.
70
+ definition.add_checksums if options["add-checksums"]
71
+
68
72
  definition.remotely! unless options[:local]
69
73
 
70
74
  if options["normalize-platforms"]
@@ -75,10 +79,21 @@ module Bundler
75
79
  puts definition.to_lock
76
80
  else
77
81
  file = options[:lockfile]
78
- file = file ? Pathname.new(file).expand_path : Bundler.default_lockfile
82
+ file = if file
83
+ Pathname.new(file).expand_path
84
+ elsif ENV["BUNDLE_LOCKFILE"].to_s.empty?
85
+ definition.lockfile
86
+ else
87
+ # BUNDLE_LOCKFILE outranks the lockfile method in the Gemfile, see gemfile(5)
88
+ Bundler.default_lockfile
89
+ end
79
90
 
80
- puts "Writing lockfile to #{file}"
81
- definition.write_lock(file, false)
91
+ if file
92
+ puts "Writing lockfile to #{file}"
93
+ definition.write_lock(file, false)
94
+ else
95
+ Bundler.ui.warn "Not writing a lockfile because the Gemfile sets `lockfile false`"
96
+ end
82
97
  end
83
98
 
84
99
  Bundler::CLI::Common.output_cooldown_skipped_summary(definition)
@@ -748,7 +748,9 @@ module Bundler
748
748
  loop do
749
749
  break if incomplete_specs.empty?
750
750
 
751
- Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
751
+ Bundler.ui.debug("The lockfile does not have all gems needed for the current platform (#{Bundler.local_platform}) though, " \
752
+ "Bundler will still re-resolve dependencies. The following locked gems could not be materialized for it: " \
753
+ "#{incomplete_specs.map(&:full_name).join(", ")}")
752
754
  sources.remote!
753
755
  reresolve_without(incomplete_specs)
754
756
  specs = resolve.materialize(dependencies)
@@ -80,11 +80,15 @@ module Bundler
80
80
  @gemspecs << spec
81
81
 
82
82
  path path, "glob" => glob, "name" => spec.name, "gemspec" => spec do
83
- add_dependency spec.name
83
+ options = {}
84
+ normalize_options(spec.name, [], options)
85
+ add_dependency spec.name, nil, options
84
86
  end
85
87
 
86
88
  spec.development_dependencies.each do |dep|
87
- add_dependency dep.name, dep.requirement.as_list, "gemspec_dev_dep" => true, "group" => development_group
89
+ options = {}
90
+ normalize_options(dep.name, dep.requirement.as_list, options)
91
+ add_dependency dep.name, dep.requirement.as_list, options.merge("gemspec_dev_dep" => true, "group" => development_group)
88
92
  end
89
93
  when 0
90
94
  raise InvalidOption, "There are no gemspecs at #{expanded_path}"
@@ -57,6 +57,8 @@ module Bundler
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
@@ -156,7 +156,10 @@ module Bundler
156
156
  elsif cached_spec_path = gemspec_cached_path(spec_file_name)
157
157
  Bundler.load_gemspec(cached_spec_path)
158
158
  else
159
- Bundler.safe_load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
159
+ body = Bundler::Retry.new("fetcher", FAIL_ERRORS).attempts do
160
+ downloader.fetch(uri).body
161
+ end
162
+ Bundler.safe_load_marshal Bundler.rubygems.inflate(body)
160
163
  end
161
164
  raise MarshalError, "is #{spec.inspect}" unless spec.is_a?(Gem::Specification)
162
165
  spec
@@ -461,6 +461,8 @@ The \fBgemspec\fR method adds any runtime dependencies as gem requirements in th
461
461
  .P
462
462
  The \fBgemspec\fR method supports optional \fB:path\fR, \fB:glob\fR, \fB:name\fR, and \fB:development_group\fR options, which control where bundler looks for the \fB\.gemspec\fR, the glob it uses to look for the gemspec (defaults to: \fB{,*,*/*}\.gemspec\fR), what named \fB\.gemspec\fR it uses (if more than one is present), and which group development dependencies are included in\.
463
463
  .P
464
+ When \fBgemspec\fR is called inside a \fBgroup\fR block, the gem requirement on your project goes into that group instead of the default group, and so do its runtime dependencies\. Development dependencies stay in the \fBdevelopment\fR group, or the group given by \fB:development_group\fR\. An enclosing \fBplatforms\fR or \fBinstall_if\fR block applies to the project and its development dependencies alike\.
465
+ .P
464
466
  When a \fBgemspec\fR dependency encounters version conflicts during resolution, the local version under development will always be selected \-\- even if there are remote versions that better match other requirements for the \fBgemspec\fR gem\.
465
467
  .SH "EVAL_GEMFILE"
466
468
  A Gemfile \fBMAY\fR be split across multiple files\. The \fBeval_gemfile\fR method reads the contents of another file as if they appeared in the current Gemfile\. A relative path is resolved against the directory of the file containing the call\.
@@ -546,6 +546,12 @@ options, which control where bundler looks for the `.gemspec`, the glob it uses
546
546
  for the gemspec (defaults to: `{,*,*/*}.gemspec`), what named `.gemspec` it uses
547
547
  (if more than one is present), and which group development dependencies are included in.
548
548
 
549
+ When `gemspec` is called inside a `group` block, the gem requirement on your
550
+ project goes into that group instead of the default group, and so do its runtime
551
+ dependencies. Development dependencies stay in the `development` group, or the
552
+ group given by `:development_group`. An enclosing `platforms` or `install_if`
553
+ block applies to the project and its development dependencies alike.
554
+
549
555
  When a `gemspec` dependency encounters version conflicts during resolution, the
550
556
  local version under development will always be selected -- even if there are
551
557
  remote versions that better match other requirements for the `gemspec` gem.
@@ -499,6 +499,8 @@ module Bundler
499
499
  @cooldown_skipped_specs.each do |(name, version), spec|
500
500
  resolved = resolved_versions[name]
501
501
  next unless resolved && version > resolved
502
+ package = @base.get_package(name)
503
+ next if !package.unlock? && package.locked_version == resolved
502
504
  next unless requirements[name].all? {|req| req.satisfied_by?(version) }
503
505
  newest = newest_skipped[name]
504
506
  newest_skipped[name] = spec if newest.nil? || version > newest.version
@@ -42,11 +42,12 @@ 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", ruby = '3.2.2' or "ruby 3.2.2" capturing version string up to the first space or comment
45
+ # match "ruby-3.2.2", ruby = "3.2.2", ruby = '3.2.2', ruby = { version = "3.2.2" } or "ruby 3.2.2" capturing version string up to the first space or comment
46
46
  version_match = /^ # Start of line
47
47
  ruby # Literal "ruby"
48
48
  [\s-]* # Optional whitespace or hyphens (for "ruby-3.2.2" format)
49
49
  (?:=\s*)? # Optional equals sign with whitespace (for ruby = "3.2.2" format)
50
+ (?:\{[^}]*?\bversion\s*=\s*)? # Optional inline table up to its version key (for ruby = { version = "3.2.2" } format)
50
51
  (?:
51
52
  "([^"]+)" # Double quoted version
52
53
  |
@@ -40,11 +40,22 @@ module Gem
40
40
  end
41
41
  end
42
42
 
43
- def open_file_with_lock(path, &block)
43
+ def open_file_with_lock(path)
44
44
  file_lock = "#{path}.lock"
45
- open_file_with_flock(file_lock, &block)
46
- ensure
47
- FileUtils.rm_f file_lock
45
+
46
+ loop do
47
+ open_file_with_flock(file_lock) do |io|
48
+ # The previous holder removed the file while we were waiting on it,
49
+ # so leave this block and try again on the file now at the lock path
50
+ next unless File.identical?(io, file_lock)
51
+
52
+ begin
53
+ return yield io
54
+ ensure
55
+ FileUtils.rm_f file_lock
56
+ end
57
+ end
58
+ end
48
59
  end
49
60
  end
50
61
  end
@@ -76,7 +76,7 @@ module Bundler
76
76
  end
77
77
 
78
78
  def hash
79
- @remotes.hash
79
+ credless_remotes.hash
80
80
  end
81
81
 
82
82
  def eql?(other)
@@ -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