bundler 2.6.9 → 4.0.11
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 +2229 -1879
- data/README.md +11 -11
- data/bundler.gemspec +5 -5
- data/lib/bundler/build_metadata.rb +10 -11
- data/lib/bundler/capistrano.rb +1 -19
- data/lib/bundler/checksum.rb +6 -0
- data/lib/bundler/cli/add.rb +10 -0
- data/lib/bundler/cli/cache.rb +1 -12
- data/lib/bundler/cli/common.rb +21 -4
- data/lib/bundler/cli/config.rb +1 -2
- data/lib/bundler/cli/console.rb +5 -0
- data/lib/bundler/cli/exec.rb +29 -4
- data/lib/bundler/cli/gem.rb +90 -64
- data/lib/bundler/cli/install.rb +15 -90
- data/lib/bundler/cli/issue.rb +2 -2
- data/lib/bundler/cli/list.rb +33 -2
- data/lib/bundler/cli/lock.rb +5 -5
- data/lib/bundler/cli/outdated.rb +1 -1
- data/lib/bundler/cli/plugin.rb +5 -1
- data/lib/bundler/cli/pristine.rb +5 -1
- data/lib/bundler/cli/show.rb +3 -7
- data/lib/bundler/cli/update.rb +5 -5
- data/lib/bundler/cli.rb +162 -127
- data/lib/bundler/compact_index_client.rb +1 -6
- data/lib/bundler/current_ruby.rb +17 -5
- data/lib/bundler/definition.rb +201 -117
- data/lib/bundler/dependency.rb +1 -1
- data/lib/bundler/deployment.rb +1 -64
- data/lib/bundler/digest.rb +1 -1
- data/lib/bundler/dsl.rb +48 -48
- data/lib/bundler/environment_preserver.rb +1 -0
- data/lib/bundler/errors.rb +1 -5
- data/lib/bundler/feature_flag.rb +5 -35
- data/lib/bundler/fetcher/compact_index.rb +1 -1
- data/lib/bundler/fetcher/dependency.rb +9 -2
- data/lib/bundler/fetcher/downloader.rb +33 -8
- data/lib/bundler/fetcher/gem_remote_fetcher.rb +6 -0
- data/lib/bundler/fetcher.rb +49 -19
- data/lib/bundler/friendly_errors.rb +4 -3
- data/lib/bundler/index.rb +7 -9
- data/lib/bundler/injector.rb +1 -2
- data/lib/bundler/inline.rb +9 -1
- data/lib/bundler/installer/gem_installer.rb +14 -11
- data/lib/bundler/installer/parallel_installer.rb +74 -36
- data/lib/bundler/installer.rb +6 -19
- data/lib/bundler/lazy_specification.rb +47 -20
- data/lib/bundler/lockfile_generator.rb +17 -2
- data/lib/bundler/lockfile_parser.rb +19 -6
- data/lib/bundler/man/bundle-add.1 +1 -1
- data/lib/bundler/man/bundle-binstubs.1 +3 -6
- data/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
- data/lib/bundler/man/bundle-cache.1 +2 -14
- data/lib/bundler/man/bundle-cache.1.ronn +1 -14
- data/lib/bundler/man/bundle-check.1 +2 -5
- data/lib/bundler/man/bundle-check.1.ronn +0 -5
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +206 -148
- data/lib/bundler/man/bundle-config.1.ronn +136 -119
- data/lib/bundler/man/bundle-console.1 +1 -1
- data/lib/bundler/man/bundle-doctor.1 +43 -4
- data/lib/bundler/man/bundle-doctor.1.ronn +48 -4
- data/lib/bundler/man/bundle-env.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +2 -5
- data/lib/bundler/man/bundle-exec.1.ronn +1 -5
- data/lib/bundler/man/bundle-fund.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +64 -44
- data/lib/bundler/man/bundle-gem.1.ronn +10 -9
- data/lib/bundler/man/bundle-help.1 +1 -1
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-install.1 +16 -59
- data/lib/bundler/man/bundle-install.1.ronn +27 -108
- data/lib/bundler/man/bundle-issue.1 +1 -1
- data/lib/bundler/man/bundle-licenses.1 +1 -1
- data/lib/bundler/man/bundle-list.1 +6 -1
- data/lib/bundler/man/bundle-list.1.ronn +5 -0
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- data/lib/bundler/man/bundle-plugin.1 +33 -15
- data/lib/bundler/man/bundle-plugin.1.ronn +36 -15
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +2 -8
- data/lib/bundler/man/bundle-remove.1.ronn +1 -8
- data/lib/bundler/man/bundle-show.1 +2 -5
- data/lib/bundler/man/bundle-show.1.ronn +0 -4
- data/lib/bundler/man/bundle-update.1 +5 -5
- data/lib/bundler/man/bundle-update.1.ronn +4 -4
- data/lib/bundler/man/bundle-version.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -10
- data/lib/bundler/man/bundle.1.ronn +0 -9
- data/lib/bundler/man/gemfile.5 +32 -1
- data/lib/bundler/man/gemfile.5.ronn +28 -0
- data/lib/bundler/man/index.txt +0 -2
- data/lib/bundler/match_platform.rb +31 -12
- data/lib/bundler/materialization.rb +3 -3
- data/lib/bundler/plugin/api/source.rb +8 -0
- data/lib/bundler/plugin/index.rb +6 -0
- data/lib/bundler/plugin/installer.rb +2 -11
- data/lib/bundler/plugin/source_list.rb +1 -1
- data/lib/bundler/plugin.rb +7 -4
- data/lib/bundler/resolver/package.rb +2 -1
- data/lib/bundler/resolver/strategy.rb +6 -3
- data/lib/bundler/resolver.rb +20 -4
- data/lib/bundler/retry.rb +30 -4
- data/lib/bundler/ruby_dsl.rb +17 -12
- data/lib/bundler/ruby_version.rb +1 -3
- data/lib/bundler/rubygems_ext.rb +117 -121
- data/lib/bundler/rubygems_gem_installer.rb +5 -4
- data/lib/bundler/rubygems_integration.rb +13 -12
- data/lib/bundler/runtime.rb +14 -3
- data/lib/bundler/self_manager.rb +34 -43
- data/lib/bundler/settings/validator.rb +5 -21
- data/lib/bundler/settings.rb +17 -32
- data/lib/bundler/shared_helpers.rb +12 -18
- data/lib/bundler/source/gemspec.rb +4 -0
- data/lib/bundler/source/git/git_proxy.rb +55 -29
- data/lib/bundler/source/git.rb +2 -3
- data/lib/bundler/source/metadata.rb +4 -0
- data/lib/bundler/source/path.rb +12 -7
- data/lib/bundler/source/rubygems.rb +59 -43
- data/lib/bundler/source/rubygems_aggregate.rb +4 -1
- data/lib/bundler/source.rb +3 -1
- data/lib/bundler/source_list.rb +5 -50
- data/lib/bundler/source_map.rb +8 -7
- data/lib/bundler/spec_set.rb +9 -14
- data/lib/bundler/stub_specification.rb +1 -0
- data/lib/bundler/templates/Executable +0 -11
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
- data/lib/bundler/templates/newgem/Cargo.toml.tt +6 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +5 -0
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +8 -1
- data/lib/bundler/templates/newgem/ext/newgem/build.rs.tt +5 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
- data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
- data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +13 -2
- data/lib/bundler/templates/newgem/github/workflows/build-gems.yml.tt +69 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +12 -1
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -11
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +8 -0
- data/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +6 -0
- data/lib/bundler/ui/shell.rb +12 -8
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +84 -42
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +42 -6
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +3 -7
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
- data/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
- data/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
- data/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
- data/lib/bundler/version.rb +10 -2
- data/lib/bundler/vlad.rb +1 -14
- data/lib/bundler/worker.rb +12 -4
- data/lib/bundler.rb +20 -40
- metadata +13 -25
- data/lib/bundler/cli/inject.rb +0 -60
- data/lib/bundler/cli/viz.rb +0 -31
- data/lib/bundler/gem_helpers.rb +0 -144
- data/lib/bundler/graph.rb +0 -152
- data/lib/bundler/man/bundle-inject.1 +0 -31
- data/lib/bundler/man/bundle-inject.1.ronn +0 -32
- data/lib/bundler/man/bundle-viz.1 +0 -30
- data/lib/bundler/man/bundle-viz.1.ronn +0 -36
- data/lib/bundler/similarity_detector.rb +0 -63
- data/lib/bundler/templates/Executable.bundler +0 -109
- data/lib/bundler/vendor/connection_pool/.document +0 -1
- data/lib/bundler/vendor/fileutils/.document +0 -1
- data/lib/bundler/vendor/net-http-persistent/.document +0 -1
- data/lib/bundler/vendor/pub_grub/.document +0 -1
- data/lib/bundler/vendor/securerandom/.document +0 -1
- data/lib/bundler/vendor/thor/.document +0 -1
- data/lib/bundler/vendor/tsort/.document +0 -1
- data/lib/bundler/vendor/uri/.document +0 -1
|
@@ -39,7 +39,7 @@ end
|
|
|
39
39
|
# - :auto_reload_after_fork - automatically drop all connections after fork, defaults to true
|
|
40
40
|
#
|
|
41
41
|
class Bundler::ConnectionPool
|
|
42
|
-
DEFAULTS = {size: 5, timeout: 5, auto_reload_after_fork: true}
|
|
42
|
+
DEFAULTS = {size: 5, timeout: 5, auto_reload_after_fork: true}.freeze
|
|
43
43
|
|
|
44
44
|
def self.wrap(options, &block)
|
|
45
45
|
Wrapper.new(options, &block)
|
|
@@ -99,7 +99,8 @@ class Bundler::ConnectionPool
|
|
|
99
99
|
@available = TimedStack.new(@size, &block)
|
|
100
100
|
@key = :"pool-#{@available.object_id}"
|
|
101
101
|
@key_count = :"pool-#{@available.object_id}-count"
|
|
102
|
-
|
|
102
|
+
@discard_key = :"pool-#{@available.object_id}-discard"
|
|
103
|
+
INSTANCES[self] = self if @auto_reload_after_fork && INSTANCES
|
|
103
104
|
end
|
|
104
105
|
|
|
105
106
|
def with(options = {})
|
|
@@ -116,20 +117,65 @@ class Bundler::ConnectionPool
|
|
|
116
117
|
end
|
|
117
118
|
alias_method :then, :with
|
|
118
119
|
|
|
120
|
+
##
|
|
121
|
+
# Marks the current thread's checked-out connection for discard.
|
|
122
|
+
#
|
|
123
|
+
# When a connection is marked for discard, it will not be returned to the pool
|
|
124
|
+
# when checked in. Instead, the connection will be discarded.
|
|
125
|
+
# This is useful when a connection has become invalid or corrupted
|
|
126
|
+
# and should not be reused.
|
|
127
|
+
#
|
|
128
|
+
# Takes an optional block that will be called with the connection to be discarded.
|
|
129
|
+
# The block should perform any necessary clean-up on the connection.
|
|
130
|
+
#
|
|
131
|
+
# @yield [conn]
|
|
132
|
+
# @yieldparam conn [Object] The connection to be discarded.
|
|
133
|
+
# @yieldreturn [void]
|
|
134
|
+
#
|
|
135
|
+
#
|
|
136
|
+
# Note: This only affects the connection currently checked out by the calling thread.
|
|
137
|
+
# The connection will be discarded when +checkin+ is called.
|
|
138
|
+
#
|
|
139
|
+
# @return [void]
|
|
140
|
+
#
|
|
141
|
+
# @example
|
|
142
|
+
# pool.with do |conn|
|
|
143
|
+
# begin
|
|
144
|
+
# conn.execute("SELECT 1")
|
|
145
|
+
# rescue SomeConnectionError
|
|
146
|
+
# pool.discard_current_connection # Mark connection as bad
|
|
147
|
+
# raise
|
|
148
|
+
# end
|
|
149
|
+
# end
|
|
150
|
+
def discard_current_connection(&block)
|
|
151
|
+
::Thread.current[@discard_key] = block || proc { |conn| conn }
|
|
152
|
+
end
|
|
153
|
+
|
|
119
154
|
def checkout(options = {})
|
|
120
155
|
if ::Thread.current[@key]
|
|
121
156
|
::Thread.current[@key_count] += 1
|
|
122
157
|
::Thread.current[@key]
|
|
123
158
|
else
|
|
124
159
|
::Thread.current[@key_count] = 1
|
|
125
|
-
::Thread.current[@key] = @available.pop(options[:timeout] || @timeout)
|
|
160
|
+
::Thread.current[@key] = @available.pop(options[:timeout] || @timeout, options)
|
|
126
161
|
end
|
|
127
162
|
end
|
|
128
163
|
|
|
129
164
|
def checkin(force: false)
|
|
130
165
|
if ::Thread.current[@key]
|
|
131
166
|
if ::Thread.current[@key_count] == 1 || force
|
|
132
|
-
|
|
167
|
+
if ::Thread.current[@discard_key]
|
|
168
|
+
begin
|
|
169
|
+
@available.decrement_created
|
|
170
|
+
::Thread.current[@discard_key].call(::Thread.current[@key])
|
|
171
|
+
rescue
|
|
172
|
+
nil
|
|
173
|
+
ensure
|
|
174
|
+
::Thread.current[@discard_key] = nil
|
|
175
|
+
end
|
|
176
|
+
else
|
|
177
|
+
@available.push(::Thread.current[@key])
|
|
178
|
+
end
|
|
133
179
|
::Thread.current[@key] = nil
|
|
134
180
|
::Thread.current[@key_count] = nil
|
|
135
181
|
else
|
|
@@ -146,7 +192,6 @@ class Bundler::ConnectionPool
|
|
|
146
192
|
# Shuts down the Bundler::ConnectionPool by passing each connection to +block+ and
|
|
147
193
|
# then removing it from the pool. Attempting to checkout a connection after
|
|
148
194
|
# shutdown will raise +Bundler::ConnectionPool::PoolShuttingDownError+.
|
|
149
|
-
|
|
150
195
|
def shutdown(&block)
|
|
151
196
|
@available.shutdown(&block)
|
|
152
197
|
end
|
|
@@ -155,7 +200,6 @@ class Bundler::ConnectionPool
|
|
|
155
200
|
# Reloads the Bundler::ConnectionPool by passing each connection to +block+ and then
|
|
156
201
|
# removing it the pool. Subsequent checkouts will create new connections as
|
|
157
202
|
# needed.
|
|
158
|
-
|
|
159
203
|
def reload(&block)
|
|
160
204
|
@available.shutdown(reload: true, &block)
|
|
161
205
|
end
|
|
@@ -181,7 +181,7 @@ end
|
|
|
181
181
|
#
|
|
182
182
|
module Bundler::FileUtils
|
|
183
183
|
# The version number.
|
|
184
|
-
VERSION = "1.
|
|
184
|
+
VERSION = "1.8.0"
|
|
185
185
|
|
|
186
186
|
def self.private_module_function(name) #:nodoc:
|
|
187
187
|
module_function name
|
|
@@ -706,11 +706,12 @@ module Bundler::FileUtils
|
|
|
706
706
|
#
|
|
707
707
|
def ln_s(src, dest, force: nil, relative: false, target_directory: true, noop: nil, verbose: nil)
|
|
708
708
|
if relative
|
|
709
|
-
return ln_sr(src, dest, force: force, noop: noop, verbose: verbose)
|
|
709
|
+
return ln_sr(src, dest, force: force, target_directory: target_directory, noop: noop, verbose: verbose)
|
|
710
710
|
end
|
|
711
|
-
fu_output_message "ln -s#{force ? 'f' : ''}
|
|
711
|
+
fu_output_message "ln -s#{force ? 'f' : ''}#{
|
|
712
|
+
target_directory ? '' : 'T'} #{[src,dest].flatten.join ' '}" if verbose
|
|
712
713
|
return if noop
|
|
713
|
-
fu_each_src_dest0(src, dest) do |s,d|
|
|
714
|
+
fu_each_src_dest0(src, dest, target_directory) do |s,d|
|
|
714
715
|
remove_file d, true if force
|
|
715
716
|
File.symlink s, d
|
|
716
717
|
end
|
|
@@ -730,42 +731,37 @@ module Bundler::FileUtils
|
|
|
730
731
|
# Like Bundler::FileUtils.ln_s, but create links relative to +dest+.
|
|
731
732
|
#
|
|
732
733
|
def ln_sr(src, dest, target_directory: true, force: nil, noop: nil, verbose: nil)
|
|
733
|
-
|
|
734
|
-
dest
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
d = File.join(destdirs = dest, File.basename(s))
|
|
734
|
+
cmd = "ln -s#{force ? 'f' : ''}#{target_directory ? '' : 'T'}" if verbose
|
|
735
|
+
fu_each_src_dest0(src, dest, target_directory) do |s,d|
|
|
736
|
+
if target_directory
|
|
737
|
+
parent = File.dirname(d)
|
|
738
|
+
destdirs = fu_split_path(parent)
|
|
739
|
+
real_ddirs = fu_split_path(File.realpath(parent))
|
|
740
740
|
else
|
|
741
|
-
destdirs
|
|
741
|
+
destdirs ||= fu_split_path(dest)
|
|
742
|
+
real_ddirs ||= fu_split_path(File.realdirpath(dest))
|
|
742
743
|
end
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
744
|
+
srcdirs = fu_split_path(s)
|
|
745
|
+
i = fu_common_components(srcdirs, destdirs)
|
|
746
|
+
n = destdirs.size - i
|
|
747
|
+
n -= 1 unless target_directory
|
|
748
|
+
link1 = fu_clean_components(*Array.new([n, 0].max, '..'), *srcdirs[i..-1])
|
|
749
|
+
begin
|
|
750
|
+
real_sdirs = fu_split_path(File.realdirpath(s)) rescue nil
|
|
751
|
+
rescue
|
|
748
752
|
else
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
end
|
|
755
|
-
s = File.join(*base, *srcdirs)
|
|
753
|
+
i = fu_common_components(real_sdirs, real_ddirs)
|
|
754
|
+
n = real_ddirs.size - i
|
|
755
|
+
n -= 1 unless target_directory
|
|
756
|
+
link2 = fu_clean_components(*Array.new([n, 0].max, '..'), *real_sdirs[i..-1])
|
|
757
|
+
link1 = link2 if link1.size > link2.size
|
|
756
758
|
end
|
|
757
|
-
|
|
759
|
+
s = File.join(link1)
|
|
760
|
+
fu_output_message [cmd, s, d].flatten.join(' ') if verbose
|
|
758
761
|
next if noop
|
|
759
762
|
remove_file d, true if force
|
|
760
763
|
File.symlink s, d
|
|
761
764
|
end
|
|
762
|
-
case srcs.size
|
|
763
|
-
when 0
|
|
764
|
-
when 1
|
|
765
|
-
link[srcs[0], target_directory && File.directory?(dest)]
|
|
766
|
-
else
|
|
767
|
-
srcs.each(&link)
|
|
768
|
-
end
|
|
769
765
|
end
|
|
770
766
|
module_function :ln_sr
|
|
771
767
|
|
|
@@ -800,13 +796,13 @@ module Bundler::FileUtils
|
|
|
800
796
|
# File.file?('dest1/dir1/t2.txt') # => true
|
|
801
797
|
# File.file?('dest1/dir1/t3.txt') # => true
|
|
802
798
|
#
|
|
803
|
-
#
|
|
799
|
+
# Optional arguments:
|
|
804
800
|
#
|
|
805
|
-
# -
|
|
806
|
-
# -
|
|
801
|
+
# - +dereference_root+ - dereferences +src+ if it is a symbolic link (+false+ by default).
|
|
802
|
+
# - +remove_destination+ - removes +dest+ before creating links (+false+ by default).
|
|
807
803
|
#
|
|
808
804
|
# Raises an exception if +dest+ is the path to an existing file or directory
|
|
809
|
-
# and
|
|
805
|
+
# and optional argument +remove_destination+ is not given.
|
|
810
806
|
#
|
|
811
807
|
# Related: Bundler::FileUtils.ln (has different options).
|
|
812
808
|
#
|
|
@@ -1029,12 +1025,12 @@ module Bundler::FileUtils
|
|
|
1029
1025
|
# directories, and symbolic links;
|
|
1030
1026
|
# other file types (FIFO streams, device files, etc.) are not supported.
|
|
1031
1027
|
#
|
|
1032
|
-
#
|
|
1028
|
+
# Optional arguments:
|
|
1033
1029
|
#
|
|
1034
|
-
# -
|
|
1035
|
-
# follows the link.
|
|
1036
|
-
# -
|
|
1037
|
-
# -
|
|
1030
|
+
# - +dereference_root+ - if +src+ is a symbolic link,
|
|
1031
|
+
# follows the link (+false+ by default).
|
|
1032
|
+
# - +preserve+ - preserves file times (+false+ by default).
|
|
1033
|
+
# - +remove_destination+ - removes +dest+ before copying files (+false+ by default).
|
|
1038
1034
|
#
|
|
1039
1035
|
# Related: {methods for copying}[rdoc-ref:FileUtils@Copying].
|
|
1040
1036
|
#
|
|
@@ -1065,12 +1061,12 @@ module Bundler::FileUtils
|
|
|
1065
1061
|
# Bundler::FileUtils.copy_file('src0.txt', 'dest0.txt')
|
|
1066
1062
|
# File.file?('dest0.txt') # => true
|
|
1067
1063
|
#
|
|
1068
|
-
#
|
|
1064
|
+
# Optional arguments:
|
|
1069
1065
|
#
|
|
1070
|
-
# -
|
|
1071
|
-
#
|
|
1072
|
-
# -
|
|
1073
|
-
# -
|
|
1066
|
+
# - +dereference+ - if +src+ is a symbolic link,
|
|
1067
|
+
# follows the link (+true+ by default).
|
|
1068
|
+
# - +preserve+ - preserves file times (+false+ by default).
|
|
1069
|
+
# - +remove_destination+ - removes +dest+ before copying files (+false+ by default).
|
|
1074
1070
|
#
|
|
1075
1071
|
# Related: {methods for copying}[rdoc-ref:FileUtils@Copying].
|
|
1076
1072
|
#
|
|
@@ -1491,7 +1487,8 @@ module Bundler::FileUtils
|
|
|
1491
1487
|
# Related: {methods for deleting}[rdoc-ref:FileUtils@Deleting].
|
|
1492
1488
|
#
|
|
1493
1489
|
def remove_dir(path, force = false)
|
|
1494
|
-
|
|
1490
|
+
raise Errno::ENOTDIR, path unless force or File.directory?(path)
|
|
1491
|
+
remove_entry path, force
|
|
1495
1492
|
end
|
|
1496
1493
|
module_function :remove_dir
|
|
1497
1494
|
|
|
@@ -2475,6 +2472,10 @@ module Bundler::FileUtils
|
|
|
2475
2472
|
|
|
2476
2473
|
def fu_each_src_dest0(src, dest, target_directory = true) #:nodoc:
|
|
2477
2474
|
if tmp = Array.try_convert(src)
|
|
2475
|
+
unless target_directory or tmp.size <= 1
|
|
2476
|
+
tmp = tmp.map {|f| File.path(f)} # A workaround for RBS
|
|
2477
|
+
raise ArgumentError, "extra target #{tmp}"
|
|
2478
|
+
end
|
|
2478
2479
|
tmp.each do |s|
|
|
2479
2480
|
s = File.path(s)
|
|
2480
2481
|
yield s, (target_directory ? File.join(dest, File.basename(s)) : dest)
|
|
@@ -2509,7 +2510,11 @@ module Bundler::FileUtils
|
|
|
2509
2510
|
path = File.path(path)
|
|
2510
2511
|
list = []
|
|
2511
2512
|
until (parent, base = File.split(path); parent == path or parent == ".")
|
|
2512
|
-
list
|
|
2513
|
+
if base != '..' and list.last == '..' and !(fu_have_symlink? && File.symlink?(path))
|
|
2514
|
+
list.pop
|
|
2515
|
+
else
|
|
2516
|
+
list << base
|
|
2517
|
+
end
|
|
2513
2518
|
path = parent
|
|
2514
2519
|
end
|
|
2515
2520
|
list << path
|
|
@@ -2517,14 +2522,14 @@ module Bundler::FileUtils
|
|
|
2517
2522
|
end
|
|
2518
2523
|
private_module_function :fu_split_path
|
|
2519
2524
|
|
|
2520
|
-
def
|
|
2525
|
+
def fu_common_components(target, base) #:nodoc:
|
|
2521
2526
|
i = 0
|
|
2522
2527
|
while target[i]&.== base[i]
|
|
2523
2528
|
i += 1
|
|
2524
2529
|
end
|
|
2525
|
-
|
|
2530
|
+
i
|
|
2526
2531
|
end
|
|
2527
|
-
private_module_function :
|
|
2532
|
+
private_module_function :fu_common_components
|
|
2528
2533
|
|
|
2529
2534
|
def fu_clean_components(*comp) #:nodoc:
|
|
2530
2535
|
comp.shift while comp.first == "."
|
|
@@ -2534,7 +2539,7 @@ module Bundler::FileUtils
|
|
|
2534
2539
|
while c = comp.shift
|
|
2535
2540
|
if c == ".." and clean.last != ".." and !(fu_have_symlink? && File.symlink?(path))
|
|
2536
2541
|
clean.pop
|
|
2537
|
-
path.
|
|
2542
|
+
path.sub!(%r((?<=\A|/)[^/]+/\z), "")
|
|
2538
2543
|
else
|
|
2539
2544
|
clean << c
|
|
2540
2545
|
path << c << "/"
|
|
@@ -63,7 +63,8 @@ class Gem::Net::HTTP::Persistent::TimedStackMulti < Bundler::ConnectionPool::Tim
|
|
|
63
63
|
if @created >= @max && @enqueued >= 1
|
|
64
64
|
oldest, = @lru.first
|
|
65
65
|
@lru.delete oldest
|
|
66
|
-
@ques[oldest].pop
|
|
66
|
+
connection = @ques[oldest].pop
|
|
67
|
+
connection.close if connection.respond_to?(:close)
|
|
67
68
|
|
|
68
69
|
@created -= 1
|
|
69
70
|
end
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
require_relative '../../../../../vendored_net_http'
|
|
2
2
|
require_relative '../../../../../vendored_uri'
|
|
3
|
-
|
|
3
|
+
begin
|
|
4
|
+
require 'cgi/escape'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
require 'cgi/util' # for escaping
|
|
7
|
+
end
|
|
4
8
|
require_relative '../../../../connection_pool/lib/connection_pool'
|
|
5
9
|
|
|
6
10
|
autoload :OpenSSL, 'openssl'
|
|
@@ -42,9 +46,8 @@ autoload :OpenSSL, 'openssl'
|
|
|
42
46
|
# # perform the POST, the Gem::URI is always required
|
|
43
47
|
# response http.request post_uri, post
|
|
44
48
|
#
|
|
45
|
-
# Note that for GET, HEAD and other requests that do not have a body
|
|
46
|
-
#
|
|
47
|
-
# params which are sent in the body for other requests.
|
|
49
|
+
# ⚠ Note that for GET, HEAD and other requests that do not have a body,
|
|
50
|
+
# it uses Gem::URI#request_uri as default to send query params
|
|
48
51
|
#
|
|
49
52
|
# == TLS/SSL
|
|
50
53
|
#
|
|
@@ -60,6 +63,7 @@ autoload :OpenSSL, 'openssl'
|
|
|
60
63
|
# #ca_path :: Directory with certificate-authorities
|
|
61
64
|
# #cert_store :: An SSL certificate store
|
|
62
65
|
# #ciphers :: List of SSl ciphers allowed
|
|
66
|
+
# #extra_chain_cert :: Extra certificates to be added to the certificate chain
|
|
63
67
|
# #private_key :: The client's SSL private key
|
|
64
68
|
# #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new
|
|
65
69
|
# connection
|
|
@@ -176,7 +180,7 @@ class Gem::Net::HTTP::Persistent
|
|
|
176
180
|
##
|
|
177
181
|
# The version of Gem::Net::HTTP::Persistent you are using
|
|
178
182
|
|
|
179
|
-
VERSION = '4.0.
|
|
183
|
+
VERSION = '4.0.6'
|
|
180
184
|
|
|
181
185
|
##
|
|
182
186
|
# Error class for errors raised by Gem::Net::HTTP::Persistent. Various
|
|
@@ -267,6 +271,11 @@ class Gem::Net::HTTP::Persistent
|
|
|
267
271
|
|
|
268
272
|
attr_reader :ciphers
|
|
269
273
|
|
|
274
|
+
##
|
|
275
|
+
# Extra certificates to be added to the certificate chain
|
|
276
|
+
|
|
277
|
+
attr_reader :extra_chain_cert
|
|
278
|
+
|
|
270
279
|
##
|
|
271
280
|
# Sends debug_output to this IO via Gem::Net::HTTP#set_debug_output.
|
|
272
281
|
#
|
|
@@ -587,6 +596,21 @@ class Gem::Net::HTTP::Persistent
|
|
|
587
596
|
reconnect_ssl
|
|
588
597
|
end
|
|
589
598
|
|
|
599
|
+
if Gem::Net::HTTP.method_defined?(:extra_chain_cert=)
|
|
600
|
+
##
|
|
601
|
+
# Extra certificates to be added to the certificate chain.
|
|
602
|
+
# It is only supported starting from Gem::Net::HTTP version 0.1.1
|
|
603
|
+
def extra_chain_cert= extra_chain_cert
|
|
604
|
+
@extra_chain_cert = extra_chain_cert
|
|
605
|
+
|
|
606
|
+
reconnect_ssl
|
|
607
|
+
end
|
|
608
|
+
else
|
|
609
|
+
def extra_chain_cert= _extra_chain_cert
|
|
610
|
+
raise "extra_chain_cert= is not supported by this version of Gem::Net::HTTP"
|
|
611
|
+
end
|
|
612
|
+
end
|
|
613
|
+
|
|
590
614
|
##
|
|
591
615
|
# Creates a new connection for +uri+
|
|
592
616
|
|
|
@@ -605,47 +629,49 @@ class Gem::Net::HTTP::Persistent
|
|
|
605
629
|
|
|
606
630
|
connection = @pool.checkout net_http_args
|
|
607
631
|
|
|
608
|
-
|
|
632
|
+
begin
|
|
633
|
+
http = connection.http
|
|
609
634
|
|
|
610
|
-
|
|
611
|
-
|
|
635
|
+
connection.ressl @ssl_generation if
|
|
636
|
+
connection.ssl_generation != @ssl_generation
|
|
612
637
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
638
|
+
if not http.started? then
|
|
639
|
+
ssl http if use_ssl
|
|
640
|
+
start http
|
|
641
|
+
elsif expired? connection then
|
|
642
|
+
reset connection
|
|
643
|
+
end
|
|
619
644
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
645
|
+
http.keep_alive_timeout = @idle_timeout if @idle_timeout
|
|
646
|
+
http.max_retries = @max_retries if http.respond_to?(:max_retries=)
|
|
647
|
+
http.read_timeout = @read_timeout if @read_timeout
|
|
648
|
+
http.write_timeout = @write_timeout if
|
|
649
|
+
@write_timeout && http.respond_to?(:write_timeout=)
|
|
650
|
+
|
|
651
|
+
return yield connection
|
|
652
|
+
rescue Errno::ECONNREFUSED
|
|
653
|
+
if http.proxy?
|
|
654
|
+
address = http.proxy_address
|
|
655
|
+
port = http.proxy_port
|
|
656
|
+
else
|
|
657
|
+
address = http.address
|
|
658
|
+
port = http.port
|
|
659
|
+
end
|
|
625
660
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
661
|
+
raise Error, "connection refused: #{address}:#{port}"
|
|
662
|
+
rescue Errno::EHOSTDOWN
|
|
663
|
+
if http.proxy?
|
|
664
|
+
address = http.proxy_address
|
|
665
|
+
port = http.proxy_port
|
|
666
|
+
else
|
|
667
|
+
address = http.address
|
|
668
|
+
port = http.port
|
|
669
|
+
end
|
|
635
670
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
address = http.proxy_address
|
|
640
|
-
port = http.proxy_port
|
|
641
|
-
else
|
|
642
|
-
address = http.address
|
|
643
|
-
port = http.port
|
|
671
|
+
raise Error, "host down: #{address}:#{port}"
|
|
672
|
+
ensure
|
|
673
|
+
@pool.checkin net_http_args
|
|
644
674
|
end
|
|
645
|
-
|
|
646
|
-
raise Error, "host down: #{address}:#{port}"
|
|
647
|
-
ensure
|
|
648
|
-
@pool.checkin net_http_args
|
|
649
675
|
end
|
|
650
676
|
|
|
651
677
|
##
|
|
@@ -782,7 +808,7 @@ class Gem::Net::HTTP::Persistent
|
|
|
782
808
|
@proxy_connection_id = [nil, *@proxy_args].join ':'
|
|
783
809
|
|
|
784
810
|
if @proxy_uri.query then
|
|
785
|
-
@no_proxy =
|
|
811
|
+
@no_proxy = Gem::URI.decode_www_form(@proxy_uri.query).filter_map { |k, v| v if k == 'no_proxy' }.join(',').downcase.split(',').map { |x| x.strip }.reject { |x| x.empty? }
|
|
786
812
|
end
|
|
787
813
|
end
|
|
788
814
|
|
|
@@ -953,7 +979,8 @@ class Gem::Net::HTTP::Persistent
|
|
|
953
979
|
end
|
|
954
980
|
|
|
955
981
|
##
|
|
956
|
-
# Shuts down all connections
|
|
982
|
+
# Shuts down all connections. Attempting to checkout a connection after
|
|
983
|
+
# shutdown will raise an error.
|
|
957
984
|
#
|
|
958
985
|
# *NOTE*: Calling shutdown for can be dangerous!
|
|
959
986
|
#
|
|
@@ -964,6 +991,17 @@ class Gem::Net::HTTP::Persistent
|
|
|
964
991
|
@pool.shutdown { |http| http.finish }
|
|
965
992
|
end
|
|
966
993
|
|
|
994
|
+
##
|
|
995
|
+
# Discard all existing connections. Subsequent checkouts will create
|
|
996
|
+
# new connections as needed.
|
|
997
|
+
#
|
|
998
|
+
# If any thread is still using a connection it may cause an error! Call
|
|
999
|
+
# #reload when you are completely done making requests!
|
|
1000
|
+
|
|
1001
|
+
def reload
|
|
1002
|
+
@pool.reload { |http| http.finish }
|
|
1003
|
+
end
|
|
1004
|
+
|
|
967
1005
|
##
|
|
968
1006
|
# Enables SSL on +connection+
|
|
969
1007
|
|
|
@@ -1021,6 +1059,10 @@ application:
|
|
|
1021
1059
|
connection.key = @private_key
|
|
1022
1060
|
end
|
|
1023
1061
|
|
|
1062
|
+
if defined?(@extra_chain_cert) and @extra_chain_cert
|
|
1063
|
+
connection.extra_chain_cert = @extra_chain_cert
|
|
1064
|
+
end
|
|
1065
|
+
|
|
1024
1066
|
connection.cert_store = if @cert_store then
|
|
1025
1067
|
@cert_store
|
|
1026
1068
|
else
|
|
@@ -242,6 +242,35 @@ class Bundler::Thor
|
|
|
242
242
|
insert_into_file(path, *(args << config), &block)
|
|
243
243
|
end
|
|
244
244
|
|
|
245
|
+
# Run a regular expression replacement on a file, raising an error if the
|
|
246
|
+
# contents of the file are not changed.
|
|
247
|
+
#
|
|
248
|
+
# ==== Parameters
|
|
249
|
+
# path<String>:: path of the file to be changed
|
|
250
|
+
# flag<Regexp|String>:: the regexp or string to be replaced
|
|
251
|
+
# replacement<String>:: the replacement, can be also given as a block
|
|
252
|
+
# config<Hash>:: give :verbose => false to not log the status, and
|
|
253
|
+
# :force => true, to force the replacement regardless of runner behavior.
|
|
254
|
+
#
|
|
255
|
+
# ==== Example
|
|
256
|
+
#
|
|
257
|
+
# gsub_file! 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1'
|
|
258
|
+
#
|
|
259
|
+
# gsub_file! 'README', /rake/, :green do |match|
|
|
260
|
+
# match << " no more. Use thor!"
|
|
261
|
+
# end
|
|
262
|
+
#
|
|
263
|
+
def gsub_file!(path, flag, *args, &block)
|
|
264
|
+
config = args.last.is_a?(Hash) ? args.pop : {}
|
|
265
|
+
|
|
266
|
+
return unless behavior == :invoke || config.fetch(:force, false)
|
|
267
|
+
|
|
268
|
+
path = File.expand_path(path, destination_root)
|
|
269
|
+
say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true)
|
|
270
|
+
|
|
271
|
+
actually_gsub_file(path, flag, args, true, &block) unless options[:pretend]
|
|
272
|
+
end
|
|
273
|
+
|
|
245
274
|
# Run a regular expression replacement on a file.
|
|
246
275
|
#
|
|
247
276
|
# ==== Parameters
|
|
@@ -267,11 +296,7 @@ class Bundler::Thor
|
|
|
267
296
|
path = File.expand_path(path, destination_root)
|
|
268
297
|
say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true)
|
|
269
298
|
|
|
270
|
-
unless options[:pretend]
|
|
271
|
-
content = File.binread(path)
|
|
272
|
-
content.gsub!(flag, *args, &block)
|
|
273
|
-
File.open(path, "wb") { |file| file.write(content) }
|
|
274
|
-
end
|
|
299
|
+
actually_gsub_file(path, flag, args, false, &block) unless options[:pretend]
|
|
275
300
|
end
|
|
276
301
|
|
|
277
302
|
# Uncomment all lines matching a given regex. Preserves indentation before
|
|
@@ -348,7 +373,7 @@ class Bundler::Thor
|
|
|
348
373
|
end
|
|
349
374
|
|
|
350
375
|
def with_output_buffer(buf = "".dup) #:nodoc:
|
|
351
|
-
raise ArgumentError, "Buffer
|
|
376
|
+
raise ArgumentError, "Buffer cannot be a frozen object" if buf.frozen?
|
|
352
377
|
old_buffer = output_buffer
|
|
353
378
|
self.output_buffer = buf
|
|
354
379
|
yield
|
|
@@ -357,6 +382,17 @@ class Bundler::Thor
|
|
|
357
382
|
self.output_buffer = old_buffer
|
|
358
383
|
end
|
|
359
384
|
|
|
385
|
+
def actually_gsub_file(path, flag, args, error_on_no_change, &block)
|
|
386
|
+
content = File.binread(path)
|
|
387
|
+
success = content.gsub!(flag, *args, &block)
|
|
388
|
+
|
|
389
|
+
if success.nil? && error_on_no_change
|
|
390
|
+
raise Bundler::Thor::Error, "The content of #{path} did not change"
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
File.open(path, "wb") { |file| file.write(content) }
|
|
394
|
+
end
|
|
395
|
+
|
|
360
396
|
# Bundler::Thor::Actions#capture depends on what kind of buffer is used in ERB.
|
|
361
397
|
# Thus CapturableERB fixes ERB to use String buffer.
|
|
362
398
|
class CapturableERB < ERB
|
|
@@ -144,7 +144,7 @@ class Bundler::Thor
|
|
|
144
144
|
def check_exclusive!
|
|
145
145
|
opts = @assigns.keys
|
|
146
146
|
# When option A and B are exclusive, if A and B are given at the same time,
|
|
147
|
-
# the
|
|
147
|
+
# the difference of argument array size will decrease.
|
|
148
148
|
found = @exclusives.find{ |ex| (ex - opts).size < ex.size - 1 }
|
|
149
149
|
if found
|
|
150
150
|
names = names_to_switch_names(found & opts).map{|n| "'#{n}'"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
require_relative "../thor"
|
|
2
2
|
require_relative "group"
|
|
3
3
|
|
|
4
|
-
require "yaml"
|
|
5
4
|
require "digest/sha2"
|
|
6
|
-
require "pathname"
|
|
5
|
+
require "pathname" unless defined?(Pathname)
|
|
7
6
|
|
|
8
7
|
class Bundler::Thor::Runner < Bundler::Thor #:nodoc:
|
|
9
8
|
map "-T" => :list, "-i" => :install, "-u" => :update, "-v" => :version
|
|
@@ -195,6 +194,7 @@ private
|
|
|
195
194
|
def thor_yaml
|
|
196
195
|
@thor_yaml ||= begin
|
|
197
196
|
yaml_file = File.join(thor_root, "thor.yml")
|
|
197
|
+
require "yaml"
|
|
198
198
|
yaml = YAML.load_file(yaml_file) if File.exist?(yaml_file)
|
|
199
199
|
yaml || {}
|
|
200
200
|
end
|
|
@@ -314,7 +314,7 @@ class Bundler::Thor
|
|
|
314
314
|
diff_cmd = ENV["THOR_DIFF"] || ENV["RAILS_DIFF"] || "diff -u"
|
|
315
315
|
|
|
316
316
|
require "tempfile"
|
|
317
|
-
Tempfile.open(File.basename(destination), File.dirname(destination)) do |temp|
|
|
317
|
+
Tempfile.open(File.basename(destination), File.dirname(destination), binmode: true) do |temp|
|
|
318
318
|
temp.write content
|
|
319
319
|
temp.rewind
|
|
320
320
|
system %(#{diff_cmd} "#{destination}" "#{temp.path}")
|
|
@@ -372,16 +372,12 @@ class Bundler::Thor
|
|
|
372
372
|
Tempfile.open([File.basename(destination), File.extname(destination)], File.dirname(destination)) do |temp|
|
|
373
373
|
temp.write content
|
|
374
374
|
temp.rewind
|
|
375
|
-
system
|
|
375
|
+
system(merge_tool, temp.path, destination)
|
|
376
376
|
end
|
|
377
377
|
end
|
|
378
378
|
|
|
379
379
|
def merge_tool #:nodoc:
|
|
380
|
-
@merge_tool ||= ENV["THOR_MERGE"] ||
|
|
381
|
-
end
|
|
382
|
-
|
|
383
|
-
def git_merge_tool #:nodoc:
|
|
384
|
-
`git config merge.tool`.rstrip rescue ""
|
|
380
|
+
@merge_tool ||= ENV["THOR_MERGE"] || "git difftool --no-index"
|
|
385
381
|
end
|
|
386
382
|
end
|
|
387
383
|
end
|