rubygems-update 3.5.3 → 3.7.1

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 (437) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1410 -686
  3. data/CODE_OF_CONDUCT.md +79 -28
  4. data/CONTRIBUTING.md +4 -226
  5. data/Manifest.txt +107 -83
  6. data/README.md +16 -11
  7. data/SECURITY.md +7 -0
  8. data/bundler/CHANGELOG.md +1525 -931
  9. data/bundler/README.md +9 -9
  10. data/bundler/bundler.gemspec +2 -2
  11. data/bundler/lib/bundler/build_metadata.rb +10 -11
  12. data/bundler/lib/bundler/checksum.rb +22 -12
  13. data/bundler/lib/bundler/cli/add.rb +3 -1
  14. data/bundler/lib/bundler/cli/binstubs.rb +1 -1
  15. data/bundler/lib/bundler/cli/check.rb +3 -3
  16. data/bundler/lib/bundler/cli/common.rb +1 -1
  17. data/bundler/lib/bundler/cli/config.rb +2 -2
  18. data/bundler/lib/bundler/cli/console.rb +8 -10
  19. data/bundler/lib/bundler/cli/doctor/diagnose.rb +167 -0
  20. data/bundler/lib/bundler/cli/doctor/ssl.rb +249 -0
  21. data/bundler/lib/bundler/cli/doctor.rb +27 -151
  22. data/bundler/lib/bundler/cli/exec.rb +1 -0
  23. data/bundler/lib/bundler/cli/fund.rb +1 -1
  24. data/bundler/lib/bundler/cli/gem.rb +74 -46
  25. data/bundler/lib/bundler/cli/info.rb +6 -6
  26. data/bundler/lib/bundler/cli/inject.rb +3 -3
  27. data/bundler/lib/bundler/cli/install.rb +19 -10
  28. data/bundler/lib/bundler/cli/issue.rb +3 -3
  29. data/bundler/lib/bundler/cli/lock.rb +32 -11
  30. data/bundler/lib/bundler/cli/outdated.rb +23 -23
  31. data/bundler/lib/bundler/cli/plugin.rb +3 -2
  32. data/bundler/lib/bundler/cli/pristine.rb +1 -1
  33. data/bundler/lib/bundler/cli/show.rb +3 -3
  34. data/bundler/lib/bundler/cli/update.rb +3 -3
  35. data/bundler/lib/bundler/cli.rb +75 -145
  36. data/bundler/lib/bundler/compact_index_client/cache.rb +48 -73
  37. data/bundler/lib/bundler/compact_index_client/cache_file.rb +0 -5
  38. data/bundler/lib/bundler/compact_index_client/parser.rb +84 -0
  39. data/bundler/lib/bundler/compact_index_client/updater.rb +6 -16
  40. data/bundler/lib/bundler/compact_index_client.rb +52 -85
  41. data/bundler/lib/bundler/constants.rb +8 -1
  42. data/bundler/lib/bundler/current_ruby.rb +48 -34
  43. data/bundler/lib/bundler/definition.rb +501 -328
  44. data/bundler/lib/bundler/dependency.rb +93 -47
  45. data/bundler/lib/bundler/dsl.rb +147 -103
  46. data/bundler/lib/bundler/endpoint_specification.rb +30 -3
  47. data/bundler/lib/bundler/env.rb +1 -1
  48. data/bundler/lib/bundler/environment_preserver.rb +5 -23
  49. data/bundler/lib/bundler/errors.rb +53 -5
  50. data/bundler/lib/bundler/feature_flag.rb +18 -18
  51. data/bundler/lib/bundler/fetcher/compact_index.rb +16 -25
  52. data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
  53. data/bundler/lib/bundler/fetcher/downloader.rb +34 -8
  54. data/bundler/lib/bundler/fetcher.rb +63 -26
  55. data/bundler/lib/bundler/force_platform.rb +0 -2
  56. data/bundler/lib/bundler/friendly_errors.rb +3 -2
  57. data/bundler/lib/bundler/gem_helper.rb +1 -1
  58. data/bundler/lib/bundler/gem_version_promoter.rb +42 -40
  59. data/bundler/lib/bundler/index.rb +7 -2
  60. data/bundler/lib/bundler/injector.rb +14 -16
  61. data/bundler/lib/bundler/inline.rb +42 -17
  62. data/bundler/lib/bundler/installer/gem_installer.rb +4 -3
  63. data/bundler/lib/bundler/installer/parallel_installer.rb +3 -2
  64. data/bundler/lib/bundler/installer/standalone.rb +2 -5
  65. data/bundler/lib/bundler/installer.rb +22 -45
  66. data/bundler/lib/bundler/lazy_specification.rb +121 -48
  67. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  68. data/bundler/lib/bundler/lockfile_parser.rb +36 -9
  69. data/bundler/lib/bundler/man/bundle-add.1 +44 -27
  70. data/bundler/lib/bundler/man/bundle-add.1.ronn +52 -23
  71. data/bundler/lib/bundler/man/bundle-binstubs.1 +9 -6
  72. data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
  73. data/bundler/lib/bundler/man/bundle-cache.1 +32 -4
  74. data/bundler/lib/bundler/man/bundle-cache.1.ronn +31 -2
  75. data/bundler/lib/bundler/man/bundle-check.1 +7 -5
  76. data/bundler/lib/bundler/man/bundle-check.1.ronn +7 -2
  77. data/bundler/lib/bundler/man/bundle-clean.1 +3 -3
  78. data/bundler/lib/bundler/man/bundle-config.1 +180 -138
  79. data/bundler/lib/bundler/man/bundle-config.1.ronn +96 -99
  80. data/bundler/lib/bundler/man/bundle-console.1 +4 -6
  81. data/bundler/lib/bundler/man/bundle-console.1.ronn +2 -7
  82. data/bundler/lib/bundler/man/bundle-doctor.1 +46 -7
  83. data/bundler/lib/bundler/man/bundle-doctor.1.ronn +49 -5
  84. data/bundler/lib/bundler/man/bundle-env.1 +9 -0
  85. data/bundler/lib/bundler/man/bundle-env.1.ronn +10 -0
  86. data/bundler/lib/bundler/man/bundle-exec.1 +9 -6
  87. data/bundler/lib/bundler/man/bundle-exec.1.ronn +6 -3
  88. data/bundler/lib/bundler/man/bundle-fund.1 +22 -0
  89. data/bundler/lib/bundler/man/bundle-fund.1.ronn +25 -0
  90. data/bundler/lib/bundler/man/bundle-gem.1 +69 -28
  91. data/bundler/lib/bundler/man/bundle-gem.1.ronn +42 -6
  92. data/bundler/lib/bundler/man/bundle-help.1 +3 -3
  93. data/bundler/lib/bundler/man/bundle-info.1 +7 -4
  94. data/bundler/lib/bundler/man/bundle-info.1.ronn +6 -2
  95. data/bundler/lib/bundler/man/bundle-init.1 +5 -5
  96. data/bundler/lib/bundler/man/bundle-init.1.ronn +3 -2
  97. data/bundler/lib/bundler/man/bundle-inject.1 +13 -5
  98. data/bundler/lib/bundler/man/bundle-inject.1.ronn +10 -2
  99. data/bundler/lib/bundler/man/bundle-install.1 +20 -17
  100. data/bundler/lib/bundler/man/bundle-install.1.ronn +26 -23
  101. data/bundler/lib/bundler/man/bundle-issue.1 +45 -0
  102. data/bundler/lib/bundler/man/bundle-issue.1.ronn +37 -0
  103. data/bundler/lib/bundler/man/bundle-licenses.1 +9 -0
  104. data/bundler/lib/bundler/man/bundle-licenses.1.ronn +10 -0
  105. data/bundler/lib/bundler/man/bundle-list.1 +3 -3
  106. data/bundler/lib/bundler/man/bundle-list.1.ronn +4 -1
  107. data/bundler/lib/bundler/man/bundle-lock.1 +23 -8
  108. data/bundler/lib/bundler/man/bundle-lock.1.ronn +25 -4
  109. data/bundler/lib/bundler/man/bundle-open.1 +4 -4
  110. data/bundler/lib/bundler/man/bundle-open.1.ronn +2 -1
  111. data/bundler/lib/bundler/man/bundle-outdated.1 +10 -7
  112. data/bundler/lib/bundler/man/bundle-outdated.1.ronn +8 -4
  113. data/bundler/lib/bundler/man/bundle-platform.1 +3 -3
  114. data/bundler/lib/bundler/man/bundle-plugin.1 +9 -6
  115. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +7 -3
  116. data/bundler/lib/bundler/man/bundle-pristine.1 +3 -3
  117. data/bundler/lib/bundler/man/bundle-pristine.1.ronn +1 -1
  118. data/bundler/lib/bundler/man/bundle-remove.1 +3 -3
  119. data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -1
  120. data/bundler/lib/bundler/man/bundle-show.1 +7 -4
  121. data/bundler/lib/bundler/man/bundle-show.1.ronn +4 -0
  122. data/bundler/lib/bundler/man/bundle-update.1 +17 -11
  123. data/bundler/lib/bundler/man/bundle-update.1.ronn +17 -9
  124. data/bundler/lib/bundler/man/bundle-version.1 +3 -3
  125. data/bundler/lib/bundler/man/bundle-viz.1 +6 -6
  126. data/bundler/lib/bundler/man/bundle-viz.1.ronn +7 -3
  127. data/bundler/lib/bundler/man/bundle.1 +3 -3
  128. data/bundler/lib/bundler/man/gemfile.5 +7 -5
  129. data/bundler/lib/bundler/man/gemfile.5.ronn +8 -2
  130. data/bundler/lib/bundler/man/index.txt +4 -0
  131. data/bundler/lib/bundler/match_metadata.rb +13 -0
  132. data/bundler/lib/bundler/match_platform.rb +31 -12
  133. data/bundler/lib/bundler/materialization.rb +59 -0
  134. data/bundler/lib/bundler/mirror.rb +3 -3
  135. data/bundler/lib/bundler/plugin/api/source.rb +5 -4
  136. data/bundler/lib/bundler/plugin/events.rb +24 -0
  137. data/bundler/lib/bundler/plugin/index.rb +5 -1
  138. data/bundler/lib/bundler/plugin/installer/path.rb +26 -0
  139. data/bundler/lib/bundler/plugin/installer.rb +37 -17
  140. data/bundler/lib/bundler/plugin/source_list.rb +4 -4
  141. data/bundler/lib/bundler/plugin.rb +21 -2
  142. data/bundler/lib/bundler/process_lock.rb +10 -14
  143. data/bundler/lib/bundler/remote_specification.rb +6 -1
  144. data/bundler/lib/bundler/resolver/base.rb +14 -3
  145. data/bundler/lib/bundler/resolver/candidate.rb +18 -27
  146. data/bundler/lib/bundler/resolver/package.rb +20 -3
  147. data/bundler/lib/bundler/resolver/spec_group.rb +22 -27
  148. data/bundler/lib/bundler/resolver/strategy.rb +40 -0
  149. data/bundler/lib/bundler/resolver.rb +114 -52
  150. data/bundler/lib/bundler/retry.rb +1 -1
  151. data/bundler/lib/bundler/ruby_dsl.rb +12 -3
  152. data/bundler/lib/bundler/ruby_version.rb +7 -1
  153. data/bundler/lib/bundler/rubygems_ext.rb +303 -150
  154. data/bundler/lib/bundler/rubygems_gem_installer.rb +40 -5
  155. data/bundler/lib/bundler/rubygems_integration.rb +40 -73
  156. data/bundler/lib/bundler/runtime.rb +48 -35
  157. data/bundler/lib/bundler/self_manager.rb +36 -26
  158. data/bundler/lib/bundler/settings/validator.rb +0 -23
  159. data/bundler/lib/bundler/settings.rb +36 -27
  160. data/bundler/lib/bundler/setup.rb +6 -0
  161. data/bundler/lib/bundler/shared_helpers.rb +45 -25
  162. data/bundler/lib/bundler/source/gemspec.rb +1 -4
  163. data/bundler/lib/bundler/source/git/git_proxy.rb +26 -9
  164. data/bundler/lib/bundler/source/git.rb +113 -41
  165. data/bundler/lib/bundler/source/metadata.rb +4 -3
  166. data/bundler/lib/bundler/source/path.rb +14 -18
  167. data/bundler/lib/bundler/source/rubygems/remote.rb +12 -4
  168. data/bundler/lib/bundler/source/rubygems.rb +54 -48
  169. data/bundler/lib/bundler/source.rb +2 -0
  170. data/bundler/lib/bundler/source_list.rb +54 -12
  171. data/bundler/lib/bundler/source_map.rb +1 -1
  172. data/bundler/lib/bundler/spec_set.rb +227 -103
  173. data/bundler/lib/bundler/stub_specification.rb +29 -2
  174. data/bundler/lib/bundler/templates/Executable +0 -11
  175. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +77 -29
  176. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -3
  177. data/bundler/lib/bundler/templates/newgem/README.md.tt +7 -3
  178. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +17 -15
  179. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +14 -12
  180. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
  181. data/bundler/lib/bundler/ui/shell.rb +26 -4
  182. data/bundler/lib/bundler/ui/silent.rb +12 -1
  183. data/bundler/lib/bundler/uri_credentials_filter.rb +3 -3
  184. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +53 -3
  185. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  186. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +11 -0
  187. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
  188. data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  189. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
  190. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +134 -57
  191. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +4 -24
  192. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +1 -0
  193. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
  194. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +20 -8
  195. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +17 -29
  196. data/bundler/lib/bundler/vendor/securerandom/COPYING +56 -0
  197. data/bundler/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
  198. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
  199. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
  200. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
  201. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
  202. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
  203. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
  204. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  205. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
  206. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  207. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  208. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +11 -0
  209. data/bundler/lib/bundler/vendor/uri/COPYING +56 -0
  210. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +43 -16
  211. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
  212. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
  213. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +28 -37
  214. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
  215. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +16 -9
  216. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
  217. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  218. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +9 -9
  219. data/bundler/lib/bundler/vendored_net_http.rb +20 -5
  220. data/bundler/lib/bundler/vendored_securerandom.rb +12 -0
  221. data/bundler/lib/bundler/vendored_timeout.rb +7 -3
  222. data/bundler/lib/bundler/vendored_uri.rb +18 -1
  223. data/bundler/lib/bundler/version.rb +10 -2
  224. data/bundler/lib/bundler/worker.rb +1 -1
  225. data/bundler/lib/bundler/yaml_serializer.rb +12 -7
  226. data/bundler/lib/bundler.rb +101 -61
  227. data/{bundler → doc/bundler}/UPGRADING.md +132 -127
  228. data/doc/rubygems/CONTRIBUTING.md +227 -0
  229. data/{POLICIES.md → doc/rubygems/POLICIES.md} +86 -17
  230. data/exe/update_rubygems +1 -1
  231. data/lib/rubygems/basic_specification.rb +50 -10
  232. data/lib/rubygems/bundler_version_finder.rb +1 -1
  233. data/lib/rubygems/command.rb +1 -4
  234. data/lib/rubygems/command_manager.rb +5 -6
  235. data/lib/rubygems/commands/build_command.rb +2 -11
  236. data/lib/rubygems/commands/cleanup_command.rb +3 -13
  237. data/lib/rubygems/commands/contents_command.rb +17 -10
  238. data/lib/rubygems/commands/environment_command.rb +5 -0
  239. data/lib/rubygems/commands/exec_command.rb +18 -11
  240. data/lib/rubygems/commands/fetch_command.rb +14 -0
  241. data/lib/rubygems/commands/help_command.rb +2 -2
  242. data/lib/rubygems/commands/install_command.rb +0 -4
  243. data/lib/rubygems/commands/pristine_command.rb +29 -19
  244. data/lib/rubygems/commands/push_command.rb +31 -6
  245. data/lib/rubygems/commands/rdoc_command.rb +3 -10
  246. data/lib/rubygems/commands/rebuild_command.rb +262 -0
  247. data/lib/rubygems/commands/setup_command.rb +13 -18
  248. data/lib/rubygems/commands/sources_command.rb +2 -2
  249. data/lib/rubygems/commands/uninstall_command.rb +9 -4
  250. data/lib/rubygems/commands/unpack_command.rb +0 -6
  251. data/lib/rubygems/commands/update_command.rb +13 -22
  252. data/lib/rubygems/config_file.rb +45 -16
  253. data/lib/rubygems/core_ext/kernel_require.rb +15 -3
  254. data/lib/rubygems/core_ext/kernel_warn.rb +2 -6
  255. data/lib/rubygems/defaults.rb +7 -7
  256. data/lib/rubygems/dependency.rb +12 -16
  257. data/lib/rubygems/dependency_list.rb +1 -1
  258. data/lib/rubygems/deprecate.rb +79 -77
  259. data/lib/rubygems/errors.rb +2 -1
  260. data/lib/rubygems/exceptions.rb +2 -9
  261. data/lib/rubygems/ext/builder.rb +21 -8
  262. data/lib/rubygems/ext/cargo_builder.rb +16 -26
  263. data/lib/rubygems/ext/cmake_builder.rb +7 -2
  264. data/lib/rubygems/ext/configure_builder.rb +7 -2
  265. data/lib/rubygems/ext/ext_conf_builder.rb +9 -5
  266. data/lib/rubygems/ext/rake_builder.rb +7 -4
  267. data/lib/rubygems/gem_runner.rb +9 -0
  268. data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +11 -4
  269. data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +3 -1
  270. data/lib/rubygems/gemcutter_utilities.rb +52 -26
  271. data/lib/rubygems/gemspec_helpers.rb +19 -0
  272. data/lib/rubygems/install_update_options.rb +5 -0
  273. data/lib/rubygems/installer.rb +76 -90
  274. data/lib/rubygems/local_remote_options.rb +8 -8
  275. data/lib/rubygems/package/tar_header.rb +31 -4
  276. data/lib/rubygems/package/tar_reader/entry.rb +1 -5
  277. data/lib/rubygems/package/tar_writer.rb +5 -4
  278. data/lib/rubygems/package.rb +13 -8
  279. data/lib/rubygems/platform.rb +148 -43
  280. data/lib/rubygems/psych_tree.rb +4 -0
  281. data/lib/rubygems/query_utils.rb +2 -2
  282. data/lib/rubygems/rdoc.rb +16 -3
  283. data/lib/rubygems/remote_fetcher.rb +6 -7
  284. data/lib/rubygems/request.rb +5 -5
  285. data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
  286. data/lib/rubygems/request_set.rb +4 -7
  287. data/lib/rubygems/requirement.rb +16 -12
  288. data/lib/rubygems/resolver/activation_request.rb +1 -1
  289. data/lib/rubygems/resolver/api_set/gem_parser.rb +2 -5
  290. data/lib/rubygems/resolver/api_set.rb +13 -8
  291. data/lib/rubygems/resolver/best_set.rb +1 -29
  292. data/lib/rubygems/resolver/composed_set.rb +3 -3
  293. data/lib/rubygems/resolver/git_set.rb +0 -1
  294. data/lib/rubygems/resolver/index_set.rb +2 -2
  295. data/lib/rubygems/resolver/source_set.rb +1 -1
  296. data/lib/rubygems/resolver/spec_specification.rb +7 -0
  297. data/lib/rubygems/resolver.rb +8 -8
  298. data/lib/rubygems/s3_uri_signer.rb +8 -6
  299. data/lib/rubygems/safe_marshal/reader.rb +31 -14
  300. data/lib/rubygems/safe_marshal/visitors/to_ruby.rb +29 -16
  301. data/lib/rubygems/safe_yaml.rb +10 -1
  302. data/lib/rubygems/security.rb +1 -1
  303. data/lib/rubygems/source/git.rb +22 -17
  304. data/lib/rubygems/source/installed.rb +3 -1
  305. data/lib/rubygems/source/local.rb +8 -4
  306. data/lib/rubygems/source/specific_file.rb +5 -3
  307. data/lib/rubygems/source.rb +37 -29
  308. data/lib/rubygems/source_list.rb +1 -1
  309. data/lib/rubygems/spec_fetcher.rb +47 -15
  310. data/lib/rubygems/specification.rb +110 -183
  311. data/lib/rubygems/specification_policy.rb +33 -13
  312. data/lib/rubygems/specification_record.rb +212 -0
  313. data/lib/rubygems/stub_specification.rb +32 -10
  314. data/lib/rubygems/target_rbconfig.rb +50 -0
  315. data/lib/rubygems/uninstaller.rb +42 -22
  316. data/lib/rubygems/uri.rb +6 -6
  317. data/lib/rubygems/uri_formatter.rb +2 -1
  318. data/lib/rubygems/util/licenses.rb +118 -1
  319. data/lib/rubygems/util.rb +1 -1
  320. data/lib/rubygems/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
  321. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/delegates/specification_provider.rb +11 -11
  322. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
  323. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
  324. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
  325. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
  326. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  327. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/log.rb +1 -1
  328. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
  329. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
  330. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/vertex.rb +1 -1
  331. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  332. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/errors.rb +1 -1
  333. data/lib/rubygems/vendor/molinillo/lib/molinillo/gem_metadata.rb +6 -0
  334. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/specification_provider.rb +2 -2
  335. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/ui.rb +1 -1
  336. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolution.rb +4 -4
  337. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolver.rb +1 -1
  338. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/state.rb +1 -1
  339. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo.rb +2 -2
  340. data/lib/rubygems/vendor/net-http/COPYING +56 -0
  341. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/generic_request.rb +9 -9
  342. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/header.rb +3 -3
  343. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/request.rb +3 -3
  344. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/requests.rb +35 -30
  345. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/response.rb +2 -2
  346. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/responses.rb +6 -6
  347. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/status.rb +1 -1
  348. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http.rb +149 -70
  349. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/https.rb +1 -1
  350. data/lib/rubygems/vendor/optparse/COPYING +56 -0
  351. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/ac.rb +16 -0
  352. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/kwargs.rb +8 -3
  353. data/lib/rubygems/vendor/optparse/lib/optparse/uri.rb +7 -0
  354. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/version.rb +9 -0
  355. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse.rb +158 -62
  356. data/lib/rubygems/vendor/resolv/COPYING +56 -0
  357. data/lib/rubygems/{resolv → vendor/resolv}/lib/resolv.rb +165 -69
  358. data/lib/rubygems/vendor/securerandom/COPYING +56 -0
  359. data/lib/rubygems/vendor/securerandom/lib/securerandom.rb +102 -0
  360. data/lib/rubygems/vendor/timeout/COPYING +56 -0
  361. data/lib/rubygems/{timeout → vendor/timeout}/lib/timeout.rb +10 -11
  362. data/lib/rubygems/{tsort → vendor/tsort}/lib/tsort.rb +2 -2
  363. data/lib/rubygems/vendor/uri/COPYING +56 -0
  364. data/lib/rubygems/vendor/uri/lib/uri/common.rb +880 -0
  365. data/lib/rubygems/vendor/uri/lib/uri/file.rb +100 -0
  366. data/lib/rubygems/vendor/uri/lib/uri/ftp.rb +267 -0
  367. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +1579 -0
  368. data/lib/rubygems/vendor/uri/lib/uri/http.rb +125 -0
  369. data/lib/rubygems/vendor/uri/lib/uri/https.rb +23 -0
  370. data/lib/rubygems/vendor/uri/lib/uri/ldap.rb +261 -0
  371. data/lib/rubygems/vendor/uri/lib/uri/ldaps.rb +22 -0
  372. data/lib/rubygems/vendor/uri/lib/uri/mailto.rb +293 -0
  373. data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  374. data/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb +206 -0
  375. data/lib/rubygems/vendor/uri/lib/uri/version.rb +6 -0
  376. data/lib/rubygems/vendor/uri/lib/uri/ws.rb +83 -0
  377. data/lib/rubygems/vendor/uri/lib/uri/wss.rb +23 -0
  378. data/lib/rubygems/vendor/uri/lib/uri.rb +104 -0
  379. data/lib/rubygems/vendored_molinillo.rb +3 -0
  380. data/lib/rubygems/vendored_net_http.rb +5 -0
  381. data/lib/rubygems/vendored_optparse.rb +3 -0
  382. data/lib/rubygems/vendored_securerandom.rb +3 -0
  383. data/lib/rubygems/vendored_timeout.rb +5 -0
  384. data/lib/rubygems/vendored_tsort.rb +3 -0
  385. data/lib/rubygems/version.rb +26 -9
  386. data/lib/rubygems/yaml_serializer.rb +12 -7
  387. data/lib/rubygems.rb +160 -53
  388. data/rubygems-update.gemspec +11 -6
  389. data/setup.rb +1 -1
  390. metadata +124 -96
  391. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +0 -32
  392. data/bundler/lib/bundler/gem_helpers.rb +0 -127
  393. data/bundler/lib/bundler/templates/Executable.bundler +0 -109
  394. data/bundler/lib/bundler/vendor/fileutils/.document +0 -1
  395. data/bundler/lib/bundler/vendor/net-http-persistent/.document +0 -1
  396. data/bundler/lib/bundler/vendor/pub_grub/.document +0 -1
  397. data/bundler/lib/bundler/vendor/thor/.document +0 -1
  398. data/bundler/lib/bundler/vendor/tsort/.document +0 -1
  399. data/bundler/lib/bundler/vendor/uri/.document +0 -1
  400. data/lib/rubygems/net/http.rb +0 -3
  401. data/lib/rubygems/net-http/.document +0 -1
  402. data/lib/rubygems/net-http/LICENSE.txt +0 -22
  403. data/lib/rubygems/net-http/lib/net/http/backward.rb +0 -40
  404. data/lib/rubygems/net-protocol/.document +0 -1
  405. data/lib/rubygems/net-protocol/LICENSE.txt +0 -22
  406. data/lib/rubygems/optparse/.document +0 -1
  407. data/lib/rubygems/optparse/lib/optparse/uri.rb +0 -7
  408. data/lib/rubygems/optparse.rb +0 -3
  409. data/lib/rubygems/resolv/.document +0 -1
  410. data/lib/rubygems/resolv/LICENSE.txt +0 -22
  411. data/lib/rubygems/resolver/molinillo/.document +0 -1
  412. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  413. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  414. data/lib/rubygems/resolver/molinillo.rb +0 -3
  415. data/lib/rubygems/shellwords.rb +0 -3
  416. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem +0 -21
  417. data/lib/rubygems/timeout/.document +0 -1
  418. data/lib/rubygems/timeout/LICENSE.txt +0 -22
  419. data/lib/rubygems/timeout.rb +0 -3
  420. data/lib/rubygems/tsort/.document +0 -1
  421. data/lib/rubygems/tsort/LICENSE.txt +0 -22
  422. data/lib/rubygems/tsort.rb +0 -3
  423. /data/{lib/rubygems/optparse → bundler/lib/bundler/vendor/fileutils}/COPYING +0 -0
  424. /data/{MAINTAINERS.txt → doc/MAINTAINERS.txt} +0 -0
  425. /data/{UPGRADING.md → doc/rubygems/UPGRADING.md} +0 -0
  426. /data/lib/rubygems/ssl_certs/rubygems.org/{GlobalSignRootCA_R3.pem → GlobalSign.pem} +0 -0
  427. /data/{bundler/lib/bundler/vendor/connection_pool → lib/rubygems/vendor}/.document +0 -0
  428. /data/lib/rubygems/{resolver → vendor}/molinillo/LICENSE +0 -0
  429. /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/exceptions.rb +0 -0
  430. /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/proxy_delta.rb +0 -0
  431. /data/{bundler/lib/bundler/vendor/fileutils → lib/rubygems/vendor/net-protocol}/LICENSE.txt +0 -0
  432. /data/lib/rubygems/{net-protocol → vendor/net-protocol}/lib/net/protocol.rb +0 -0
  433. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optionparser.rb +0 -0
  434. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/date.rb +0 -0
  435. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/shellwords.rb +0 -0
  436. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/time.rb +0 -0
  437. /data/{bundler/lib/bundler/vendor/uri → lib/rubygems/vendor/tsort}/LICENSE.txt +0 -0
@@ -2,17 +2,20 @@ require_relative 'partial_solution'
2
2
  require_relative 'term'
3
3
  require_relative 'incompatibility'
4
4
  require_relative 'solve_failure'
5
+ require_relative 'strategy'
5
6
 
6
7
  module Bundler::PubGrub
7
8
  class VersionSolver
8
9
  attr_reader :logger
9
10
  attr_reader :source
10
11
  attr_reader :solution
12
+ attr_reader :strategy
11
13
 
12
- def initialize(source:, root: Package.root, logger: Bundler::PubGrub.logger)
14
+ def initialize(source:, root: Package.root, strategy: Strategy.new(source), logger: Bundler::PubGrub.logger)
13
15
  @logger = logger
14
16
 
15
17
  @source = source
18
+ @strategy = strategy
16
19
 
17
20
  # { package => [incompatibility, ...]}
18
21
  @incompatibilities = Hash.new do |h, k|
@@ -36,26 +39,25 @@ module Bundler::PubGrub
36
39
 
37
40
  # Returns true if there is more work to be done, false otherwise
38
41
  def work
39
- return false if solved?
40
-
41
- next_package = choose_package_version
42
- propagate(next_package)
43
-
44
- if solved?
42
+ unsatisfied_terms = solution.unsatisfied
43
+ if unsatisfied_terms.empty?
45
44
  logger.info { "Solution found after #{solution.attempted_solutions} attempts:" }
46
45
  solution.decisions.each do |package, version|
47
46
  next if Package.root?(package)
48
47
  logger.info { "* #{package} #{version}" }
49
48
  end
50
49
 
51
- false
52
- else
53
- true
50
+ return false
54
51
  end
52
+
53
+ next_package = choose_package_version_from(unsatisfied_terms)
54
+ propagate(next_package)
55
+
56
+ true
55
57
  end
56
58
 
57
59
  def solve
58
- work until solved?
60
+ while work; end
59
61
 
60
62
  solution.decisions
61
63
  end
@@ -105,29 +107,15 @@ module Bundler::PubGrub
105
107
  unsatisfied.package
106
108
  end
107
109
 
108
- def next_package_to_try
109
- solution.unsatisfied.min_by do |term|
110
- package = term.package
111
- range = term.constraint.range
112
- matching_versions = source.versions_for(package, range)
113
- higher_versions = source.versions_for(package, range.upper_invert)
110
+ def choose_package_version_from(unsatisfied_terms)
111
+ remaining = unsatisfied_terms.map { |t| [t.package, t.constraint.range] }.to_h
114
112
 
115
- [matching_versions.count <= 1 ? 0 : 1, higher_versions.count]
116
- end.package
117
- end
118
-
119
- def choose_package_version
120
- if solution.unsatisfied.empty?
121
- logger.info "No packages unsatisfied. Solving complete!"
122
- return nil
123
- end
113
+ package, version = strategy.next_package_and_version(remaining)
124
114
 
125
- package = next_package_to_try
126
- unsatisfied_term = solution.unsatisfied.find { |t| t.package == package }
127
- version = source.versions_for(package, unsatisfied_term.constraint.range).first
128
115
  logger.debug { "attempting #{package} #{version}" }
129
116
 
130
117
  if version.nil?
118
+ unsatisfied_term = unsatisfied_terms.find { |t| t.package == package }
131
119
  add_incompatibility source.no_versions_incompatibility_for(package, unsatisfied_term)
132
120
  return package
133
121
  end
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
@@ -0,0 +1,102 @@
1
+ # -*- coding: us-ascii -*-
2
+ # frozen_string_literal: true
3
+
4
+ require 'random/formatter'
5
+
6
+ # == Secure random number generator interface.
7
+ #
8
+ # This library is an interface to secure random number generators which are
9
+ # suitable for generating session keys in HTTP cookies, etc.
10
+ #
11
+ # You can use this library in your application by requiring it:
12
+ #
13
+ # require 'bundler/vendor/securerandom/lib/securerandom'
14
+ #
15
+ # It supports the following secure random number generators:
16
+ #
17
+ # * openssl
18
+ # * /dev/urandom
19
+ # * Win32
20
+ #
21
+ # Bundler::SecureRandom is extended by the Random::Formatter module which
22
+ # defines the following methods:
23
+ #
24
+ # * alphanumeric
25
+ # * base64
26
+ # * choose
27
+ # * gen_random
28
+ # * hex
29
+ # * rand
30
+ # * random_bytes
31
+ # * random_number
32
+ # * urlsafe_base64
33
+ # * uuid
34
+ #
35
+ # These methods are usable as class methods of Bundler::SecureRandom such as
36
+ # +Bundler::SecureRandom.hex+.
37
+ #
38
+ # If a secure random number generator is not available,
39
+ # +NotImplementedError+ is raised.
40
+
41
+ module Bundler::SecureRandom
42
+
43
+ # The version
44
+ VERSION = "0.4.1"
45
+
46
+ class << self
47
+ # Returns a random binary string containing +size+ bytes.
48
+ #
49
+ # See Random.bytes
50
+ def bytes(n)
51
+ return gen_random(n)
52
+ end
53
+
54
+ # Compatibility methods for Ruby 3.2, we can remove this after dropping to support Ruby 3.2
55
+ def alphanumeric(n = nil, chars: ALPHANUMERIC)
56
+ n = 16 if n.nil?
57
+ choose(chars, n)
58
+ end if RUBY_VERSION < '3.3'
59
+
60
+ private
61
+
62
+ # :stopdoc:
63
+
64
+ # Implementation using OpenSSL
65
+ def gen_random_openssl(n)
66
+ return OpenSSL::Random.random_bytes(n)
67
+ end
68
+
69
+ # Implementation using system random device
70
+ def gen_random_urandom(n)
71
+ ret = Random.urandom(n)
72
+ unless ret
73
+ raise NotImplementedError, "No random device"
74
+ end
75
+ unless ret.length == n
76
+ raise NotImplementedError, "Unexpected partial read from random device: only #{ret.length} for #{n} bytes"
77
+ end
78
+ ret
79
+ end
80
+
81
+ begin
82
+ # Check if Random.urandom is available
83
+ Random.urandom(1)
84
+ alias gen_random gen_random_urandom
85
+ rescue RuntimeError
86
+ begin
87
+ require 'openssl'
88
+ rescue NoMethodError
89
+ raise NotImplementedError, "No random device"
90
+ else
91
+ alias gen_random gen_random_openssl
92
+ end
93
+ end
94
+
95
+ # :startdoc:
96
+
97
+ # Generate random data bytes for Random::Formatter
98
+ public :gen_random
99
+ end
100
+ end
101
+
102
+ Bundler::SecureRandom.extend(Random::Formatter)
@@ -10,7 +10,6 @@ class Bundler::Thor
10
10
  # destination<String>:: the relative path to the destination root.
11
11
  # config<Hash>:: give :verbose => false to not log the status, and
12
12
  # :mode => :preserve, to preserve the file mode from the source.
13
-
14
13
  #
15
14
  # ==== Examples
16
15
  #
@@ -275,9 +274,8 @@ class Bundler::Thor
275
274
  end
276
275
  end
277
276
 
278
- # Uncomment all lines matching a given regex. It will leave the space
279
- # which existed before the comment hash in tact but will remove any spacing
280
- # between the comment hash and the beginning of the line.
277
+ # Uncomment all lines matching a given regex. Preserves indentation before
278
+ # the comment hash and removes the hash and any immediate following space.
281
279
  #
282
280
  # ==== Parameters
283
281
  # path<String>:: path of the file to be changed
@@ -291,7 +289,7 @@ class Bundler::Thor
291
289
  def uncomment_lines(path, flag, *args)
292
290
  flag = flag.respond_to?(:source) ? flag.source : flag
293
291
 
294
- gsub_file(path, /^(\s*)#[[:blank:]]*(.*#{flag})/, '\1\2', *args)
292
+ gsub_file(path, /^(\s*)#[[:blank:]]?(.*#{flag})/, '\1\2', *args)
295
293
  end
296
294
 
297
295
  # Comment all lines matching a given regex. It will leave the space
@@ -211,6 +211,17 @@ class Bundler::Thor::Group
211
211
  raise error, msg
212
212
  end
213
213
 
214
+ # Checks if a specified command exists.
215
+ #
216
+ # ==== Parameters
217
+ # command_name<String>:: The name of the command to check for existence.
218
+ #
219
+ # ==== Returns
220
+ # Boolean:: +true+ if the command exists, +false+ otherwise.
221
+ def command_exists?(command_name) #:nodoc:
222
+ commands.keys.include?(command_name)
223
+ end
224
+
214
225
  protected
215
226
 
216
227
  # The method responsible for dispatching given the args.
@@ -26,10 +26,7 @@ class Bundler::Thor
26
26
 
27
27
  def print_default
28
28
  if @type == :array and @default.is_a?(Array)
29
- @default.map { |x|
30
- p = x.gsub('"','\\"')
31
- "\"#{p}\""
32
- }.join(" ")
29
+ @default.map(&:dump).join(" ")
33
30
  else
34
31
  @default
35
32
  end
@@ -89,8 +89,8 @@ class Bundler::Thor
89
89
 
90
90
  sample = "[#{sample}]".dup unless required?
91
91
 
92
- if boolean?
93
- sample << ", [#{dasherize('no-' + human_name)}]" unless (name == "force") || name.match(/\Ano[\-_]/)
92
+ if boolean? && name != "force" && !name.match(/\A(no|skip)[\-_]/)
93
+ sample << ", [#{dasherize('no-' + human_name)}], [#{dasherize('skip-' + human_name)}]"
94
94
  end
95
95
 
96
96
  aliases_for_usage.ljust(padding) + sample
@@ -250,7 +250,8 @@ class Bundler::Thor
250
250
  @parsing_options
251
251
  end
252
252
 
253
- # Parse boolean values which can be given as --foo=true, --foo or --no-foo.
253
+ # Parse boolean values which can be given as --foo=true or --foo for true values, or
254
+ # --foo=false, --no-foo or --skip-foo for false values.
254
255
  #
255
256
  def parse_boolean(switch)
256
257
  if current_is_value?
@@ -67,15 +67,15 @@ class Bundler::Thor
67
67
  # Readline.
68
68
  #
69
69
  # ==== Example
70
- # ask("What is your name?")
70
+ # ask("What is your name?")
71
71
  #
72
- # ask("What is the planet furthest from the sun?", :default => "Pluto")
72
+ # ask("What is the planet furthest from the sun?", :default => "Neptune")
73
73
  #
74
- # ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
74
+ # ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
75
75
  #
76
- # ask("What is your password?", :echo => false)
76
+ # ask("What is your password?", :echo => false)
77
77
  #
78
- # ask("Where should the file be saved?", :path => true)
78
+ # ask("Where should the file be saved?", :path => true)
79
79
  #
80
80
  def ask(statement, *args)
81
81
  options = args.last.is_a?(Hash) ? args.pop : {}
@@ -93,7 +93,7 @@ class Bundler::Thor
93
93
  # are passed straight to puts (behavior got from Highline).
94
94
  #
95
95
  # ==== Example
96
- # say("I know you knew that.")
96
+ # say("I know you knew that.")
97
97
  #
98
98
  def say(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
99
99
  return if quiet?
@@ -110,7 +110,7 @@ class Bundler::Thor
110
110
  # are passed straight to puts (behavior got from Highline).
111
111
  #
112
112
  # ==== Example
113
- # say_error("error: something went wrong")
113
+ # say_error("error: something went wrong")
114
114
  #
115
115
  def say_error(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
116
116
  return if quiet?
@@ -143,14 +143,14 @@ class Bundler::Thor
143
143
  stdout.flush
144
144
  end
145
145
 
146
- # Make a question the to user and returns true if the user replies "y" or
146
+ # Asks the user a question and returns true if the user replies "y" or
147
147
  # "yes".
148
148
  #
149
149
  def yes?(statement, color = nil)
150
150
  !!(ask(statement, color, add_to_history: false) =~ is?(:yes))
151
151
  end
152
152
 
153
- # Make a question the to user and returns true if the user replies "n" or
153
+ # Asks the user a question and returns true if the user replies "n" or
154
154
  # "no".
155
155
  #
156
156
  def no?(statement, color = nil)
@@ -64,7 +64,7 @@ class Bundler::Thor
64
64
  # Ask something to the user and receives a response.
65
65
  #
66
66
  # ==== Example
67
- # ask("What is your name?")
67
+ # ask("What is your name?")
68
68
  #
69
69
  # TODO: Implement #ask for Bundler::Thor::Shell::HTML
70
70
  def ask(statement, color = nil)
@@ -102,33 +102,17 @@ class Bundler::Thor
102
102
 
103
103
  def truncate(string)
104
104
  return string unless @truncate
105
- as_unicode do
106
- chars = string.chars.to_a
107
- if chars.length <= @truncate
108
- chars.join
109
- else
110
- chars[0, @truncate - 3 - @indent].join + "..."
111
- end
105
+ chars = string.chars.to_a
106
+ if chars.length <= @truncate
107
+ chars.join
108
+ else
109
+ chars[0, @truncate - 3 - @indent].join + "..."
112
110
  end
113
111
  end
114
112
 
115
113
  def indentation
116
114
  " " * @indent
117
115
  end
118
-
119
- if "".respond_to?(:encode)
120
- def as_unicode
121
- yield
122
- end
123
- else
124
- def as_unicode
125
- old = $KCODE # rubocop:disable Style/GlobalVars
126
- $KCODE = "U" # rubocop:disable Style/GlobalVars
127
- yield
128
- ensure
129
- $KCODE = old # rubocop:disable Style/GlobalVars
130
- end
131
- end
132
116
  end
133
117
  end
134
118
  end
@@ -133,7 +133,7 @@ class Bundler::Thor
133
133
  *pieces, command = namespace.split(":")
134
134
  namespace = pieces.join(":")
135
135
  namespace = "default" if namespace.empty?
136
- klass = Bundler::Thor::Base.subclasses.detect { |thor| thor.namespace == namespace && thor.commands.keys.include?(command) }
136
+ klass = Bundler::Thor::Base.subclasses.detect { |thor| thor.namespace == namespace && thor.command_exists?(command) }
137
137
  end
138
138
  unless klass # look for a Bundler::Thor::Group with the right name
139
139
  klass = Bundler::Thor::Util.find_by_namespace(namespace)
@@ -1,3 +1,3 @@
1
1
  class Bundler::Thor
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.2"
3
3
  end
@@ -439,6 +439,17 @@ class Bundler::Thor
439
439
  command && disable_required_check.include?(command.name.to_sym)
440
440
  end
441
441
 
442
+ # Checks if a specified command exists.
443
+ #
444
+ # ==== Parameters
445
+ # command_name<String>:: The name of the command to check for existence.
446
+ #
447
+ # ==== Returns
448
+ # Boolean:: +true+ if the command exists, +false+ otherwise.
449
+ def command_exists?(command_name) #:nodoc:
450
+ commands.keys.include?(normalize_command_name(command_name))
451
+ end
452
+
442
453
  protected
443
454
 
444
455
  # Returns this class exclusive options array set.
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
@@ -13,24 +13,51 @@ require_relative "rfc2396_parser"
13
13
  require_relative "rfc3986_parser"
14
14
 
15
15
  module Bundler::URI
16
- include RFC2396_REGEXP
16
+ # The default parser instance for RFC 2396.
17
+ RFC2396_PARSER = RFC2396_Parser.new
18
+ Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
17
19
 
18
- REGEXP = RFC2396_REGEXP
19
- Parser = RFC2396_Parser
20
+ # The default parser instance for RFC 3986.
20
21
  RFC3986_PARSER = RFC3986_Parser.new
21
22
  Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
22
23
 
23
- # Bundler::URI::Parser.new
24
- DEFAULT_PARSER = Parser.new
25
- DEFAULT_PARSER.pattern.each_pair do |sym, str|
26
- unless REGEXP::PATTERN.const_defined?(sym)
27
- REGEXP::PATTERN.const_set(sym, str)
24
+ # The default parser instance.
25
+ DEFAULT_PARSER = RFC3986_PARSER
26
+ Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
27
+
28
+ # Set the default parser instance.
29
+ def self.parser=(parser = RFC3986_PARSER)
30
+ remove_const(:Parser) if defined?(::Bundler::URI::Parser)
31
+ const_set("Parser", parser.class)
32
+
33
+ remove_const(:REGEXP) if defined?(::Bundler::URI::REGEXP)
34
+ remove_const(:PATTERN) if defined?(::Bundler::URI::PATTERN)
35
+ if Parser == RFC2396_Parser
36
+ const_set("REGEXP", Bundler::URI::RFC2396_REGEXP)
37
+ const_set("PATTERN", Bundler::URI::RFC2396_REGEXP::PATTERN)
38
+ end
39
+
40
+ Parser.new.regexp.each_pair do |sym, str|
41
+ remove_const(sym) if const_defined?(sym, false)
42
+ const_set(sym, str)
28
43
  end
29
44
  end
30
- DEFAULT_PARSER.regexp.each_pair do |sym, str|
31
- const_set(sym, str)
45
+ self.parser = RFC3986_PARSER
46
+
47
+ def self.const_missing(const) # :nodoc:
48
+ if const == :REGEXP
49
+ warn "Bundler::URI::REGEXP is obsolete. Use Bundler::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
50
+ Bundler::URI::RFC2396_REGEXP
51
+ elsif value = RFC2396_PARSER.regexp[const]
52
+ warn "Bundler::URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
53
+ value
54
+ elsif value = RFC2396_Parser.const_get(const)
55
+ warn "Bundler::URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
56
+ value
57
+ else
58
+ super
59
+ end
32
60
  end
33
- Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
34
61
 
35
62
  module Util # :nodoc:
36
63
  def make_components_hash(klass, array_hash)
@@ -64,7 +91,7 @@ module Bundler::URI
64
91
  module_function :make_components_hash
65
92
  end
66
93
 
67
- module Schemes
94
+ module Schemes # :nodoc:
68
95
  end
69
96
  private_constant :Schemes
70
97
 
@@ -168,7 +195,7 @@ module Bundler::URI
168
195
  # ["fragment", "top"]]
169
196
  #
170
197
  def self.split(uri)
171
- RFC3986_PARSER.split(uri)
198
+ DEFAULT_PARSER.split(uri)
172
199
  end
173
200
 
174
201
  # Returns a new \Bundler::URI object constructed from the given string +uri+:
@@ -182,7 +209,7 @@ module Bundler::URI
182
209
  # if it may contain invalid Bundler::URI characters.
183
210
  #
184
211
  def self.parse(uri)
185
- RFC3986_PARSER.parse(uri)
212
+ DEFAULT_PARSER.parse(uri)
186
213
  end
187
214
 
188
215
  # Merges the given Bundler::URI strings +str+
@@ -209,7 +236,7 @@ module Bundler::URI
209
236
  # # => #<Bundler::URI::HTTP http://example.com/foo/bar>
210
237
  #
211
238
  def self.join(*str)
212
- RFC3986_PARSER.join(*str)
239
+ DEFAULT_PARSER.join(*str)
213
240
  end
214
241
 
215
242
  #
@@ -282,7 +309,7 @@ module Bundler::URI
282
309
  256.times do |i|
283
310
  TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
284
311
  end
285
- TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze
312
+ TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze # :nodoc:
286
313
  TBLENCWWWCOMP_[' '] = '+'
287
314
  TBLENCWWWCOMP_.freeze
288
315
  TBLDECWWWCOMP_ = {} # :nodoc:
@@ -70,17 +70,17 @@ module Bundler::URI
70
70
 
71
71
  # raise InvalidURIError
72
72
  def check_userinfo(user)
73
- raise Bundler::URI::InvalidURIError, "can not set userinfo for file Bundler::URI"
73
+ raise Bundler::URI::InvalidURIError, "cannot set userinfo for file Bundler::URI"
74
74
  end
75
75
 
76
76
  # raise InvalidURIError
77
77
  def check_user(user)
78
- raise Bundler::URI::InvalidURIError, "can not set user for file Bundler::URI"
78
+ raise Bundler::URI::InvalidURIError, "cannot set user for file Bundler::URI"
79
79
  end
80
80
 
81
81
  # raise InvalidURIError
82
82
  def check_password(user)
83
- raise Bundler::URI::InvalidURIError, "can not set password for file Bundler::URI"
83
+ raise Bundler::URI::InvalidURIError, "cannot set password for file Bundler::URI"
84
84
  end
85
85
 
86
86
  # do nothing
@@ -17,7 +17,7 @@ module Bundler::URI
17
17
  # This class will be redesigned because of difference of implementations;
18
18
  # the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it
19
19
  # is a good summary about the de facto spec.
20
- # http://tools.ietf.org/html/draft-hoffman-ftp-uri-04
20
+ # https://datatracker.ietf.org/doc/html/draft-hoffman-ftp-uri-04
21
21
  #
22
22
  class FTP < Generic
23
23
  # A Default port of 21 for Bundler::URI::FTP.