rubygems-update 3.7.2 → 4.0.0.beta2

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 (211) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1431 -1323
  3. data/CODE_OF_CONDUCT.md +7 -129
  4. data/Manifest.txt +5 -11
  5. data/README.md +2 -2
  6. data/bundler/CHANGELOG.md +1011 -917
  7. data/bundler/README.md +4 -4
  8. data/bundler/bundler.gemspec +3 -3
  9. data/bundler/lib/bundler/build_metadata.rb +2 -2
  10. data/bundler/lib/bundler/capistrano.rb +1 -19
  11. data/bundler/lib/bundler/cli/cache.rb +1 -11
  12. data/bundler/lib/bundler/cli/common.rb +20 -3
  13. data/bundler/lib/bundler/cli/config.rb +1 -2
  14. data/bundler/lib/bundler/cli/console.rb +5 -0
  15. data/bundler/lib/bundler/cli/exec.rb +29 -4
  16. data/bundler/lib/bundler/cli/gem.rb +19 -33
  17. data/bundler/lib/bundler/cli/install.rb +9 -82
  18. data/bundler/lib/bundler/cli/issue.rb +2 -2
  19. data/bundler/lib/bundler/cli/list.rb +33 -2
  20. data/bundler/lib/bundler/cli/plugin.rb +5 -1
  21. data/bundler/lib/bundler/cli/show.rb +1 -1
  22. data/bundler/lib/bundler/cli/update.rb +3 -3
  23. data/bundler/lib/bundler/cli.rb +91 -85
  24. data/bundler/lib/bundler/compact_index_client.rb +0 -1
  25. data/bundler/lib/bundler/current_ruby.rb +3 -15
  26. data/bundler/lib/bundler/definition.rb +65 -36
  27. data/bundler/lib/bundler/deployment.rb +1 -64
  28. data/bundler/lib/bundler/digest.rb +1 -1
  29. data/bundler/lib/bundler/dsl.rb +26 -36
  30. data/bundler/lib/bundler/endpoint_specification.rb +0 -22
  31. data/bundler/lib/bundler/environment_preserver.rb +1 -0
  32. data/bundler/lib/bundler/errors.rb +1 -5
  33. data/bundler/lib/bundler/feature_flag.rb +0 -33
  34. data/bundler/lib/bundler/fetcher/compact_index.rb +1 -1
  35. data/bundler/lib/bundler/friendly_errors.rb +2 -2
  36. data/bundler/lib/bundler/index.rb +0 -7
  37. data/bundler/lib/bundler/inline.rb +9 -1
  38. data/bundler/lib/bundler/installer/gem_installer.rb +0 -11
  39. data/bundler/lib/bundler/installer.rb +0 -6
  40. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  41. data/bundler/lib/bundler/lockfile_parser.rb +2 -12
  42. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  43. data/bundler/lib/bundler/man/bundle-binstubs.1 +3 -6
  44. data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  45. data/bundler/lib/bundler/man/bundle-cache.1 +2 -14
  46. data/bundler/lib/bundler/man/bundle-cache.1.ronn +1 -14
  47. data/bundler/lib/bundler/man/bundle-check.1 +2 -5
  48. data/bundler/lib/bundler/man/bundle-check.1.ronn +0 -5
  49. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  50. data/bundler/lib/bundler/man/bundle-config.1 +9 -33
  51. data/bundler/lib/bundler/man/bundle-config.1.ronn +24 -55
  52. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  53. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  54. data/bundler/lib/bundler/man/bundle-env.1 +1 -1
  55. data/bundler/lib/bundler/man/bundle-exec.1 +2 -5
  56. data/bundler/lib/bundler/man/bundle-exec.1.ronn +1 -5
  57. data/bundler/lib/bundler/man/bundle-fund.1 +1 -1
  58. data/bundler/lib/bundler/man/bundle-gem.1 +3 -6
  59. data/bundler/lib/bundler/man/bundle-gem.1.ronn +2 -5
  60. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  61. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  62. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  63. data/bundler/lib/bundler/man/bundle-install.1 +14 -57
  64. data/bundler/lib/bundler/man/bundle-install.1.ronn +25 -105
  65. data/bundler/lib/bundler/man/bundle-issue.1 +1 -1
  66. data/bundler/lib/bundler/man/bundle-licenses.1 +1 -1
  67. data/bundler/lib/bundler/man/bundle-list.1 +6 -1
  68. data/bundler/lib/bundler/man/bundle-list.1.ronn +5 -0
  69. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  70. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  71. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  72. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  73. data/bundler/lib/bundler/man/bundle-plugin.1 +2 -9
  74. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +0 -8
  75. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  76. data/bundler/lib/bundler/man/bundle-remove.1 +2 -8
  77. data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -8
  78. data/bundler/lib/bundler/man/bundle-show.1 +2 -5
  79. data/bundler/lib/bundler/man/bundle-show.1.ronn +0 -4
  80. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  81. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  82. data/bundler/lib/bundler/man/bundle.1 +1 -10
  83. data/bundler/lib/bundler/man/bundle.1.ronn +0 -9
  84. data/bundler/lib/bundler/man/gemfile.5 +32 -1
  85. data/bundler/lib/bundler/man/gemfile.5.ronn +28 -0
  86. data/bundler/lib/bundler/man/index.txt +0 -2
  87. data/bundler/lib/bundler/materialization.rb +1 -1
  88. data/bundler/lib/bundler/plugin/installer.rb +0 -10
  89. data/bundler/lib/bundler/plugin/source_list.rb +1 -1
  90. data/bundler/lib/bundler/plugin.rb +1 -1
  91. data/bundler/lib/bundler/resolver.rb +1 -1
  92. data/bundler/lib/bundler/ruby_dsl.rb +2 -0
  93. data/bundler/lib/bundler/ruby_version.rb +1 -3
  94. data/bundler/lib/bundler/rubygems_ext.rb +1 -1
  95. data/bundler/lib/bundler/rubygems_gem_installer.rb +1 -1
  96. data/bundler/lib/bundler/rubygems_integration.rb +1 -5
  97. data/bundler/lib/bundler/runtime.rb +5 -1
  98. data/bundler/lib/bundler/self_manager.rb +1 -1
  99. data/bundler/lib/bundler/settings.rb +8 -26
  100. data/bundler/lib/bundler/shared_helpers.rb +12 -20
  101. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -11
  102. data/bundler/lib/bundler/source/git.rb +2 -3
  103. data/bundler/lib/bundler/source/path.rb +3 -7
  104. data/bundler/lib/bundler/source/rubygems.rb +11 -17
  105. data/bundler/lib/bundler/source.rb +1 -1
  106. data/bundler/lib/bundler/source_list.rb +4 -45
  107. data/bundler/lib/bundler/source_map.rb +2 -5
  108. data/bundler/lib/bundler/spec_set.rb +6 -15
  109. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  110. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +5 -0
  111. data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  112. data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  113. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  114. data/bundler/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  115. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  116. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  117. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
  118. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  119. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
  120. data/bundler/lib/bundler/ui/shell.rb +10 -6
  121. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  122. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  123. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  124. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  125. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
  126. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +1 -1
  127. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  128. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  129. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  130. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  131. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  132. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  133. data/bundler/lib/bundler/version.rb +1 -1
  134. data/bundler/lib/bundler/vlad.rb +1 -14
  135. data/bundler/lib/bundler.rb +6 -28
  136. data/doc/MAINTAINERS.txt +0 -7
  137. data/doc/bundler/UPGRADING.md +11 -5
  138. data/doc/rubygems/CONTRIBUTING.md +1 -1
  139. data/lib/rubygems/basic_specification.rb +3 -9
  140. data/lib/rubygems/bundler_version_finder.rb +38 -3
  141. data/lib/rubygems/command.rb +1 -1
  142. data/lib/rubygems/command_manager.rb +3 -4
  143. data/lib/rubygems/commands/build_command.rb +0 -7
  144. data/lib/rubygems/commands/cert_command.rb +1 -1
  145. data/lib/rubygems/commands/install_command.rb +1 -5
  146. data/lib/rubygems/commands/setup_command.rb +5 -3
  147. data/lib/rubygems/config_file.rb +1 -1
  148. data/lib/rubygems/dependency.rb +1 -1
  149. data/lib/rubygems/dependency_installer.rb +0 -77
  150. data/lib/rubygems/dependency_list.rb +1 -2
  151. data/lib/rubygems/deprecate.rb +74 -72
  152. data/lib/rubygems/doctor.rb +1 -1
  153. data/lib/rubygems/errors.rb +1 -1
  154. data/lib/rubygems/exceptions.rb +2 -3
  155. data/lib/rubygems/ext/builder.rb +6 -2
  156. data/lib/rubygems/ext/cargo_builder.rb +2 -2
  157. data/lib/rubygems/ext/cmake_builder.rb +97 -8
  158. data/lib/rubygems/ext/configure_builder.rb +2 -2
  159. data/lib/rubygems/ext/ext_conf_builder.rb +6 -2
  160. data/lib/rubygems/ext/rake_builder.rb +2 -2
  161. data/lib/rubygems/gem_runner.rb +0 -1
  162. data/lib/rubygems/install_update_options.rb +1 -2
  163. data/lib/rubygems/installer.rb +16 -54
  164. data/lib/rubygems/name_tuple.rb +7 -1
  165. data/lib/rubygems/package/tar_header.rb +4 -4
  166. data/lib/rubygems/package/tar_reader.rb +2 -0
  167. data/lib/rubygems/package/tar_writer.rb +1 -1
  168. data/lib/rubygems/package.rb +21 -12
  169. data/lib/rubygems/platform.rb +31 -11
  170. data/lib/rubygems/remote_fetcher.rb +8 -5
  171. data/lib/rubygems/resolver/conflict.rb +1 -1
  172. data/lib/rubygems/resolver.rb +1 -1
  173. data/lib/rubygems/security/signer.rb +1 -1
  174. data/lib/rubygems/source.rb +2 -2
  175. data/lib/rubygems/spec_fetcher.rb +4 -4
  176. data/lib/rubygems/specification.rb +5 -96
  177. data/lib/rubygems/specification_policy.rb +0 -36
  178. data/lib/rubygems/specification_record.rb +1 -1
  179. data/lib/rubygems/text.rb +1 -1
  180. data/lib/rubygems/uninstaller.rb +17 -6
  181. data/lib/rubygems/user_interaction.rb +6 -9
  182. data/lib/rubygems/util.rb +0 -22
  183. data/lib/rubygems/validator.rb +1 -1
  184. data/lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb +25 -9
  185. data/lib/rubygems/vendor/net-http/lib/net/http/responses.rb +2 -2
  186. data/lib/rubygems/vendor/net-http/lib/net/http.rb +14 -14
  187. data/lib/rubygems/vendor/optparse/lib/optparse.rb +82 -41
  188. data/lib/rubygems/vendor/resolv/lib/resolv.rb +1 -1
  189. data/lib/rubygems/vendor/timeout/lib/timeout.rb +4 -1
  190. data/lib/rubygems/vendor/uri/lib/uri/common.rb +57 -15
  191. data/lib/rubygems/vendor/uri/lib/uri/file.rb +1 -1
  192. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +34 -21
  193. data/lib/rubygems/vendor/uri/lib/uri/http.rb +12 -0
  194. data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  195. data/lib/rubygems/vendor/uri/lib/uri/version.rb +2 -2
  196. data/lib/rubygems/version.rb +8 -20
  197. data/lib/rubygems/win_platform.rb +31 -0
  198. data/lib/rubygems.rb +12 -40
  199. data/rubygems-update.gemspec +6 -4
  200. metadata +10 -18
  201. data/bundler/lib/bundler/cli/inject.rb +0 -60
  202. data/bundler/lib/bundler/cli/viz.rb +0 -31
  203. data/bundler/lib/bundler/graph.rb +0 -152
  204. data/bundler/lib/bundler/man/bundle-inject.1 +0 -31
  205. data/bundler/lib/bundler/man/bundle-inject.1.ronn +0 -32
  206. data/bundler/lib/bundler/man/bundle-viz.1 +0 -30
  207. data/bundler/lib/bundler/man/bundle-viz.1.ronn +0 -36
  208. data/bundler/lib/bundler/similarity_detector.rb +0 -63
  209. data/lib/rubygems/commands/query_command.rb +0 -43
  210. data/lib/rubygems/compatibility.rb +0 -41
  211. data/lib/rubygems/install_default_message.rb +0 -13
@@ -1,3 +1,3 @@
1
1
  class Bundler::ConnectionPool
2
- VERSION = "2.5.0"
2
+ VERSION = "2.5.4"
3
3
  end
@@ -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
- INSTANCES[self] = self if INSTANCES
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
- @available.push(::Thread.current[@key])
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.7.3"
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' : ''} #{[src,dest].flatten.join ' '}" if verbose
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
- options = "#{force ? 'f' : ''}#{target_directory ? '' : 'T'}"
734
- dest = File.path(dest)
735
- srcs = Array(src)
736
- link = proc do |s, target_dir_p = true|
737
- s = File.path(s)
738
- if target_dir_p
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 = File.dirname(d = dest)
741
+ destdirs ||= fu_split_path(dest)
742
+ real_ddirs ||= fu_split_path(File.realdirpath(dest))
742
743
  end
743
- destdirs = fu_split_path(File.realpath(destdirs))
744
- if fu_starting_path?(s)
745
- srcdirs = fu_split_path((File.realdirpath(s) rescue File.expand_path(s)))
746
- base = fu_relative_components_from(srcdirs, destdirs)
747
- s = File.join(*base)
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
- srcdirs = fu_clean_components(*fu_split_path(s))
750
- base = fu_relative_components_from(fu_split_path(Dir.pwd), destdirs)
751
- while srcdirs.first&. == ".." and base.last&.!=("..") and !fu_starting_path?(base.last)
752
- srcdirs.shift
753
- base.pop
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
- fu_output_message "ln -s#{options} #{s} #{d}" if verbose
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
- # Keyword arguments:
799
+ # Optional arguments:
804
800
  #
805
- # - <tt>dereference_root: true</tt> - dereferences +src+ if it is a symbolic link.
806
- # - <tt>remove_destination: true</tt> - removes +dest+ before creating links.
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 keyword argument <tt>remove_destination: true</tt> is not given.
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
- # Keyword arguments:
1028
+ # Optional arguments:
1033
1029
  #
1034
- # - <tt>dereference_root: true</tt> - if +src+ is a symbolic link,
1035
- # follows the link.
1036
- # - <tt>preserve: true</tt> - preserves file times.
1037
- # - <tt>remove_destination: true</tt> - removes +dest+ before copying files.
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
- # Keyword arguments:
1064
+ # Optional arguments:
1069
1065
  #
1070
- # - <tt>dereference: false</tt> - if +src+ is a symbolic link,
1071
- # does not follow the link.
1072
- # - <tt>preserve: true</tt> - preserves file times.
1073
- # - <tt>remove_destination: true</tt> - removes +dest+ before copying files.
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
- remove_entry path, force # FIXME?? check if it is a directory
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 << base
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 fu_relative_components_from(target, base) #:nodoc:
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
- Array.new(base.size-i, '..').concat(target[i..-1])
2530
+ i
2526
2531
  end
2527
- private_module_function :fu_relative_components_from
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.chomp!(%r((?<=\A|/)[^/]+/\z), "")
2542
+ path.sub!(%r((?<=\A|/)[^/]+/\z), "")
2538
2543
  else
2539
2544
  clean << c
2540
2545
  path << c << "/"
@@ -1,7 +1,10 @@
1
1
  require_relative '../../../../../vendored_net_http'
2
2
  require_relative '../../../../../vendored_uri'
3
- require 'cgi/escape'
4
- require 'cgi/util' unless defined?(CGI::EscapeExt)
3
+ begin
4
+ require 'cgi/escape'
5
+ rescue LoadError
6
+ require 'cgi/util' # for escaping
7
+ end
5
8
  require_relative '../../../../connection_pool/lib/connection_pool'
6
9
 
7
10
  autoload :OpenSSL, 'openssl'
@@ -2,7 +2,7 @@ require_relative "../thor"
2
2
  require_relative "group"
3
3
 
4
4
  require "digest/sha2"
5
- require "pathname"
5
+ require "pathname" unless defined?(Pathname)
6
6
 
7
7
  class Bundler::Thor::Runner < Bundler::Thor #:nodoc:
8
8
  map "-T" => :list, "-i" => :install, "-u" => :update, "-v" => :version
@@ -30,6 +30,9 @@ module Bundler::URI
30
30
  remove_const(:Parser) if defined?(::Bundler::URI::Parser)
31
31
  const_set("Parser", parser.class)
32
32
 
33
+ remove_const(:PARSER) if defined?(::Bundler::URI::PARSER)
34
+ const_set("PARSER", parser)
35
+
33
36
  remove_const(:REGEXP) if defined?(::Bundler::URI::REGEXP)
34
37
  remove_const(:PATTERN) if defined?(::Bundler::URI::PATTERN)
35
38
  if Parser == RFC2396_Parser
@@ -49,10 +52,10 @@ module Bundler::URI
49
52
  warn "Bundler::URI::REGEXP is obsolete. Use Bundler::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
50
53
  Bundler::URI::RFC2396_REGEXP
51
54
  elsif value = RFC2396_PARSER.regexp[const]
52
- warn "Bundler::URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
55
+ warn "Bundler::URI::#{const} is obsolete. Use Bundler::URI::RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
53
56
  value
54
57
  elsif value = RFC2396_Parser.const_get(const)
55
- warn "Bundler::URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
58
+ warn "Bundler::URI::#{const} is obsolete. Use Bundler::URI::RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
56
59
  value
57
60
  else
58
61
  super
@@ -92,6 +95,40 @@ module Bundler::URI
92
95
  end
93
96
 
94
97
  module Schemes # :nodoc:
98
+ class << self
99
+ ReservedChars = ".+-"
100
+ EscapedChars = "\u01C0\u01C1\u01C2"
101
+ # Use Lo category chars as escaped chars for TruffleRuby, which
102
+ # does not allow Symbol categories as identifiers.
103
+
104
+ def escape(name)
105
+ unless name and name.ascii_only?
106
+ return nil
107
+ end
108
+ name.upcase.tr(ReservedChars, EscapedChars)
109
+ end
110
+
111
+ def unescape(name)
112
+ name.tr(EscapedChars, ReservedChars).encode(Encoding::US_ASCII).upcase
113
+ end
114
+
115
+ def find(name)
116
+ const_get(name, false) if name and const_defined?(name, false)
117
+ end
118
+
119
+ def register(name, klass)
120
+ unless scheme = escape(name)
121
+ raise ArgumentError, "invalid character as scheme - #{name}"
122
+ end
123
+ const_set(scheme, klass)
124
+ end
125
+
126
+ def list
127
+ constants.map { |name|
128
+ [unescape(name.to_s), const_get(name)]
129
+ }.to_h
130
+ end
131
+ end
95
132
  end
96
133
  private_constant :Schemes
97
134
 
@@ -104,7 +141,7 @@ module Bundler::URI
104
141
  # Note that after calling String#upcase on +scheme+, it must be a valid
105
142
  # constant name.
106
143
  def self.register_scheme(scheme, klass)
107
- Schemes.const_set(scheme.to_s.upcase, klass)
144
+ Schemes.register(scheme, klass)
108
145
  end
109
146
 
110
147
  # Returns a hash of the defined schemes:
@@ -122,14 +159,14 @@ module Bundler::URI
122
159
  #
123
160
  # Related: Bundler::URI.register_scheme.
124
161
  def self.scheme_list
125
- Schemes.constants.map { |name|
126
- [name.to_s.upcase, Schemes.const_get(name)]
127
- }.to_h
162
+ Schemes.list
128
163
  end
129
164
 
165
+ # :stopdoc:
130
166
  INITIAL_SCHEMES = scheme_list
131
167
  private_constant :INITIAL_SCHEMES
132
168
  Ractor.make_shareable(INITIAL_SCHEMES) if defined?(Ractor)
169
+ # :startdoc:
133
170
 
134
171
  # Returns a new object constructed from the given +scheme+, +arguments+,
135
172
  # and +default+:
@@ -148,12 +185,10 @@ module Bundler::URI
148
185
  # # => #<Bundler::URI::HTTP foo://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
149
186
  #
150
187
  def self.for(scheme, *arguments, default: Generic)
151
- const_name = scheme.to_s.upcase
188
+ const_name = Schemes.escape(scheme)
152
189
 
153
190
  uri_class = INITIAL_SCHEMES[const_name]
154
- uri_class ||= if /\A[A-Z]\w*\z/.match?(const_name) && Schemes.const_defined?(const_name, false)
155
- Schemes.const_get(const_name, false)
156
- end
191
+ uri_class ||= Schemes.find(const_name)
157
192
  uri_class ||= default
158
193
 
159
194
  return uri_class.new(scheme, *arguments)
@@ -195,7 +230,7 @@ module Bundler::URI
195
230
  # ["fragment", "top"]]
196
231
  #
197
232
  def self.split(uri)
198
- DEFAULT_PARSER.split(uri)
233
+ PARSER.split(uri)
199
234
  end
200
235
 
201
236
  # Returns a new \Bundler::URI object constructed from the given string +uri+:
@@ -205,11 +240,11 @@ module Bundler::URI
205
240
  # Bundler::URI.parse('http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top')
206
241
  # # => #<Bundler::URI::HTTP http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
207
242
  #
208
- # It's recommended to first ::escape string +uri+
243
+ # It's recommended to first Bundler::URI::RFC2396_PARSER.escape string +uri+
209
244
  # if it may contain invalid Bundler::URI characters.
210
245
  #
211
246
  def self.parse(uri)
212
- DEFAULT_PARSER.parse(uri)
247
+ PARSER.parse(uri)
213
248
  end
214
249
 
215
250
  # Merges the given Bundler::URI strings +str+
@@ -265,7 +300,7 @@ module Bundler::URI
265
300
  #
266
301
  def self.extract(str, schemes = nil, &block) # :nodoc:
267
302
  warn "Bundler::URI.extract is obsolete", uplevel: 1 if $VERBOSE
268
- DEFAULT_PARSER.extract(str, schemes, &block)
303
+ PARSER.extract(str, schemes, &block)
269
304
  end
270
305
 
271
306
  #
@@ -302,7 +337,7 @@ module Bundler::URI
302
337
  #
303
338
  def self.regexp(schemes = nil)# :nodoc:
304
339
  warn "Bundler::URI.regexp is obsolete", uplevel: 1 if $VERBOSE
305
- DEFAULT_PARSER.make_regexp(schemes)
340
+ PARSER.make_regexp(schemes)
306
341
  end
307
342
 
308
343
  TBLENCWWWCOMP_ = {} # :nodoc:
@@ -407,6 +442,8 @@ module Bundler::URI
407
442
  _decode_uri_component(/%\h\h/, str, enc)
408
443
  end
409
444
 
445
+ # Returns a string derived from the given string +str+ with
446
+ # Bundler::URI-encoded characters matching +regexp+ according to +table+.
410
447
  def self._encode_uri_component(regexp, table, str, enc)
411
448
  str = str.to_s.dup
412
449
  if str.encoding != Encoding::ASCII_8BIT
@@ -421,6 +458,8 @@ module Bundler::URI
421
458
  end
422
459
  private_class_method :_encode_uri_component
423
460
 
461
+ # Returns a string decoding characters matching +regexp+ from the
462
+ # given \URL-encoded string +str+.
424
463
  def self._decode_uri_component(regexp, str, enc)
425
464
  raise ArgumentError, "invalid %-encoding (#{str})" if /%(?!\h\h)/.match?(str)
426
465
  str.b.gsub(regexp, TBLDECWWWCOMP_).force_encoding(enc)
@@ -859,6 +898,7 @@ module Bundler
859
898
  # Returns a \Bundler::URI object derived from the given +uri+,
860
899
  # which may be a \Bundler::URI string or an existing \Bundler::URI object:
861
900
  #
901
+ # require 'bundler/vendor/uri/lib/uri'
862
902
  # # Returns a new Bundler::URI.
863
903
  # uri = Bundler::URI('http://github.com/ruby/ruby')
864
904
  # # => #<Bundler::URI::HTTP http://github.com/ruby/ruby>
@@ -866,6 +906,8 @@ module Bundler
866
906
  # Bundler::URI(uri)
867
907
  # # => #<Bundler::URI::HTTP http://github.com/ruby/ruby>
868
908
  #
909
+ # You must require 'bundler/vendor/uri/lib/uri' to use this method.
910
+ #
869
911
  def URI(uri)
870
912
  if uri.is_a?(Bundler::URI::Generic)
871
913
  uri
@@ -47,7 +47,7 @@ module Bundler::URI
47
47
  # :path => '/ruby/src'})
48
48
  # uri2.to_s # => "file://host.example.com/ruby/src"
49
49
  #
50
- # uri3 = Bundler::URI::File.build({:path => Bundler::URI::escape('/path/my file.txt')})
50
+ # uri3 = Bundler::URI::File.build({:path => Bundler::URI::RFC2396_PARSER.escape('/path/my file.txt')})
51
51
  # uri3.to_s # => "file:///path/my%20file.txt"
52
52
  #
53
53
  def self.build(args)