bundler 2.1.4 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (338) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2468 -1430
  3. data/README.md +8 -10
  4. data/bundler.gemspec +10 -13
  5. data/exe/bundle +7 -8
  6. data/exe/bundler +1 -1
  7. data/lib/bundler/.document +1 -0
  8. data/lib/bundler/build_metadata.rb +3 -11
  9. data/lib/bundler/cli/add.rb +2 -2
  10. data/lib/bundler/cli/binstubs.rb +6 -2
  11. data/lib/bundler/cli/cache.rb +3 -8
  12. data/lib/bundler/cli/check.rb +5 -3
  13. data/lib/bundler/cli/clean.rb +1 -1
  14. data/lib/bundler/cli/common.rb +32 -3
  15. data/lib/bundler/cli/config.rb +10 -1
  16. data/lib/bundler/cli/console.rb +3 -3
  17. data/lib/bundler/cli/doctor.rb +23 -6
  18. data/lib/bundler/cli/exec.rb +5 -10
  19. data/lib/bundler/cli/fund.rb +36 -0
  20. data/lib/bundler/cli/gem.rb +258 -45
  21. data/lib/bundler/cli/info.rb +38 -6
  22. data/lib/bundler/cli/init.rb +7 -3
  23. data/lib/bundler/cli/inject.rb +1 -1
  24. data/lib/bundler/cli/install.rb +27 -57
  25. data/lib/bundler/cli/issue.rb +5 -4
  26. data/lib/bundler/cli/list.rb +19 -11
  27. data/lib/bundler/cli/lock.rb +11 -4
  28. data/lib/bundler/cli/open.rb +1 -2
  29. data/lib/bundler/cli/outdated.rb +106 -79
  30. data/lib/bundler/cli/platform.rb +2 -2
  31. data/lib/bundler/cli/plugin.rb +10 -0
  32. data/lib/bundler/cli/pristine.rb +5 -0
  33. data/lib/bundler/cli/remove.rb +1 -2
  34. data/lib/bundler/cli/show.rb +2 -2
  35. data/lib/bundler/cli/update.rb +20 -9
  36. data/lib/bundler/cli/viz.rb +1 -1
  37. data/lib/bundler/cli.rb +149 -85
  38. data/lib/bundler/compact_index_client/cache.rb +7 -24
  39. data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  40. data/lib/bundler/compact_index_client/updater.rb +56 -51
  41. data/lib/bundler/compact_index_client.rb +3 -9
  42. data/lib/bundler/constants.rb +1 -1
  43. data/lib/bundler/current_ruby.rb +17 -6
  44. data/lib/bundler/definition.rb +343 -440
  45. data/lib/bundler/dependency.rb +23 -77
  46. data/lib/bundler/digest.rb +71 -0
  47. data/lib/bundler/dsl.rb +77 -85
  48. data/lib/bundler/endpoint_specification.rb +20 -14
  49. data/lib/bundler/env.rb +3 -3
  50. data/lib/bundler/environment_preserver.rb +30 -2
  51. data/lib/bundler/errors.rb +31 -14
  52. data/lib/bundler/feature_flag.rb +0 -9
  53. data/lib/bundler/fetcher/base.rb +7 -9
  54. data/lib/bundler/fetcher/compact_index.rb +20 -27
  55. data/lib/bundler/fetcher/dependency.rb +1 -1
  56. data/lib/bundler/fetcher/downloader.rb +11 -11
  57. data/lib/bundler/fetcher/index.rb +2 -30
  58. data/lib/bundler/fetcher.rb +24 -29
  59. data/lib/bundler/force_platform.rb +18 -0
  60. data/lib/bundler/friendly_errors.rb +45 -49
  61. data/lib/bundler/gem_helper.rb +53 -31
  62. data/lib/bundler/gem_helpers.rb +42 -24
  63. data/lib/bundler/gem_version_promoter.rb +54 -99
  64. data/lib/bundler/graph.rb +4 -4
  65. data/lib/bundler/index.rb +14 -52
  66. data/lib/bundler/injector.rb +40 -8
  67. data/lib/bundler/inline.rb +6 -15
  68. data/lib/bundler/installer/gem_installer.rb +19 -24
  69. data/lib/bundler/installer/parallel_installer.rb +32 -42
  70. data/lib/bundler/installer/standalone.rb +58 -11
  71. data/lib/bundler/installer.rb +47 -87
  72. data/lib/bundler/lazy_specification.rb +76 -35
  73. data/lib/bundler/lockfile_generator.rb +3 -3
  74. data/lib/bundler/lockfile_parser.rb +24 -49
  75. data/lib/bundler/man/.document +1 -0
  76. data/{man → lib/bundler/man}/bundle-add.1 +21 -5
  77. data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +16 -4
  78. data/{man → lib/bundler/man}/bundle-binstubs.1 +5 -3
  79. data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +2 -4
  80. data/{man → lib/bundler/man}/bundle-cache.1 +7 -1
  81. data/{man/bundle-cache.ronn → lib/bundler/man/bundle-cache.1.ronn} +7 -0
  82. data/{man → lib/bundler/man}/bundle-check.1 +1 -1
  83. data/{man → lib/bundler/man}/bundle-clean.1 +2 -2
  84. data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
  85. data/{man → lib/bundler/man}/bundle-config.1 +65 -47
  86. data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +74 -65
  87. data/lib/bundler/man/bundle-console.1 +53 -0
  88. data/lib/bundler/man/bundle-console.1.ronn +44 -0
  89. data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  90. data/{man → lib/bundler/man}/bundle-exec.1 +2 -2
  91. data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
  92. data/lib/bundler/man/bundle-gem.1 +105 -0
  93. data/lib/bundler/man/bundle-gem.1.ronn +117 -0
  94. data/lib/bundler/man/bundle-help.1 +13 -0
  95. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  96. data/{man → lib/bundler/man}/bundle-info.1 +1 -1
  97. data/{man → lib/bundler/man}/bundle-init.1 +1 -1
  98. data/{man → lib/bundler/man}/bundle-inject.1 +5 -2
  99. data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
  100. data/{man → lib/bundler/man}/bundle-install.1 +35 -33
  101. data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +33 -34
  102. data/{man → lib/bundler/man}/bundle-list.1 +7 -7
  103. data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
  104. data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  105. data/{man → lib/bundler/man}/bundle-open.1 +1 -1
  106. data/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
  107. data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
  108. data/{man → lib/bundler/man}/bundle-platform.1 +16 -6
  109. data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
  110. data/lib/bundler/man/bundle-plugin.1 +81 -0
  111. data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  112. data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  113. data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  114. data/{man → lib/bundler/man}/bundle-show.1 +1 -1
  115. data/{man → lib/bundler/man}/bundle-update.1 +5 -5
  116. data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +5 -4
  117. data/lib/bundler/man/bundle-version.1 +35 -0
  118. data/lib/bundler/man/bundle-version.1.ronn +24 -0
  119. data/{man → lib/bundler/man}/bundle-viz.1 +4 -1
  120. data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
  121. data/{man → lib/bundler/man}/bundle.1 +15 -10
  122. data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +12 -7
  123. data/{man → lib/bundler/man}/gemfile.5 +120 -83
  124. data/{man → lib/bundler/man}/gemfile.5.ronn +109 -88
  125. data/{man → lib/bundler/man}/index.txt +4 -0
  126. data/lib/bundler/match_metadata.rb +13 -0
  127. data/lib/bundler/match_platform.rb +0 -1
  128. data/lib/bundler/match_remote_metadata.rb +29 -0
  129. data/lib/bundler/mirror.rb +7 -9
  130. data/lib/bundler/plugin/api/source.rb +25 -9
  131. data/lib/bundler/plugin/dsl.rb +1 -1
  132. data/lib/bundler/plugin/index.rb +17 -5
  133. data/lib/bundler/plugin/installer/git.rb +0 -4
  134. data/lib/bundler/plugin/installer/rubygems.rb +1 -9
  135. data/lib/bundler/plugin/installer.rb +11 -11
  136. data/lib/bundler/plugin/source_list.rb +5 -1
  137. data/lib/bundler/plugin.rb +58 -11
  138. data/lib/bundler/process_lock.rb +1 -1
  139. data/lib/bundler/remote_specification.rb +15 -6
  140. data/lib/bundler/resolver/base.rb +46 -0
  141. data/lib/bundler/resolver/candidate.rb +92 -0
  142. data/lib/bundler/resolver/incompatibility.rb +15 -0
  143. data/lib/bundler/resolver/package.rb +63 -0
  144. data/lib/bundler/resolver/root.rb +25 -0
  145. data/lib/bundler/resolver/spec_group.rb +49 -74
  146. data/lib/bundler/resolver.rb +320 -344
  147. data/lib/bundler/retry.rb +2 -2
  148. data/lib/bundler/ruby_dsl.rb +1 -1
  149. data/lib/bundler/ruby_version.rb +6 -19
  150. data/lib/bundler/rubygems_ext.rb +231 -32
  151. data/lib/bundler/rubygems_gem_installer.rb +89 -16
  152. data/lib/bundler/rubygems_integration.rb +72 -162
  153. data/lib/bundler/runtime.rb +23 -31
  154. data/lib/bundler/self_manager.rb +168 -0
  155. data/lib/bundler/settings.rb +145 -72
  156. data/lib/bundler/setup.rb +2 -2
  157. data/lib/bundler/shared_helpers.rb +19 -34
  158. data/lib/bundler/similarity_detector.rb +1 -1
  159. data/lib/bundler/source/git/git_proxy.rb +244 -114
  160. data/lib/bundler/source/git.rb +62 -46
  161. data/lib/bundler/source/metadata.rb +3 -8
  162. data/lib/bundler/source/path/installer.rb +11 -32
  163. data/lib/bundler/source/path.rb +15 -9
  164. data/lib/bundler/source/rubygems/remote.rb +1 -1
  165. data/lib/bundler/source/rubygems.rb +167 -199
  166. data/lib/bundler/source/rubygems_aggregate.rb +68 -0
  167. data/lib/bundler/source.rb +25 -5
  168. data/lib/bundler/source_list.rb +112 -64
  169. data/lib/bundler/source_map.rb +71 -0
  170. data/lib/bundler/spec_set.rb +64 -61
  171. data/lib/bundler/stub_specification.rb +30 -10
  172. data/lib/bundler/templates/Executable +3 -5
  173. data/lib/bundler/templates/Executable.bundler +10 -15
  174. data/lib/bundler/templates/Executable.standalone +4 -4
  175. data/lib/bundler/templates/Gemfile +0 -2
  176. data/lib/bundler/templates/gems.rb +0 -3
  177. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  178. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  179. data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  180. data/lib/bundler/templates/newgem/Gemfile.tt +15 -1
  181. data/lib/bundler/templates/newgem/README.md.tt +13 -16
  182. data/lib/bundler/templates/newgem/Rakefile.tt +33 -5
  183. data/lib/bundler/templates/newgem/bin/console.tt +1 -0
  184. data/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
  185. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  186. data/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +2 -0
  187. data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  188. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  189. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
  190. data/lib/bundler/templates/newgem/gitignore.tt +3 -0
  191. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
  192. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  193. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  194. data/lib/bundler/templates/newgem/newgem.gemspec.tt +34 -18
  195. data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  196. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  197. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  198. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  199. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  200. data/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
  201. data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
  202. data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  203. data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  204. data/lib/bundler/ui/shell.rb +37 -14
  205. data/lib/bundler/ui/silent.rb +21 -5
  206. data/lib/bundler/uri_credentials_filter.rb +3 -1
  207. data/lib/bundler/vendor/.document +1 -0
  208. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  209. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  210. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  211. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
  212. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +41 -74
  213. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  214. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
  215. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  216. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +82 -189
  217. data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  218. data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  219. data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  220. data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  221. data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +151 -0
  222. data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  223. data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  224. data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  225. data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  226. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +53 -0
  227. data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  228. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  229. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +124 -0
  230. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +409 -0
  231. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +240 -0
  232. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  233. data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  234. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  235. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  236. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +9 -7
  237. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  238. data/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
  239. data/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
  240. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  241. data/lib/bundler/vendor/thor/lib/thor/error.rb +10 -5
  242. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
  243. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
  244. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +28 -7
  245. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  246. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  247. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  248. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  249. data/lib/bundler/vendor/thor/lib/thor.rb +5 -13
  250. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  251. data/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
  252. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  253. data/lib/bundler/vendor/uri/lib/uri/common.rb +76 -91
  254. data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
  255. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
  256. data/lib/bundler/vendor/uri/lib/uri/generic.rb +32 -13
  257. data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
  258. data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
  259. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
  260. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
  261. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
  262. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +14 -21
  263. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +11 -17
  264. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  265. data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
  266. data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
  267. data/lib/bundler/vendor/uri/lib/uri.rb +3 -3
  268. data/lib/bundler/vendored_persistent.rb +1 -40
  269. data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
  270. data/lib/bundler/vendored_tsort.rb +4 -0
  271. data/lib/bundler/version.rb +5 -1
  272. data/lib/bundler/worker.rb +25 -12
  273. data/lib/bundler/yaml_serializer.rb +1 -1
  274. data/lib/bundler.rb +95 -108
  275. metadata +132 -118
  276. data/lib/bundler/dep_proxy.rb +0 -48
  277. data/lib/bundler/gemdeps.rb +0 -29
  278. data/lib/bundler/psyched_yaml.rb +0 -37
  279. data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
  280. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
  281. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  282. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  283. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
  284. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  285. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  286. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  287. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  288. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  289. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  290. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  291. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  292. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -158
  293. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
  294. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
  295. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  296. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
  297. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  298. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
  299. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  300. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  301. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
  302. data/lib/bundler/version_ranges.rb +0 -122
  303. data/man/bundle-add.1.txt +0 -58
  304. data/man/bundle-binstubs.1.txt +0 -48
  305. data/man/bundle-cache.1.txt +0 -78
  306. data/man/bundle-check.1.txt +0 -33
  307. data/man/bundle-clean.1.txt +0 -26
  308. data/man/bundle-config.1.txt +0 -528
  309. data/man/bundle-doctor.1.txt +0 -44
  310. data/man/bundle-exec.1.txt +0 -178
  311. data/man/bundle-gem.1 +0 -80
  312. data/man/bundle-gem.1.txt +0 -91
  313. data/man/bundle-gem.ronn +0 -78
  314. data/man/bundle-info.1.txt +0 -21
  315. data/man/bundle-init.1.txt +0 -34
  316. data/man/bundle-inject.1.txt +0 -32
  317. data/man/bundle-install.1.txt +0 -401
  318. data/man/bundle-list.1.txt +0 -43
  319. data/man/bundle-lock.1.txt +0 -93
  320. data/man/bundle-open.1.txt +0 -29
  321. data/man/bundle-outdated.1.txt +0 -131
  322. data/man/bundle-platform.1.txt +0 -57
  323. data/man/bundle-pristine.1.txt +0 -44
  324. data/man/bundle-remove.1.txt +0 -34
  325. data/man/bundle-show.1.txt +0 -27
  326. data/man/bundle-update.1.txt +0 -390
  327. data/man/bundle-viz.1.txt +0 -39
  328. data/man/bundle.1.txt +0 -116
  329. data/man/gemfile.5.txt +0 -649
  330. /data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
  331. /data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
  332. /data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
  333. /data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +0 -0
  334. /data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
  335. /data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
  336. /data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
  337. /data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
  338. /data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
@@ -3,7 +3,6 @@
3
3
  # = uri/common.rb
4
4
  #
5
5
  # Author:: Akira Yamada <akira@ruby-lang.org>
6
- # Revision:: $Id$
7
6
  # License::
8
7
  # You can redistribute it and/or modify it under the same term as Ruby.
9
8
  #
@@ -14,9 +13,12 @@ require_relative "rfc2396_parser"
14
13
  require_relative "rfc3986_parser"
15
14
 
16
15
  module Bundler::URI
16
+ include RFC2396_REGEXP
17
+
17
18
  REGEXP = RFC2396_REGEXP
18
19
  Parser = RFC2396_Parser
19
20
  RFC3986_PARSER = RFC3986_Parser.new
21
+ Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
20
22
 
21
23
  # Bundler::URI::Parser.new
22
24
  DEFAULT_PARSER = Parser.new
@@ -28,6 +30,7 @@ module Bundler::URI
28
30
  DEFAULT_PARSER.regexp.each_pair do |sym, str|
29
31
  const_set(sym, str)
30
32
  end
33
+ Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
31
34
 
32
35
  module Util # :nodoc:
33
36
  def make_components_hash(klass, array_hash)
@@ -61,88 +64,44 @@ module Bundler::URI
61
64
  module_function :make_components_hash
62
65
  end
63
66
 
64
- # Module for escaping unsafe characters with codes.
65
- module Escape
66
- #
67
- # == Synopsis
68
- #
69
- # Bundler::URI.escape(str [, unsafe])
70
- #
71
- # == Args
72
- #
73
- # +str+::
74
- # String to replaces in.
75
- # +unsafe+::
76
- # Regexp that matches all symbols that must be replaced with codes.
77
- # By default uses <tt>UNSAFE</tt>.
78
- # When this argument is a String, it represents a character set.
79
- #
80
- # == Description
81
- #
82
- # Escapes the string, replacing all unsafe characters with codes.
83
- #
84
- # This method is obsolete and should not be used. Instead, use
85
- # CGI.escape, Bundler::URI.encode_www_form or Bundler::URI.encode_www_form_component
86
- # depending on your specific use case.
87
- #
88
- # == Usage
89
- #
90
- # require 'bundler/vendor/uri/lib/uri'
91
- #
92
- # enc_uri = Bundler::URI.escape("http://example.com/?a=\11\15")
93
- # # => "http://example.com/?a=%09%0D"
94
- #
95
- # Bundler::URI.unescape(enc_uri)
96
- # # => "http://example.com/?a=\t\r"
97
- #
98
- # Bundler::URI.escape("@?@!", "!?")
99
- # # => "@%3F@%21"
100
- #
101
- def escape(*arg)
102
- warn "Bundler::URI.escape is obsolete", uplevel: 1
103
- DEFAULT_PARSER.escape(*arg)
104
- end
105
- alias encode escape
106
- #
107
- # == Synopsis
108
- #
109
- # Bundler::URI.unescape(str)
110
- #
111
- # == Args
112
- #
113
- # +str+::
114
- # String to unescape.
115
- #
116
- # == Description
117
- #
118
- # This method is obsolete and should not be used. Instead, use
119
- # CGI.unescape, Bundler::URI.decode_www_form or Bundler::URI.decode_www_form_component
120
- # depending on your specific use case.
121
- #
122
- # == Usage
123
- #
124
- # require 'bundler/vendor/uri/lib/uri'
125
- #
126
- # enc_uri = Bundler::URI.escape("http://example.com/?a=\11\15")
127
- # # => "http://example.com/?a=%09%0D"
128
- #
129
- # Bundler::URI.unescape(enc_uri)
130
- # # => "http://example.com/?a=\t\r"
131
- #
132
- def unescape(*arg)
133
- warn "Bundler::URI.unescape is obsolete", uplevel: 1
134
- DEFAULT_PARSER.unescape(*arg)
135
- end
136
- alias decode unescape
137
- end # module Escape
67
+ module Schemes
68
+ end
69
+ private_constant :Schemes
138
70
 
139
- extend Escape
140
- include REGEXP
71
+ #
72
+ # Register the given +klass+ to be instantiated when parsing URLs with the given +scheme+.
73
+ # Note that currently only schemes which after .upcase are valid constant names
74
+ # can be registered (no -/+/. allowed).
75
+ #
76
+ def self.register_scheme(scheme, klass)
77
+ Schemes.const_set(scheme.to_s.upcase, klass)
78
+ end
141
79
 
142
- @@schemes = {}
143
80
  # Returns a Hash of the defined schemes.
144
81
  def self.scheme_list
145
- @@schemes
82
+ Schemes.constants.map { |name|
83
+ [name.to_s.upcase, Schemes.const_get(name)]
84
+ }.to_h
85
+ end
86
+
87
+ INITIAL_SCHEMES = scheme_list
88
+ private_constant :INITIAL_SCHEMES
89
+ Ractor.make_shareable(INITIAL_SCHEMES) if defined?(Ractor)
90
+
91
+ #
92
+ # Construct a Bundler::URI instance, using the scheme to detect the appropriate class
93
+ # from +Bundler::URI.scheme_list+.
94
+ #
95
+ def self.for(scheme, *arguments, default: Generic)
96
+ const_name = scheme.to_s.upcase
97
+
98
+ uri_class = INITIAL_SCHEMES[const_name]
99
+ uri_class ||= if /\A[A-Z]\w*\z/.match?(const_name) && Schemes.const_defined?(const_name, false)
100
+ Schemes.const_get(const_name, false)
101
+ end
102
+ uri_class ||= default
103
+
104
+ return uri_class.new(scheme, *arguments)
146
105
  end
147
106
 
148
107
  #
@@ -315,7 +274,7 @@ module Bundler::URI
315
274
  #
316
275
  # Returns a Regexp object which matches to Bundler::URI-like strings.
317
276
  # The Regexp object returned by this method includes arbitrary
318
- # number of capture group (parentheses). Never rely on it's number.
277
+ # number of capture group (parentheses). Never rely on its number.
319
278
  #
320
279
  # == Usage
321
280
  #
@@ -341,6 +300,7 @@ module Bundler::URI
341
300
  256.times do |i|
342
301
  TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
343
302
  end
303
+ TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze
344
304
  TBLENCWWWCOMP_[' '] = '+'
345
305
  TBLENCWWWCOMP_.freeze
346
306
  TBLDECWWWCOMP_ = {} # :nodoc:
@@ -362,10 +322,37 @@ module Bundler::URI
362
322
  # If +enc+ is given, convert +str+ to the encoding before percent encoding.
363
323
  #
364
324
  # This is an implementation of
365
- # http://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data.
325
+ # https://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data.
366
326
  #
367
327
  # See Bundler::URI.decode_www_form_component, Bundler::URI.encode_www_form.
368
328
  def self.encode_www_form_component(str, enc=nil)
329
+ _encode_uri_component(/[^*\-.0-9A-Z_a-z]/, TBLENCWWWCOMP_, str, enc)
330
+ end
331
+
332
+ # Decodes given +str+ of URL-encoded form data.
333
+ #
334
+ # This decodes + to SP.
335
+ #
336
+ # See Bundler::URI.encode_www_form_component, Bundler::URI.decode_www_form.
337
+ def self.decode_www_form_component(str, enc=Encoding::UTF_8)
338
+ _decode_uri_component(/\+|%\h\h/, str, enc)
339
+ end
340
+
341
+ # Encodes +str+ using URL encoding
342
+ #
343
+ # This encodes SP to %20 instead of +.
344
+ def self.encode_uri_component(str, enc=nil)
345
+ _encode_uri_component(/[^*\-.0-9A-Z_a-z]/, TBLENCURICOMP_, str, enc)
346
+ end
347
+
348
+ # Decodes given +str+ of URL-encoded data.
349
+ #
350
+ # This does not decode + to SP.
351
+ def self.decode_uri_component(str, enc=Encoding::UTF_8)
352
+ _decode_uri_component(/%\h\h/, str, enc)
353
+ end
354
+
355
+ def self._encode_uri_component(regexp, table, str, enc)
369
356
  str = str.to_s.dup
370
357
  if str.encoding != Encoding::ASCII_8BIT
371
358
  if enc && enc != Encoding::ASCII_8BIT
@@ -374,19 +361,16 @@ module Bundler::URI
374
361
  end
375
362
  str.force_encoding(Encoding::ASCII_8BIT)
376
363
  end
377
- str.gsub!(/[^*\-.0-9A-Z_a-z]/, TBLENCWWWCOMP_)
364
+ str.gsub!(regexp, table)
378
365
  str.force_encoding(Encoding::US_ASCII)
379
366
  end
367
+ private_class_method :_encode_uri_component
380
368
 
381
- # Decodes given +str+ of URL-encoded form data.
382
- #
383
- # This decodes + to SP.
384
- #
385
- # See Bundler::URI.encode_www_form_component, Bundler::URI.decode_www_form.
386
- def self.decode_www_form_component(str, enc=Encoding::UTF_8)
387
- raise ArgumentError, "invalid %-encoding (#{str})" if /%(?!\h\h)/ =~ str
388
- str.b.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc)
369
+ def self._decode_uri_component(regexp, str, enc)
370
+ raise ArgumentError, "invalid %-encoding (#{str})" if /%(?!\h\h)/.match?(str)
371
+ str.b.gsub(regexp, TBLDECWWWCOMP_).force_encoding(enc)
389
372
  end
373
+ private_class_method :_decode_uri_component
390
374
 
391
375
  # Generates URL-encoded form data from given +enum+.
392
376
  #
@@ -403,7 +387,7 @@ module Bundler::URI
403
387
  # This method doesn't handle files. When you send a file, use
404
388
  # multipart/form-data.
405
389
  #
406
- # This refers http://url.spec.whatwg.org/#concept-urlencoded-serializer
390
+ # This refers https://url.spec.whatwg.org/#concept-urlencoded-serializer
407
391
  #
408
392
  # Bundler::URI.encode_www_form([["q", "ruby"], ["lang", "en"]])
409
393
  # #=> "q=ruby&lang=en"
@@ -716,6 +700,7 @@ module Bundler::URI
716
700
  "utf-16"=>"utf-16le",
717
701
  "utf-16le"=>"utf-16le",
718
702
  } # :nodoc:
703
+ Ractor.make_shareable(WEB_ENCODINGS_) if defined?(Ractor)
719
704
 
720
705
  # :nodoc:
721
706
  # return encoding or nil
@@ -33,6 +33,9 @@ module Bundler::URI
33
33
  # If an Array is used, the components must be passed in the
34
34
  # order <code>[host, path]</code>.
35
35
  #
36
+ # A path from e.g. the File class should be escaped before
37
+ # being passed.
38
+ #
36
39
  # Examples:
37
40
  #
38
41
  # require 'bundler/vendor/uri/lib/uri'
@@ -44,6 +47,9 @@ module Bundler::URI
44
47
  # :path => '/ruby/src'})
45
48
  # uri2.to_s # => "file://host.example.com/ruby/src"
46
49
  #
50
+ # uri3 = Bundler::URI::File.build({:path => Bundler::URI::escape('/path/my file.txt')})
51
+ # uri3.to_s # => "file:///path/my%20file.txt"
52
+ #
47
53
  def self.build(args)
48
54
  tmp = Util::make_components_hash(self, args)
49
55
  super(tmp)
@@ -90,5 +96,5 @@ module Bundler::URI
90
96
  end
91
97
  end
92
98
 
93
- @@schemes['FILE'] = File
99
+ register_scheme 'FILE', File
94
100
  end
@@ -3,7 +3,6 @@
3
3
  #
4
4
  # Author:: Akira Yamada <akira@ruby-lang.org>
5
5
  # License:: You can redistribute it and/or modify it under the same term as Ruby.
6
- # Revision:: $Id$
7
6
  #
8
7
  # See Bundler::URI for general documentation
9
8
  #
@@ -263,5 +262,6 @@ module Bundler::URI
263
262
  return str
264
263
  end
265
264
  end
266
- @@schemes['FTP'] = FTP
265
+
266
+ register_scheme 'FTP', FTP
267
267
  end
@@ -4,7 +4,6 @@
4
4
  #
5
5
  # Author:: Akira Yamada <akira@ruby-lang.org>
6
6
  # License:: You can redistribute it and/or modify it under the same term as Ruby.
7
- # Revision:: $Id$
8
7
  #
9
8
  # See Bundler::URI for general documentation
10
9
  #
@@ -565,16 +564,26 @@ module Bundler::URI
565
564
  end
566
565
  end
567
566
 
568
- # Returns the user component.
567
+ # Returns the user component (without Bundler::URI decoding).
569
568
  def user
570
569
  @user
571
570
  end
572
571
 
573
- # Returns the password component.
572
+ # Returns the password component (without Bundler::URI decoding).
574
573
  def password
575
574
  @password
576
575
  end
577
576
 
577
+ # Returns the user component after Bundler::URI decoding.
578
+ def decoded_user
579
+ Bundler::URI.decode_uri_component(@user) if @user
580
+ end
581
+
582
+ # Returns the password component after Bundler::URI decoding.
583
+ def decoded_password
584
+ Bundler::URI.decode_uri_component(@password) if @password
585
+ end
586
+
578
587
  #
579
588
  # Checks the host +v+ component for RFC2396 compliance
580
589
  # and against the Bundler::URI::Parser Regexp for :HOST.
@@ -644,7 +653,7 @@ module Bundler::URI
644
653
  #
645
654
  def hostname
646
655
  v = self.host
647
- /\A\[(.*)\]\z/ =~ v ? $1 : v
656
+ v&.start_with?('[') && v.end_with?(']') ? v[1..-2] : v
648
657
  end
649
658
 
650
659
  # Sets the host part of the Bundler::URI as the argument with brackets for IPv6 addresses.
@@ -660,7 +669,7 @@ module Bundler::URI
660
669
  # it is wrapped with brackets.
661
670
  #
662
671
  def hostname=(v)
663
- v = "[#{v}]" if /\A\[.*\]\z/ !~ v && /:/ =~ v
672
+ v = "[#{v}]" if !(v&.start_with?('[') && v&.end_with?(']')) && v&.index(':')
664
673
  self.host = v
665
674
  end
666
675
 
@@ -1098,7 +1107,7 @@ module Bundler::URI
1098
1107
  # # => "http://my.example.com/main.rbx?page=1"
1099
1108
  #
1100
1109
  def merge(oth)
1101
- rel = parser.send(:convert_to_uri, oth)
1110
+ rel = parser.__send__(:convert_to_uri, oth)
1102
1111
 
1103
1112
  if rel.absolute?
1104
1113
  #raise BadURIError, "both Bundler::URI are absolute" if absolute?
@@ -1183,7 +1192,7 @@ module Bundler::URI
1183
1192
 
1184
1193
  # :stopdoc:
1185
1194
  def route_from0(oth)
1186
- oth = parser.send(:convert_to_uri, oth)
1195
+ oth = parser.__send__(:convert_to_uri, oth)
1187
1196
  if self.relative?
1188
1197
  raise BadURIError,
1189
1198
  "relative Bundler::URI: #{self}"
@@ -1291,7 +1300,7 @@ module Bundler::URI
1291
1300
  # #=> #<Bundler::URI::Generic /main.rbx?page=1>
1292
1301
  #
1293
1302
  def route_to(oth)
1294
- parser.send(:convert_to_uri, oth).route_from(self)
1303
+ parser.__send__(:convert_to_uri, oth).route_from(self)
1295
1304
  end
1296
1305
 
1297
1306
  #
@@ -1405,7 +1414,7 @@ module Bundler::URI
1405
1414
  # Returns an Array of the components defined from the COMPONENT Array.
1406
1415
  def component_ary
1407
1416
  component.collect do |x|
1408
- self.send(x)
1417
+ self.__send__(x)
1409
1418
  end
1410
1419
  end
1411
1420
  protected :component_ary
@@ -1430,7 +1439,7 @@ module Bundler::URI
1430
1439
  def select(*components)
1431
1440
  components.collect do |c|
1432
1441
  if component.include?(c)
1433
- self.send(c)
1442
+ self.__send__(c)
1434
1443
  else
1435
1444
  raise ArgumentError,
1436
1445
  "expected of components of #{self.class} (#{self.class.component.join(', ')})"
@@ -1515,9 +1524,19 @@ module Bundler::URI
1515
1524
  proxy_uri = env["CGI_#{name.upcase}"]
1516
1525
  end
1517
1526
  elsif name == 'http_proxy'
1518
- unless proxy_uri = env[name]
1519
- if proxy_uri = env[name.upcase]
1520
- warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.', uplevel: 1
1527
+ if RUBY_ENGINE == 'jruby' && p_addr = ENV_JAVA['http.proxyHost']
1528
+ p_port = ENV_JAVA['http.proxyPort']
1529
+ if p_user = ENV_JAVA['http.proxyUser']
1530
+ p_pass = ENV_JAVA['http.proxyPass']
1531
+ proxy_uri = "http://#{p_user}:#{p_pass}@#{p_addr}:#{p_port}"
1532
+ else
1533
+ proxy_uri = "http://#{p_addr}:#{p_port}"
1534
+ end
1535
+ else
1536
+ unless proxy_uri = env[name]
1537
+ if proxy_uri = env[name.upcase]
1538
+ warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.', uplevel: 1
1539
+ end
1521
1540
  end
1522
1541
  end
1523
1542
  else
@@ -3,7 +3,6 @@
3
3
  #
4
4
  # Author:: Akira Yamada <akira@ruby-lang.org>
5
5
  # License:: You can redistribute it and/or modify it under the same term as Ruby.
6
- # Revision:: $Id$
7
6
  #
8
7
  # See Bundler::URI for general documentation
9
8
  #
@@ -81,8 +80,46 @@ module Bundler::URI
81
80
  url = @query ? "#@path?#@query" : @path.dup
82
81
  url.start_with?(?/.freeze) ? url : ?/ + url
83
82
  end
84
- end
85
83
 
86
- @@schemes['HTTP'] = HTTP
84
+ #
85
+ # == Description
86
+ #
87
+ # Returns the authority for an HTTP uri, as defined in
88
+ # https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2.
89
+ #
90
+ #
91
+ # Example:
92
+ #
93
+ # Bundler::URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').authority #=> "www.example.com"
94
+ # Bundler::URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').authority #=> "www.example.com:8000"
95
+ # Bundler::URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').authority #=> "www.example.com"
96
+ #
97
+ def authority
98
+ if port == default_port
99
+ host
100
+ else
101
+ "#{host}:#{port}"
102
+ end
103
+ end
104
+
105
+ #
106
+ # == Description
107
+ #
108
+ # Returns the origin for an HTTP uri, as defined in
109
+ # https://datatracker.ietf.org/doc/html/rfc6454.
110
+ #
111
+ #
112
+ # Example:
113
+ #
114
+ # Bundler::URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').origin #=> "http://www.example.com"
115
+ # Bundler::URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').origin #=> "http://www.example.com:8000"
116
+ # Bundler::URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').origin #=> "http://www.example.com"
117
+ # Bundler::URI::HTTPS.build(host: 'www.example.com', path: '/foo/bar').origin #=> "https://www.example.com"
118
+ #
119
+ def origin
120
+ "#{scheme}://#{authority}"
121
+ end
122
+ end
87
123
 
124
+ register_scheme 'HTTP', HTTP
88
125
  end
@@ -3,7 +3,6 @@
3
3
  #
4
4
  # Author:: Akira Yamada <akira@ruby-lang.org>
5
5
  # License:: You can redistribute it and/or modify it under the same term as Ruby.
6
- # Revision:: $Id$
7
6
  #
8
7
  # See Bundler::URI for general documentation
9
8
  #
@@ -19,5 +18,6 @@ module Bundler::URI
19
18
  # A Default port of 443 for Bundler::URI::HTTPS
20
19
  DEFAULT_PORT = 443
21
20
  end
22
- @@schemes['HTTPS'] = HTTPS
21
+
22
+ register_scheme 'HTTPS', HTTPS
23
23
  end
@@ -7,7 +7,6 @@
7
7
  # License::
8
8
  # Bundler::URI::LDAP is copyrighted free software by Takaaki Tateishi and Akira Yamada.
9
9
  # You can redistribute it and/or modify it under the same term as Ruby.
10
- # Revision:: $Id$
11
10
  #
12
11
  # See Bundler::URI for general documentation
13
12
  #
@@ -119,6 +118,7 @@ module Bundler::URI
119
118
 
120
119
  # Private method to cleanup +dn+ from using the +path+ component attribute.
121
120
  def parse_dn
121
+ raise InvalidURIError, 'bad LDAP URL' unless @path
122
122
  @dn = @path[1..-1]
123
123
  end
124
124
  private :parse_dn
@@ -257,5 +257,5 @@ module Bundler::URI
257
257
  end
258
258
  end
259
259
 
260
- @@schemes['LDAP'] = LDAP
260
+ register_scheme 'LDAP', LDAP
261
261
  end
@@ -17,5 +17,6 @@ module Bundler::URI
17
17
  # A Default port of 636 for Bundler::URI::LDAPS
18
18
  DEFAULT_PORT = 636
19
19
  end
20
- @@schemes['LDAPS'] = LDAPS
20
+
21
+ register_scheme 'LDAPS', LDAPS
21
22
  end
@@ -3,7 +3,6 @@
3
3
  #
4
4
  # Author:: Akira Yamada <akira@ruby-lang.org>
5
5
  # License:: You can redistribute it and/or modify it under the same term as Ruby.
6
- # Revision:: $Id$
7
6
  #
8
7
  # See Bundler::URI for general documentation
9
8
  #
@@ -16,7 +15,7 @@ module Bundler::URI
16
15
  # RFC6068, the mailto URL scheme.
17
16
  #
18
17
  class MailTo < Generic
19
- include REGEXP
18
+ include RFC2396_REGEXP
20
19
 
21
20
  # A Default port of nil for Bundler::URI::MailTo.
22
21
  DEFAULT_PORT = nil
@@ -290,5 +289,5 @@ module Bundler::URI
290
289
  alias to_rfc822text to_mailtext
291
290
  end
292
291
 
293
- @@schemes['MAILTO'] = MailTo
292
+ register_scheme 'MAILTO', MailTo
294
293
  end
@@ -3,7 +3,6 @@
3
3
  # = uri/common.rb
4
4
  #
5
5
  # Author:: Akira Yamada <akira@ruby-lang.org>
6
- # Revision:: $Id$
7
6
  # License::
8
7
  # You can redistribute it and/or modify it under the same term as Ruby.
9
8
  #
@@ -117,7 +116,7 @@ module Bundler::URI
117
116
  # See also Bundler::URI::Parser.initialize_regexp.
118
117
  attr_reader :regexp
119
118
 
120
- # Returns a split Bundler::URI against regexp[:ABS_URI].
119
+ # Returns a split Bundler::URI against +regexp[:ABS_URI]+.
121
120
  def split(uri)
122
121
  case uri
123
122
  when ''
@@ -208,21 +207,9 @@ module Bundler::URI
208
207
  # #=> #<Bundler::URI::LDAP ldap://ldap.example.com/dc=example?user=john>
209
208
  #
210
209
  def parse(uri)
211
- scheme, userinfo, host, port,
212
- registry, path, opaque, query, fragment = self.split(uri)
213
-
214
- if scheme && Bundler::URI.scheme_list.include?(scheme.upcase)
215
- Bundler::URI.scheme_list[scheme.upcase].new(scheme, userinfo, host, port,
216
- registry, path, opaque, query,
217
- fragment, self)
218
- else
219
- Generic.new(scheme, userinfo, host, port,
220
- registry, path, opaque, query,
221
- fragment, self)
222
- end
210
+ Bundler::URI.for(*self.split(uri), self)
223
211
  end
224
212
 
225
-
226
213
  #
227
214
  # == Args
228
215
  #
@@ -270,8 +257,8 @@ module Bundler::URI
270
257
  end
271
258
  end
272
259
 
273
- # Returns Regexp that is default self.regexp[:ABS_URI_REF],
274
- # unless +schemes+ is provided. Then it is a Regexp.union with self.pattern[:X_ABS_URI].
260
+ # Returns Regexp that is default +self.regexp[:ABS_URI_REF]+,
261
+ # unless +schemes+ is provided. Then it is a Regexp.union with +self.pattern[:X_ABS_URI]+.
275
262
  def make_regexp(schemes = nil)
276
263
  unless schemes
277
264
  @regexp[:ABS_URI_REF]
@@ -290,7 +277,7 @@ module Bundler::URI
290
277
  # +str+::
291
278
  # String to make safe
292
279
  # +unsafe+::
293
- # Regexp to apply. Defaults to self.regexp[:UNSAFE]
280
+ # Regexp to apply. Defaults to +self.regexp[:UNSAFE]+
294
281
  #
295
282
  # == Description
296
283
  #
@@ -322,7 +309,7 @@ module Bundler::URI
322
309
  # +str+::
323
310
  # String to remove escapes from
324
311
  # +escaped+::
325
- # Regexp to apply. Defaults to self.regexp[:ESCAPED]
312
+ # Regexp to apply. Defaults to +self.regexp[:ESCAPED]+
326
313
  #
327
314
  # == Description
328
315
  #
@@ -335,8 +322,14 @@ module Bundler::URI
335
322
  end
336
323
 
337
324
  @@to_s = Kernel.instance_method(:to_s)
338
- def inspect
339
- @@to_s.bind_call(self)
325
+ if @@to_s.respond_to?(:bind_call)
326
+ def inspect
327
+ @@to_s.bind_call(self)
328
+ end
329
+ else
330
+ def inspect
331
+ @@to_s.bind(self).call
332
+ end
340
333
  end
341
334
 
342
335
  private
@@ -2,9 +2,8 @@
2
2
  module Bundler::URI
3
3
  class RFC3986_Parser # :nodoc:
4
4
  # Bundler::URI defined in RFC3986
5
- # this regexp is modified not to host is not empty string
6
- RFC3986_URI = /\A(?<Bundler::URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-rootless>\g<segment-nz>(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
7
- RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+)\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-noscheme>(?<segment-nz-nc>(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])+)(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
5
+ RFC3986_URI = /\A(?<Bundler::URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])*))(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-rootless>\g<segment-nz>(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
6
+ RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-noscheme>(?<segment-nz-nc>(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])+)(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
8
7
  attr_reader :regexp
9
8
 
10
9
  def initialize
@@ -69,18 +68,7 @@ module Bundler::URI
69
68
  end
70
69
 
71
70
  def parse(uri) # :nodoc:
72
- scheme, userinfo, host, port,
73
- registry, path, opaque, query, fragment = self.split(uri)
74
- scheme_list = Bundler::URI.scheme_list
75
- if scheme && scheme_list.include?(uc = scheme.upcase)
76
- scheme_list[uc].new(scheme, userinfo, host, port,
77
- registry, path, opaque, query,
78
- fragment, self)
79
- else
80
- Generic.new(scheme, userinfo, host, port,
81
- registry, path, opaque, query,
82
- fragment, self)
83
- end
71
+ Bundler::URI.for(*self.split(uri), self)
84
72
  end
85
73
 
86
74
 
@@ -90,8 +78,14 @@ module Bundler::URI
90
78
  end
91
79
 
92
80
  @@to_s = Kernel.instance_method(:to_s)
93
- def inspect
94
- @@to_s.bind_call(self)
81
+ if @@to_s.respond_to?(:bind_call)
82
+ def inspect
83
+ @@to_s.bind_call(self)
84
+ end
85
+ else
86
+ def inspect
87
+ @@to_s.bind(self).call
88
+ end
95
89
  end
96
90
 
97
91
  private