rubygems-update 4.0.22 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/Manifest.txt +1 -1
- data/bundler/CHANGELOG.md +11 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/lock.rb +14 -3
- data/bundler/lib/bundler/fetcher/downloader.rb +9 -3
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +14 -4
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +54 -29
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +1 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +10 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +12 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +35 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +2 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +14 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +2 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +34 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +15 -3
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems/package.rb +36 -5
- data/lib/rubygems/vendor/net-http/lib/net/http/exceptions.rb +2 -1
- data/lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb +15 -7
- data/lib/rubygems/vendor/net-http/lib/net/http/header.rb +64 -19
- data/lib/rubygems/vendor/net-http/lib/net/http/request.rb +1 -0
- data/lib/rubygems/vendor/net-http/lib/net/http/requests.rb +74 -25
- data/lib/rubygems/vendor/net-http/lib/net/http/response.rb +42 -16
- data/lib/rubygems/vendor/net-http/lib/net/http/responses.rb +68 -0
- data/lib/rubygems/vendor/net-http/lib/net/http.rb +129 -37
- data/lib/rubygems/vendor/net-protocol/COPYING +56 -0
- data/lib/rubygems/vendor/net-protocol/lib/net/protocol.rb +95 -26
- data/lib/rubygems/vendor/optparse/lib/optparse.rb +23 -30
- data/lib/rubygems/vendor/timeout/lib/timeout.rb +190 -77
- data/lib/rubygems/vendor/uri/lib/uri/common.rb +1 -1
- data/lib/rubygems/vendor/uri/lib/uri/generic.rb +15 -3
- data/lib/rubygems/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/rubygems.rb +1 -1
- metadata +2 -2
- 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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2260352c2624a3ae9cf0e6097f01885b629db9bc4bb4896e8ba2553ecf18f49d
|
|
4
|
+
data.tar.gz: da371b40f613b3681bcc75cbc9f1a13e4813ee7bfd1f7808ebaf41d76080d8db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f7bc18982adcbcf73382c37cea141c266e0d5fd1b2c3814c337fc04cac281f6d774c129312665dafad70fb8aa65e69ba389c8bd7dabd315d5feb8988e9f00ca
|
|
7
|
+
data.tar.gz: 4f4be770ef448f4ab13a3bccf91305148edc604327190c0dccbbdcab3ebf36bb46af49b1b2681e2922b792cb75e7c82301dce04371ef79e840190eb4d6d61670
|
data/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
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
|
+
|
|
3
12
|
## 4.0.22 / 2026-09-30
|
|
4
13
|
|
|
5
14
|
### Enhancements:
|
|
6
15
|
|
|
7
|
-
* Add --source option to gem exec command. Pull request [#9765](https://github.com/ruby/rubygems/pull/9765) by Akshay Birajdar
|
|
16
|
+
* Add --source option to gem exec command. Pull request [#9765](https://github.com/ruby/rubygems/pull/9765) by Akshay Birajdar
|
|
8
17
|
* Keep credentials on redirects only within the same origin. Pull request [#9909](https://github.com/ruby/rubygems/pull/9909) by Hiroshi SHIBATA
|
|
9
18
|
* Validate the version field in Gem::Installer#verify_spec. Pull request [#9890](https://github.com/ruby/rubygems/pull/9890) by Hiroshi SHIBATA
|
|
10
19
|
* 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/
|
|
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,16 @@
|
|
|
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
|
+
|
|
3
14
|
## 4.0.22 / 2026-09-30
|
|
4
15
|
|
|
5
16
|
### 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-
|
|
8
|
-
@git_commit_sha = "
|
|
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 =
|
|
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
|
-
|
|
81
|
-
|
|
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)
|
|
@@ -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
|
-
|
|
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
|
|
@@ -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
|
-
#
|
|
58
|
-
#
|
|
59
|
-
#
|
|
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
|
-
|
|
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
|
|
@@ -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.
|
|
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
|
-
#
|
|
284
|
-
#
|
|
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
|
|
288
|
-
#
|
|
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
|
-
#
|
|
291
|
-
#
|
|
292
|
-
#
|
|
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
|
-
#
|
|
295
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
300
|
-
#
|
|
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
|
-
#
|
|
305
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
310
|
-
#
|
|
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
|
-
#
|
|
313
|
-
#
|
|
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:
|
|
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}"
|
data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
4
|
-
|
|
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.
|
|
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
|
|
@@ -2,6 +2,38 @@ require_relative "empty_directory"
|
|
|
2
2
|
|
|
3
3
|
class Bundler::Thor
|
|
4
4
|
module Actions
|
|
5
|
+
WARNINGS = {unchanged_no_flag: "File unchanged! Either the supplied flag value not found or the content has already been inserted!"}
|
|
6
|
+
|
|
7
|
+
# Injects the given content into a file, raising an error if the contents of
|
|
8
|
+
# the file are not changed. Different from gsub_file, this method is reversible.
|
|
9
|
+
#
|
|
10
|
+
# ==== Parameters
|
|
11
|
+
# destination<String>:: Relative path to the destination root
|
|
12
|
+
# data<String>:: Data to add to the file. Can be given as a block.
|
|
13
|
+
# config<Hash>:: give :verbose => false to not log the status and the flag
|
|
14
|
+
# for injection (:after or :before) or :force => true for
|
|
15
|
+
# insert two or more times the same content.
|
|
16
|
+
#
|
|
17
|
+
# ==== Examples
|
|
18
|
+
#
|
|
19
|
+
# insert_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
|
|
20
|
+
#
|
|
21
|
+
# insert_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do
|
|
22
|
+
# gems = ask "Which gems would you like to add?"
|
|
23
|
+
# gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n")
|
|
24
|
+
# end
|
|
25
|
+
#
|
|
26
|
+
def insert_into_file!(destination, *args, &block)
|
|
27
|
+
data = block_given? ? block : args.shift
|
|
28
|
+
|
|
29
|
+
config = args.shift || {}
|
|
30
|
+
config[:after] = /\z/ unless config.key?(:before) || config.key?(:after)
|
|
31
|
+
config = config.merge({error_on_no_change: true})
|
|
32
|
+
|
|
33
|
+
action InjectIntoFile.new(self, destination, data, config)
|
|
34
|
+
end
|
|
35
|
+
alias_method :inject_into_file!, :insert_into_file!
|
|
36
|
+
|
|
5
37
|
# Injects the given content into a file. Different from gsub_file, this
|
|
6
38
|
# method is reversible.
|
|
7
39
|
#
|
|
@@ -21,8 +53,6 @@ class Bundler::Thor
|
|
|
21
53
|
# gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n")
|
|
22
54
|
# end
|
|
23
55
|
#
|
|
24
|
-
WARNINGS = {unchanged_no_flag: "File unchanged! Either the supplied flag value not found or the content has already been inserted!"}
|
|
25
|
-
|
|
26
56
|
def insert_into_file(destination, *args, &block)
|
|
27
57
|
data = block_given? ? block : args.shift
|
|
28
58
|
|
|
@@ -47,6 +77,7 @@ class Bundler::Thor
|
|
|
47
77
|
|
|
48
78
|
@replacement = data.is_a?(Proc) ? data.call : data
|
|
49
79
|
@flag = Regexp.escape(@flag) unless @flag.is_a?(Regexp)
|
|
80
|
+
@error_on_no_change = @config.fetch(:error_on_no_change, false)
|
|
50
81
|
end
|
|
51
82
|
|
|
52
83
|
def invoke!
|
|
@@ -59,6 +90,8 @@ class Bundler::Thor
|
|
|
59
90
|
if exists?
|
|
60
91
|
if replace!(/#{flag}/, content, config[:force])
|
|
61
92
|
say_status(:invoke)
|
|
93
|
+
elsif @error_on_no_change
|
|
94
|
+
raise Bundler::Thor::Error, "The content of #{destination} did not change"
|
|
62
95
|
elsif replacement_present?
|
|
63
96
|
say_status(:unchanged, color: :blue)
|
|
64
97
|
else
|
|
@@ -13,8 +13,9 @@ class Bundler::Thor
|
|
|
13
13
|
autoload :RakeCompat, File.expand_path("rake_compat", __dir__)
|
|
14
14
|
autoload :Group, File.expand_path("group", __dir__)
|
|
15
15
|
|
|
16
|
-
# Shortcuts for help.
|
|
16
|
+
# Shortcuts for help and tree commands.
|
|
17
17
|
HELP_MAPPINGS = %w(-h -? --help -D)
|
|
18
|
+
TREE_MAPPINGS = %w(-t --tree)
|
|
18
19
|
|
|
19
20
|
# Bundler::Thor methods that should not be overwritten by the user.
|
|
20
21
|
THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root
|
|
@@ -311,13 +311,11 @@ class Bundler::Thor
|
|
|
311
311
|
end
|
|
312
312
|
|
|
313
313
|
def show_diff(destination, content) #:nodoc:
|
|
314
|
-
diff_cmd = ENV["THOR_DIFF"] || ENV["RAILS_DIFF"] || "diff -u"
|
|
315
|
-
|
|
316
314
|
require "tempfile"
|
|
317
315
|
Tempfile.open(File.basename(destination), File.dirname(destination), binmode: true) do |temp|
|
|
318
316
|
temp.write content
|
|
319
317
|
temp.rewind
|
|
320
|
-
system
|
|
318
|
+
system(*diff_tool, destination, temp.path)
|
|
321
319
|
end
|
|
322
320
|
end
|
|
323
321
|
|
|
@@ -369,15 +367,25 @@ class Bundler::Thor
|
|
|
369
367
|
|
|
370
368
|
def merge(destination, content) #:nodoc:
|
|
371
369
|
require "tempfile"
|
|
372
|
-
Tempfile.open([File.basename(destination), File.extname(destination)], File.dirname(destination)) do |temp|
|
|
370
|
+
Tempfile.open([File.basename(destination), File.extname(destination)], File.dirname(destination), binmode: true) do |temp|
|
|
373
371
|
temp.write content
|
|
374
372
|
temp.rewind
|
|
375
|
-
system(merge_tool, temp.path, destination)
|
|
373
|
+
system(*merge_tool, temp.path, destination)
|
|
376
374
|
end
|
|
377
375
|
end
|
|
378
376
|
|
|
379
377
|
def merge_tool #:nodoc:
|
|
380
|
-
@merge_tool ||=
|
|
378
|
+
@merge_tool ||= begin
|
|
379
|
+
require "shellwords"
|
|
380
|
+
Shellwords.split(ENV["THOR_MERGE"] || "git difftool --no-index")
|
|
381
|
+
end
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
def diff_tool #:nodoc:
|
|
385
|
+
@diff_cmd ||= begin
|
|
386
|
+
require "shellwords"
|
|
387
|
+
Shellwords.split(ENV["THOR_DIFF"] || ENV["RAILS_DIFF"] || "diff -u")
|
|
388
|
+
end
|
|
381
389
|
end
|
|
382
390
|
end
|
|
383
391
|
end
|
|
@@ -625,7 +625,7 @@ class Bundler::Thor
|
|
|
625
625
|
# alias name.
|
|
626
626
|
def find_command_possibilities(meth)
|
|
627
627
|
len = meth.to_s.length
|
|
628
|
-
possibilities = all_commands.reject {
|
|
628
|
+
possibilities = all_commands.reject {|k, v| v.is_a?(HiddenCommand) }.merge(map).keys.select { |n| meth == n[0, len] }.sort
|
|
629
629
|
unique_possibilities = possibilities.map { |k| map[k] || k }.uniq
|
|
630
630
|
|
|
631
631
|
if possibilities.include?(meth)
|
|
@@ -671,4 +671,37 @@ class Bundler::Thor
|
|
|
671
671
|
self.class.help(shell, subcommand)
|
|
672
672
|
end
|
|
673
673
|
end
|
|
674
|
+
|
|
675
|
+
map TREE_MAPPINGS => :tree
|
|
676
|
+
|
|
677
|
+
desc "tree", "Print a tree of all available commands"
|
|
678
|
+
def tree
|
|
679
|
+
build_command_tree(self.class, "")
|
|
680
|
+
end
|
|
681
|
+
|
|
682
|
+
private
|
|
683
|
+
|
|
684
|
+
def build_command_tree(klass, indent)
|
|
685
|
+
# Print current class name if it's not the root Bundler::Thor class
|
|
686
|
+
unless klass == Bundler::Thor
|
|
687
|
+
say "#{indent}#{klass.namespace || 'default'}", :blue
|
|
688
|
+
indent = "#{indent} "
|
|
689
|
+
end
|
|
690
|
+
|
|
691
|
+
# Print all commands for this class
|
|
692
|
+
visible_commands = klass.commands.reject { |_, cmd| cmd.hidden? || cmd.name == "help" }
|
|
693
|
+
commands_count = visible_commands.count
|
|
694
|
+
visible_commands.sort.each_with_index do |(command_name, command), i|
|
|
695
|
+
description = command.description.split("\n").first || ""
|
|
696
|
+
icon = i == (commands_count - 1) ? "└─" : "├─"
|
|
697
|
+
say "#{indent}#{icon} ", nil, false
|
|
698
|
+
say command_name, :green, false
|
|
699
|
+
say " (#{description})" unless description.empty?
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
# Print all subcommands (from registered Bundler::Thor subclasses)
|
|
703
|
+
klass.subcommand_classes.each do |_, subclass|
|
|
704
|
+
build_command_tree(subclass, indent)
|
|
705
|
+
end
|
|
706
|
+
end
|
|
674
707
|
end
|
|
@@ -466,7 +466,7 @@ module Bundler::URI
|
|
|
466
466
|
#
|
|
467
467
|
# uri = Bundler::URI.parse("http://john:S3nsit1ve@my.example.com")
|
|
468
468
|
# uri.user = "sam"
|
|
469
|
-
# uri.to_s #=> "http://sam
|
|
469
|
+
# uri.to_s #=> "http://sam@my.example.com"
|
|
470
470
|
#
|
|
471
471
|
def user=(user)
|
|
472
472
|
check_user(user)
|
|
@@ -1021,9 +1021,21 @@ module Bundler::URI
|
|
|
1021
1021
|
|
|
1022
1022
|
# RFC2396, Section 5.2, 6), a)
|
|
1023
1023
|
base_path << '' if base_path.last == '..'
|
|
1024
|
-
|
|
1025
|
-
|
|
1024
|
+
# Remove "<segment>/.." pairs in a single left-to-right pass (O(n)).
|
|
1025
|
+
# This deliberately differs from the relative-path stack handling
|
|
1026
|
+
# below: a leading ".." (one with no preceding segment left to
|
|
1027
|
+
# cancel) discards the whole base path, reproducing the previous
|
|
1028
|
+
# index/slice! implementation exactly.
|
|
1029
|
+
reduced = []
|
|
1030
|
+
base_path.each do |seg|
|
|
1031
|
+
if seg == '..'
|
|
1032
|
+
break if reduced.empty?
|
|
1033
|
+
reduced.pop
|
|
1034
|
+
else
|
|
1035
|
+
reduced << seg
|
|
1036
|
+
end
|
|
1026
1037
|
end
|
|
1038
|
+
base_path = reduced
|
|
1027
1039
|
|
|
1028
1040
|
if (first = rel_path.first) and first.empty?
|
|
1029
1041
|
base_path.clear
|