rubygems-update 2.6.0 → 3.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (812) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +5941 -0
  3. data/CODE_OF_CONDUCT.md +76 -35
  4. data/CONTRIBUTING.md +231 -0
  5. data/MAINTAINERS.txt +8 -0
  6. data/Manifest.txt +439 -216
  7. data/POLICIES.md +135 -0
  8. data/README.md +112 -0
  9. data/UPGRADING.md +15 -0
  10. data/bundler/CHANGELOG.md +4753 -0
  11. data/bundler/LICENSE.md +22 -0
  12. data/bundler/README.md +58 -0
  13. data/bundler/UPGRADING.md +222 -0
  14. data/bundler/bundler.gemspec +46 -0
  15. data/bundler/exe/bundle +29 -0
  16. data/bundler/exe/bundler +4 -0
  17. data/bundler/lib/bundler/.document +1 -0
  18. data/bundler/lib/bundler/build_metadata.rb +45 -0
  19. data/bundler/lib/bundler/capistrano.rb +22 -0
  20. data/bundler/lib/bundler/checksum.rb +254 -0
  21. data/bundler/lib/bundler/ci_detector.rb +75 -0
  22. data/bundler/lib/bundler/cli/add.rb +47 -0
  23. data/bundler/lib/bundler/cli/binstubs.rb +57 -0
  24. data/bundler/lib/bundler/cli/cache.rb +43 -0
  25. data/bundler/lib/bundler/cli/check.rb +40 -0
  26. data/bundler/lib/bundler/cli/clean.rb +25 -0
  27. data/bundler/lib/bundler/cli/common.rb +138 -0
  28. data/bundler/lib/bundler/cli/config.rb +204 -0
  29. data/bundler/lib/bundler/cli/console.rb +44 -0
  30. data/bundler/lib/bundler/cli/doctor.rb +157 -0
  31. data/bundler/lib/bundler/cli/exec.rb +88 -0
  32. data/bundler/lib/bundler/cli/fund.rb +36 -0
  33. data/bundler/lib/bundler/cli/gem.rb +471 -0
  34. data/bundler/lib/bundler/cli/info.rb +83 -0
  35. data/bundler/lib/bundler/cli/init.rb +51 -0
  36. data/bundler/lib/bundler/cli/inject.rb +60 -0
  37. data/bundler/lib/bundler/cli/install.rb +190 -0
  38. data/bundler/lib/bundler/cli/issue.rb +41 -0
  39. data/bundler/lib/bundler/cli/list.rb +66 -0
  40. data/bundler/lib/bundler/cli/lock.rb +73 -0
  41. data/bundler/lib/bundler/cli/open.rb +29 -0
  42. data/bundler/lib/bundler/cli/outdated.rb +297 -0
  43. data/bundler/lib/bundler/cli/platform.rb +48 -0
  44. data/bundler/lib/bundler/cli/plugin.rb +34 -0
  45. data/bundler/lib/bundler/cli/pristine.rb +60 -0
  46. data/bundler/lib/bundler/cli/remove.rb +17 -0
  47. data/bundler/lib/bundler/cli/show.rb +75 -0
  48. data/bundler/lib/bundler/cli/update.rb +123 -0
  49. data/bundler/lib/bundler/cli/viz.rb +31 -0
  50. data/bundler/lib/bundler/cli.rb +846 -0
  51. data/bundler/lib/bundler/compact_index_client/cache.rb +121 -0
  52. data/bundler/lib/bundler/compact_index_client/cache_file.rb +153 -0
  53. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +32 -0
  54. data/bundler/lib/bundler/compact_index_client/updater.rb +115 -0
  55. data/bundler/lib/bundler/compact_index_client.rb +126 -0
  56. data/bundler/lib/bundler/constants.rb +7 -0
  57. data/bundler/lib/bundler/current_ruby.rb +92 -0
  58. data/bundler/lib/bundler/definition.rb +1015 -0
  59. data/bundler/lib/bundler/dependency.rb +105 -0
  60. data/bundler/lib/bundler/deployment.rb +69 -0
  61. data/bundler/lib/bundler/deprecate.rb +44 -0
  62. data/bundler/lib/bundler/digest.rb +71 -0
  63. data/bundler/lib/bundler/dsl.rb +604 -0
  64. data/bundler/lib/bundler/endpoint_specification.rb +147 -0
  65. data/bundler/lib/bundler/env.rb +148 -0
  66. data/bundler/lib/bundler/environment_preserver.rb +86 -0
  67. data/bundler/lib/bundler/errors.rb +233 -0
  68. data/bundler/lib/bundler/feature_flag.rb +53 -0
  69. data/bundler/lib/bundler/fetcher/base.rb +52 -0
  70. data/bundler/lib/bundler/fetcher/compact_index.rb +129 -0
  71. data/bundler/lib/bundler/fetcher/dependency.rb +78 -0
  72. data/bundler/lib/bundler/fetcher/downloader.rb +91 -0
  73. data/bundler/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
  74. data/bundler/lib/bundler/fetcher/index.rb +25 -0
  75. data/bundler/lib/bundler/fetcher.rb +324 -0
  76. data/bundler/lib/bundler/force_platform.rb +18 -0
  77. data/bundler/lib/bundler/friendly_errors.rb +126 -0
  78. data/bundler/lib/bundler/gem_helper.rb +237 -0
  79. data/bundler/lib/bundler/gem_helpers.rb +127 -0
  80. data/bundler/lib/bundler/gem_tasks.rb +7 -0
  81. data/bundler/lib/bundler/gem_version_promoter.rb +145 -0
  82. data/bundler/lib/bundler/graph.rb +152 -0
  83. data/bundler/lib/bundler/index.rb +205 -0
  84. data/bundler/lib/bundler/injector.rb +287 -0
  85. data/bundler/lib/bundler/inline.rb +73 -0
  86. data/bundler/lib/bundler/installer/gem_installer.rb +84 -0
  87. data/bundler/lib/bundler/installer/parallel_installer.rb +202 -0
  88. data/bundler/lib/bundler/installer/standalone.rb +116 -0
  89. data/bundler/lib/bundler/installer.rb +267 -0
  90. data/bundler/lib/bundler/lazy_specification.rb +172 -0
  91. data/bundler/lib/bundler/lockfile_generator.rb +104 -0
  92. data/bundler/lib/bundler/lockfile_parser.rb +289 -0
  93. data/bundler/lib/bundler/man/.document +1 -0
  94. data/bundler/lib/bundler/man/bundle-add.1 +59 -0
  95. data/bundler/lib/bundler/man/bundle-add.1.ronn +58 -0
  96. data/bundler/lib/bundler/man/bundle-binstubs.1 +30 -0
  97. data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +41 -0
  98. data/bundler/lib/bundler/man/bundle-cache.1 +40 -0
  99. data/bundler/lib/bundler/man/bundle-cache.1.ronn +79 -0
  100. data/bundler/lib/bundler/man/bundle-check.1 +22 -0
  101. data/bundler/lib/bundler/man/bundle-check.1.ronn +26 -0
  102. data/bundler/lib/bundler/man/bundle-clean.1 +17 -0
  103. data/bundler/lib/bundler/man/bundle-clean.1.ronn +18 -0
  104. data/bundler/lib/bundler/man/bundle-config.1 +321 -0
  105. data/bundler/lib/bundler/man/bundle-config.1.ronn +411 -0
  106. data/bundler/lib/bundler/man/bundle-console.1 +35 -0
  107. data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
  108. data/bundler/lib/bundler/man/bundle-doctor.1 +30 -0
  109. data/bundler/lib/bundler/man/bundle-doctor.1.ronn +33 -0
  110. data/bundler/lib/bundler/man/bundle-exec.1 +104 -0
  111. data/bundler/lib/bundler/man/bundle-exec.1.ronn +151 -0
  112. data/bundler/lib/bundler/man/bundle-gem.1 +69 -0
  113. data/bundler/lib/bundler/man/bundle-gem.1.ronn +117 -0
  114. data/bundler/lib/bundler/man/bundle-help.1 +9 -0
  115. data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
  116. data/bundler/lib/bundler/man/bundle-info.1 +14 -0
  117. data/bundler/lib/bundler/man/bundle-info.1.ronn +17 -0
  118. data/bundler/lib/bundler/man/bundle-init.1 +20 -0
  119. data/bundler/lib/bundler/man/bundle-init.1.ronn +31 -0
  120. data/bundler/lib/bundler/man/bundle-inject.1 +23 -0
  121. data/bundler/lib/bundler/man/bundle-inject.1.ronn +24 -0
  122. data/bundler/lib/bundler/man/bundle-install.1 +215 -0
  123. data/bundler/lib/bundler/man/bundle-install.1.ronn +383 -0
  124. data/bundler/lib/bundler/man/bundle-list.1 +35 -0
  125. data/bundler/lib/bundler/man/bundle-list.1.ronn +33 -0
  126. data/bundler/lib/bundler/man/bundle-lock.1 +60 -0
  127. data/bundler/lib/bundler/man/bundle-lock.1.ronn +94 -0
  128. data/bundler/lib/bundler/man/bundle-open.1 +32 -0
  129. data/bundler/lib/bundler/man/bundle-open.1.ronn +27 -0
  130. data/bundler/lib/bundler/man/bundle-outdated.1 +100 -0
  131. data/bundler/lib/bundler/man/bundle-outdated.1.ronn +106 -0
  132. data/bundler/lib/bundler/man/bundle-platform.1 +49 -0
  133. data/bundler/lib/bundler/man/bundle-platform.1.ronn +49 -0
  134. data/bundler/lib/bundler/man/bundle-plugin.1 +55 -0
  135. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  136. data/bundler/lib/bundler/man/bundle-pristine.1 +23 -0
  137. data/bundler/lib/bundler/man/bundle-pristine.1.ronn +34 -0
  138. data/bundler/lib/bundler/man/bundle-remove.1 +21 -0
  139. data/bundler/lib/bundler/man/bundle-remove.1.ronn +23 -0
  140. data/bundler/lib/bundler/man/bundle-show.1 +16 -0
  141. data/bundler/lib/bundler/man/bundle-show.1.ronn +21 -0
  142. data/bundler/lib/bundler/man/bundle-update.1 +275 -0
  143. data/bundler/lib/bundler/man/bundle-update.1.ronn +351 -0
  144. data/bundler/lib/bundler/man/bundle-version.1 +22 -0
  145. data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
  146. data/bundler/lib/bundler/man/bundle-viz.1 +30 -0
  147. data/bundler/lib/bundler/man/bundle-viz.1.ronn +32 -0
  148. data/bundler/lib/bundler/man/bundle.1 +102 -0
  149. data/bundler/lib/bundler/man/bundle.1.ronn +116 -0
  150. data/bundler/lib/bundler/man/gemfile.5 +470 -0
  151. data/bundler/lib/bundler/man/gemfile.5.ronn +552 -0
  152. data/bundler/lib/bundler/man/index.txt +29 -0
  153. data/bundler/lib/bundler/match_metadata.rb +17 -0
  154. data/bundler/lib/bundler/match_platform.rb +23 -0
  155. data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
  156. data/bundler/lib/bundler/mirror.rb +221 -0
  157. data/bundler/lib/bundler/plugin/api/source.rb +321 -0
  158. data/bundler/lib/bundler/plugin/api.rb +81 -0
  159. data/bundler/lib/bundler/plugin/dsl.rb +53 -0
  160. data/bundler/lib/bundler/plugin/events.rb +61 -0
  161. data/bundler/lib/bundler/plugin/index.rb +193 -0
  162. data/bundler/lib/bundler/plugin/installer/git.rb +34 -0
  163. data/bundler/lib/bundler/plugin/installer/rubygems.rb +19 -0
  164. data/bundler/lib/bundler/plugin/installer.rb +112 -0
  165. data/bundler/lib/bundler/plugin/source_list.rb +31 -0
  166. data/bundler/lib/bundler/plugin.rb +359 -0
  167. data/bundler/lib/bundler/process_lock.rb +24 -0
  168. data/bundler/lib/bundler/remote_specification.rb +121 -0
  169. data/bundler/lib/bundler/resolver/base.rb +107 -0
  170. data/bundler/lib/bundler/resolver/candidate.rb +94 -0
  171. data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
  172. data/bundler/lib/bundler/resolver/package.rb +77 -0
  173. data/bundler/lib/bundler/resolver/root.rb +25 -0
  174. data/bundler/lib/bundler/resolver/spec_group.rb +79 -0
  175. data/bundler/lib/bundler/resolver.rb +462 -0
  176. data/bundler/lib/bundler/retry.rb +66 -0
  177. data/bundler/lib/bundler/ruby_dsl.rb +53 -0
  178. data/bundler/lib/bundler/ruby_version.rb +131 -0
  179. data/bundler/lib/bundler/rubygems_ext.rb +328 -0
  180. data/bundler/lib/bundler/rubygems_gem_installer.rb +137 -0
  181. data/bundler/lib/bundler/rubygems_integration.rb +493 -0
  182. data/bundler/lib/bundler/runtime.rb +307 -0
  183. data/bundler/lib/bundler/safe_marshal.rb +31 -0
  184. data/bundler/lib/bundler/self_manager.rb +186 -0
  185. data/bundler/lib/bundler/settings/validator.rb +102 -0
  186. data/bundler/lib/bundler/settings.rb +588 -0
  187. data/bundler/lib/bundler/setup.rb +33 -0
  188. data/bundler/lib/bundler/shared_helpers.rb +380 -0
  189. data/bundler/lib/bundler/similarity_detector.rb +63 -0
  190. data/bundler/lib/bundler/source/gemspec.rb +18 -0
  191. data/bundler/lib/bundler/source/git/git_proxy.rb +455 -0
  192. data/bundler/lib/bundler/source/git.rb +380 -0
  193. data/bundler/lib/bundler/source/metadata.rb +62 -0
  194. data/bundler/lib/bundler/source/path/installer.rb +53 -0
  195. data/bundler/lib/bundler/source/path.rb +261 -0
  196. data/bundler/lib/bundler/source/rubygems/remote.rb +68 -0
  197. data/bundler/lib/bundler/source/rubygems.rb +516 -0
  198. data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
  199. data/bundler/lib/bundler/source.rb +116 -0
  200. data/bundler/lib/bundler/source_list.rb +227 -0
  201. data/bundler/lib/bundler/source_map.rb +71 -0
  202. data/bundler/lib/bundler/spec_set.rb +296 -0
  203. data/bundler/lib/bundler/stub_specification.rb +119 -0
  204. data/bundler/lib/bundler/templates/.document +1 -0
  205. data/bundler/lib/bundler/templates/Executable +27 -0
  206. data/bundler/lib/bundler/templates/Executable.bundler +109 -0
  207. data/bundler/lib/bundler/templates/Executable.standalone +14 -0
  208. data/bundler/lib/bundler/templates/Gemfile +5 -0
  209. data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  210. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +84 -0
  211. data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  212. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +26 -0
  213. data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
  214. data/bundler/lib/bundler/templates/newgem/README.md.tt +45 -0
  215. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +67 -0
  216. data/bundler/lib/bundler/templates/newgem/bin/console.tt +11 -0
  217. data/bundler/lib/bundler/templates/newgem/bin/setup.tt +8 -0
  218. data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
  219. data/bundler/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  220. data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  221. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
  222. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  223. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
  224. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
  225. data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  226. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
  227. data/bundler/lib/bundler/templates/newgem/gitignore.tt +23 -0
  228. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
  229. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +9 -0
  230. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +15 -0
  231. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +51 -0
  232. data/bundler/lib/bundler/templates/newgem/rspec.tt +3 -0
  233. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  234. data/bundler/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  235. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
  236. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +15 -0
  237. data/bundler/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  238. data/bundler/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
  239. data/bundler/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +13 -0
  240. data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  241. data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  242. data/bundler/lib/bundler/ui/rg_proxy.rb +19 -0
  243. data/bundler/lib/bundler/ui/shell.rb +165 -0
  244. data/bundler/lib/bundler/ui/silent.rb +85 -0
  245. data/bundler/lib/bundler/ui.rb +9 -0
  246. data/bundler/lib/bundler/uri_credentials_filter.rb +43 -0
  247. data/bundler/lib/bundler/uri_normalizer.rb +23 -0
  248. data/bundler/lib/bundler/vendor/.document +1 -0
  249. data/bundler/lib/bundler/vendor/connection_pool/.document +1 -0
  250. data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  251. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
  252. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
  253. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
  254. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +175 -0
  255. data/bundler/lib/bundler/vendor/fileutils/.document +1 -0
  256. data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  257. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +2694 -0
  258. data/bundler/lib/bundler/vendor/net-http-persistent/.document +1 -0
  259. data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  260. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +41 -0
  261. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +65 -0
  262. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
  263. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1073 -0
  264. data/bundler/lib/bundler/vendor/pub_grub/.document +1 -0
  265. data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  266. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  267. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  268. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  269. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
  270. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  271. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  272. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  273. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  274. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
  275. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  276. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  277. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
  278. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
  279. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -0
  280. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  281. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  282. data/bundler/lib/bundler/vendor/thor/.document +1 -0
  283. data/bundler/lib/bundler/vendor/thor/LICENSE.md +20 -0
  284. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +105 -0
  285. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +61 -0
  286. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +108 -0
  287. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +143 -0
  288. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +373 -0
  289. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +130 -0
  290. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +340 -0
  291. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +825 -0
  292. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +151 -0
  293. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +107 -0
  294. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +106 -0
  295. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
  296. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
  297. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +37 -0
  298. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
  299. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
  300. data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  301. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +89 -0
  302. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +195 -0
  303. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +178 -0
  304. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +293 -0
  305. data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
  306. data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +72 -0
  307. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +335 -0
  308. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +388 -0
  309. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +112 -0
  310. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
  311. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +81 -0
  312. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +134 -0
  313. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
  314. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
  315. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
  316. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +285 -0
  317. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
  318. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +663 -0
  319. data/bundler/lib/bundler/vendor/tsort/.document +1 -0
  320. data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  321. data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
  322. data/bundler/lib/bundler/vendor/uri/.document +1 -0
  323. data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  324. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +853 -0
  325. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +100 -0
  326. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  327. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1588 -0
  328. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +125 -0
  329. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  330. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  331. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +22 -0
  332. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +293 -0
  333. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +539 -0
  334. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +183 -0
  335. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  336. data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
  337. data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
  338. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  339. data/bundler/lib/bundler/vendored_fileutils.rb +4 -0
  340. data/bundler/lib/bundler/vendored_net_http.rb +8 -0
  341. data/bundler/lib/bundler/vendored_persistent.rb +11 -0
  342. data/bundler/lib/bundler/vendored_pub_grub.rb +4 -0
  343. data/bundler/lib/bundler/vendored_thor.rb +8 -0
  344. data/bundler/lib/bundler/vendored_timeout.rb +8 -0
  345. data/bundler/lib/bundler/vendored_tsort.rb +4 -0
  346. data/bundler/lib/bundler/vendored_uri.rb +4 -0
  347. data/bundler/lib/bundler/version.rb +13 -0
  348. data/bundler/lib/bundler/vlad.rb +17 -0
  349. data/bundler/lib/bundler/worker.rb +117 -0
  350. data/bundler/lib/bundler/yaml_serializer.rb +93 -0
  351. data/bundler/lib/bundler.rb +663 -0
  352. data/{test/rubygems/bogussources.rb → exe/gem} +5 -2
  353. data/exe/update_rubygems +38 -0
  354. data/hide_lib_for_update/note.txt +0 -4
  355. data/lib/rubygems/available_set.rb +12 -12
  356. data/lib/rubygems/basic_specification.rb +82 -59
  357. data/lib/rubygems/bundler_version_finder.rb +77 -0
  358. data/lib/rubygems/ci_detector.rb +75 -0
  359. data/lib/rubygems/command.rb +144 -71
  360. data/lib/rubygems/command_manager.rb +64 -27
  361. data/lib/rubygems/commands/build_command.rb +88 -17
  362. data/lib/rubygems/commands/cert_command.rb +131 -83
  363. data/lib/rubygems/commands/check_command.rb +30 -27
  364. data/lib/rubygems/commands/cleanup_command.rb +57 -40
  365. data/lib/rubygems/commands/contents_command.rb +37 -39
  366. data/lib/rubygems/commands/dependency_command.rb +53 -65
  367. data/lib/rubygems/commands/environment_command.rb +32 -16
  368. data/lib/rubygems/commands/exec_command.rb +249 -0
  369. data/lib/rubygems/commands/fetch_command.rb +36 -19
  370. data/lib/rubygems/commands/generate_index_command.rb +40 -74
  371. data/lib/rubygems/commands/help_command.rb +22 -22
  372. data/lib/rubygems/commands/info_command.rb +38 -0
  373. data/lib/rubygems/commands/install_command.rb +67 -143
  374. data/lib/rubygems/commands/list_command.rb +10 -9
  375. data/lib/rubygems/commands/lock_command.rb +12 -14
  376. data/lib/rubygems/commands/mirror_command.rb +4 -4
  377. data/lib/rubygems/commands/open_command.rb +28 -26
  378. data/lib/rubygems/commands/outdated_command.rb +6 -6
  379. data/lib/rubygems/commands/owner_command.rb +51 -27
  380. data/lib/rubygems/commands/pristine_command.rb +99 -71
  381. data/lib/rubygems/commands/push_command.rb +53 -46
  382. data/lib/rubygems/commands/query_command.rb +21 -328
  383. data/lib/rubygems/commands/rdoc_command.rb +33 -33
  384. data/lib/rubygems/commands/search_command.rb +9 -9
  385. data/lib/rubygems/commands/server_command.rb +15 -76
  386. data/lib/rubygems/commands/setup_command.rb +370 -186
  387. data/lib/rubygems/commands/signin_command.rb +34 -0
  388. data/lib/rubygems/commands/signout_command.rb +32 -0
  389. data/lib/rubygems/commands/sources_command.rb +57 -41
  390. data/lib/rubygems/commands/specification_command.rb +38 -28
  391. data/lib/rubygems/commands/stale_command.rb +6 -5
  392. data/lib/rubygems/commands/uninstall_command.rb +96 -62
  393. data/lib/rubygems/commands/unpack_command.rb +44 -53
  394. data/lib/rubygems/commands/update_command.rb +153 -99
  395. data/lib/rubygems/commands/which_command.rb +14 -17
  396. data/lib/rubygems/commands/yank_command.rb +28 -32
  397. data/lib/rubygems/compatibility.rb +13 -32
  398. data/lib/rubygems/config_file.rb +214 -119
  399. data/lib/rubygems/core_ext/kernel_gem.rb +10 -16
  400. data/lib/rubygems/core_ext/kernel_require.rb +92 -90
  401. data/lib/rubygems/core_ext/kernel_warn.rb +49 -0
  402. data/lib/rubygems/core_ext/tcpsocket_init.rb +54 -0
  403. data/lib/rubygems/defaults.rb +184 -54
  404. data/lib/rubygems/dependency.rb +75 -62
  405. data/lib/rubygems/dependency_installer.rb +74 -230
  406. data/lib/rubygems/dependency_list.rb +32 -33
  407. data/lib/rubygems/deprecate.rb +113 -17
  408. data/lib/rubygems/doctor.rb +31 -31
  409. data/lib/rubygems/errors.rb +51 -13
  410. data/lib/rubygems/exceptions.rb +65 -35
  411. data/lib/rubygems/ext/build_error.rb +3 -1
  412. data/lib/rubygems/ext/builder.rb +103 -77
  413. data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +27 -0
  414. data/lib/rubygems/ext/cargo_builder.rb +360 -0
  415. data/lib/rubygems/ext/cmake_builder.rb +6 -7
  416. data/lib/rubygems/ext/configure_builder.rb +6 -9
  417. data/lib/rubygems/ext/ext_conf_builder.rb +40 -61
  418. data/lib/rubygems/ext/rake_builder.rb +18 -21
  419. data/lib/rubygems/ext.rb +8 -7
  420. data/lib/rubygems/gem_runner.rb +19 -21
  421. data/lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb +163 -0
  422. data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +105 -0
  423. data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +78 -0
  424. data/lib/rubygems/gemcutter_utilities.rb +246 -43
  425. data/lib/rubygems/install_default_message.rb +3 -3
  426. data/lib/rubygems/install_message.rb +3 -3
  427. data/lib/rubygems/install_update_options.rb +104 -98
  428. data/lib/rubygems/installer.rb +407 -225
  429. data/lib/rubygems/installer_uninstaller_utils.rb +27 -0
  430. data/lib/rubygems/local_remote_options.rb +29 -32
  431. data/lib/rubygems/name_tuple.rb +18 -23
  432. data/lib/rubygems/net/http.rb +3 -0
  433. data/lib/rubygems/net-http/.document +1 -0
  434. data/lib/rubygems/net-http/LICENSE.txt +22 -0
  435. data/lib/rubygems/net-http/lib/net/http/backward.rb +40 -0
  436. data/lib/rubygems/net-http/lib/net/http/exceptions.rb +34 -0
  437. data/lib/rubygems/net-http/lib/net/http/generic_request.rb +414 -0
  438. data/lib/rubygems/net-http/lib/net/http/header.rb +981 -0
  439. data/lib/rubygems/net-http/lib/net/http/proxy_delta.rb +17 -0
  440. data/lib/rubygems/net-http/lib/net/http/request.rb +88 -0
  441. data/lib/rubygems/net-http/lib/net/http/requests.rb +425 -0
  442. data/lib/rubygems/net-http/lib/net/http/response.rb +738 -0
  443. data/lib/rubygems/net-http/lib/net/http/responses.rb +1174 -0
  444. data/lib/rubygems/net-http/lib/net/http/status.rb +84 -0
  445. data/lib/rubygems/net-http/lib/net/http.rb +2496 -0
  446. data/lib/rubygems/net-http/lib/net/https.rb +23 -0
  447. data/lib/rubygems/net-protocol/.document +1 -0
  448. data/lib/rubygems/net-protocol/LICENSE.txt +22 -0
  449. data/lib/rubygems/net-protocol/lib/net/protocol.rb +544 -0
  450. data/lib/rubygems/openssl.rb +7 -0
  451. data/lib/rubygems/optparse/.document +1 -0
  452. data/lib/rubygems/optparse/COPYING +56 -0
  453. data/lib/rubygems/optparse/lib/optionparser.rb +2 -0
  454. data/lib/rubygems/optparse/lib/optparse/ac.rb +54 -0
  455. data/lib/rubygems/optparse/lib/optparse/date.rb +18 -0
  456. data/lib/rubygems/optparse/lib/optparse/kwargs.rb +22 -0
  457. data/lib/rubygems/optparse/lib/optparse/shellwords.rb +7 -0
  458. data/lib/rubygems/optparse/lib/optparse/time.rb +11 -0
  459. data/lib/rubygems/optparse/lib/optparse/uri.rb +7 -0
  460. data/lib/rubygems/optparse/lib/optparse/version.rb +71 -0
  461. data/lib/rubygems/optparse/lib/optparse.rb +2330 -0
  462. data/lib/rubygems/optparse.rb +3 -0
  463. data/lib/rubygems/package/digest_io.rb +5 -7
  464. data/lib/rubygems/package/file_source.rb +6 -8
  465. data/lib/rubygems/package/io_source.rb +6 -4
  466. data/lib/rubygems/package/old.rb +19 -28
  467. data/lib/rubygems/package/source.rb +1 -1
  468. data/lib/rubygems/package/tar_header.rb +114 -93
  469. data/lib/rubygems/package/tar_reader/entry.rb +116 -22
  470. data/lib/rubygems/package/tar_reader.rb +18 -40
  471. data/lib/rubygems/package/tar_writer.rb +42 -56
  472. data/lib/rubygems/package.rb +254 -144
  473. data/lib/rubygems/package_task.rb +8 -14
  474. data/lib/rubygems/path_support.rb +21 -16
  475. data/lib/rubygems/platform.rb +135 -74
  476. data/lib/rubygems/psych_tree.rb +3 -2
  477. data/lib/rubygems/query_utils.rb +349 -0
  478. data/lib/rubygems/rdoc.rb +4 -326
  479. data/lib/rubygems/remote_fetcher.rb +99 -181
  480. data/lib/rubygems/request/connection_pools.rb +31 -24
  481. data/lib/rubygems/request/http_pool.rb +6 -7
  482. data/lib/rubygems/request/https_pool.rb +2 -3
  483. data/lib/rubygems/request.rb +107 -57
  484. data/lib/rubygems/request_set/gem_dependency_api.rb +182 -190
  485. data/lib/rubygems/request_set/lockfile/parser.rb +42 -52
  486. data/lib/rubygems/request_set/lockfile/tokenizer.rb +34 -24
  487. data/lib/rubygems/request_set/lockfile.rb +32 -35
  488. data/lib/rubygems/request_set.rb +115 -71
  489. data/lib/rubygems/requirement.rb +77 -68
  490. data/lib/rubygems/resolv/.document +1 -0
  491. data/lib/rubygems/resolv/LICENSE.txt +22 -0
  492. data/lib/rubygems/resolv/lib/resolv.rb +3387 -0
  493. data/lib/rubygems/resolver/activation_request.rb +34 -61
  494. data/lib/rubygems/resolver/api_set/gem_parser.rb +24 -0
  495. data/lib/rubygems/resolver/api_set.rb +40 -32
  496. data/lib/rubygems/resolver/api_specification.rb +37 -18
  497. data/lib/rubygems/resolver/best_set.rb +15 -17
  498. data/lib/rubygems/resolver/composed_set.rb +9 -11
  499. data/lib/rubygems/resolver/conflict.rb +19 -33
  500. data/lib/rubygems/resolver/current_set.rb +2 -4
  501. data/lib/rubygems/resolver/dependency_request.rb +8 -9
  502. data/lib/rubygems/resolver/git_set.rb +8 -10
  503. data/lib/rubygems/resolver/git_specification.rb +11 -13
  504. data/lib/rubygems/resolver/index_set.rb +13 -15
  505. data/lib/rubygems/resolver/index_specification.rb +42 -11
  506. data/lib/rubygems/resolver/installed_specification.rb +9 -11
  507. data/lib/rubygems/resolver/installer_set.rb +93 -47
  508. data/lib/rubygems/resolver/local_specification.rb +5 -7
  509. data/lib/rubygems/resolver/lock_set.rb +13 -15
  510. data/lib/rubygems/resolver/lock_specification.rb +13 -15
  511. data/lib/rubygems/resolver/molinillo/.document +1 -0
  512. data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
  513. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
  514. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +88 -0
  515. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +36 -0
  516. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +66 -0
  517. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +62 -0
  518. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +63 -0
  519. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +61 -0
  520. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +126 -0
  521. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +46 -0
  522. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +36 -0
  523. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +164 -0
  524. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +110 -146
  525. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +83 -9
  526. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  527. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +13 -1
  528. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
  529. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +552 -172
  530. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
  531. data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +12 -6
  532. data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
  533. data/lib/rubygems/resolver/molinillo.rb +2 -1
  534. data/lib/rubygems/resolver/requirement_list.rb +2 -2
  535. data/lib/rubygems/resolver/set.rb +3 -5
  536. data/lib/rubygems/resolver/source_set.rb +6 -7
  537. data/lib/rubygems/resolver/spec_specification.rb +16 -4
  538. data/lib/rubygems/resolver/specification.rb +25 -10
  539. data/lib/rubygems/resolver/stats.rb +1 -0
  540. data/lib/rubygems/resolver/vendor_set.rb +6 -8
  541. data/lib/rubygems/resolver/vendor_specification.rb +6 -8
  542. data/lib/rubygems/resolver.rb +121 -72
  543. data/lib/rubygems/s3_uri_signer.rb +177 -0
  544. data/lib/rubygems/safe_marshal/elements.rb +146 -0
  545. data/lib/rubygems/safe_marshal/reader.rb +308 -0
  546. data/lib/rubygems/safe_marshal/visitors/stream_printer.rb +31 -0
  547. data/lib/rubygems/safe_marshal/visitors/to_ruby.rb +415 -0
  548. data/lib/rubygems/safe_marshal/visitors/visitor.rb +74 -0
  549. data/lib/rubygems/safe_marshal.rb +74 -0
  550. data/lib/rubygems/safe_yaml.rb +36 -0
  551. data/lib/rubygems/security/policies.rb +49 -51
  552. data/lib/rubygems/security/policy.rb +46 -53
  553. data/lib/rubygems/security/signer.rb +86 -29
  554. data/lib/rubygems/security/trust_dir.rb +22 -24
  555. data/lib/rubygems/security.rb +101 -82
  556. data/lib/rubygems/security_option.rb +43 -0
  557. data/lib/rubygems/shellwords.rb +3 -0
  558. data/lib/rubygems/source/git.rb +40 -42
  559. data/lib/rubygems/source/installed.rb +5 -9
  560. data/lib/rubygems/source/local.rb +30 -33
  561. data/lib/rubygems/source/lock.rb +10 -10
  562. data/lib/rubygems/source/specific_file.rb +7 -9
  563. data/lib/rubygems/source/vendor.rb +3 -7
  564. data/lib/rubygems/source.rb +78 -68
  565. data/lib/rubygems/source_list.rb +11 -15
  566. data/lib/rubygems/spec_fetcher.rb +71 -83
  567. data/lib/rubygems/specification.rb +833 -1115
  568. data/lib/rubygems/specification_policy.rb +538 -0
  569. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem +21 -0
  570. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
  571. data/lib/rubygems/stub_specification.rb +55 -57
  572. data/lib/rubygems/text.rb +39 -27
  573. data/lib/rubygems/timeout/.document +1 -0
  574. data/lib/rubygems/timeout/LICENSE.txt +22 -0
  575. data/lib/rubygems/timeout/lib/timeout.rb +199 -0
  576. data/lib/rubygems/timeout.rb +3 -0
  577. data/lib/rubygems/tsort/.document +1 -0
  578. data/lib/rubygems/tsort/LICENSE.txt +22 -0
  579. data/lib/rubygems/tsort/lib/tsort.rb +455 -0
  580. data/lib/rubygems/tsort.rb +3 -0
  581. data/lib/rubygems/uninstaller.rb +150 -87
  582. data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
  583. data/lib/rubygems/update_suggestion.rb +56 -0
  584. data/lib/rubygems/uri.rb +126 -0
  585. data/lib/rubygems/uri_formatter.rb +4 -7
  586. data/lib/rubygems/user_interaction.rb +92 -146
  587. data/lib/rubygems/util/licenses.rb +712 -317
  588. data/lib/rubygems/util/list.rb +5 -2
  589. data/lib/rubygems/util.rb +58 -75
  590. data/lib/rubygems/validator.rb +26 -48
  591. data/lib/rubygems/version.rb +106 -56
  592. data/lib/rubygems/version_option.rb +22 -14
  593. data/lib/rubygems/yaml_serializer.rb +93 -0
  594. data/lib/rubygems.rb +453 -358
  595. data/rubygems-update.gemspec +38 -0
  596. data/setup.rb +13 -27
  597. metadata +511 -363
  598. data/.autotest +0 -71
  599. data/.document +0 -5
  600. data/.travis.yml +0 -46
  601. data/CONTRIBUTING.rdoc +0 -129
  602. data/CVE-2013-4287.txt +0 -35
  603. data/CVE-2013-4363.txt +0 -45
  604. data/CVE-2015-3900.txt +0 -40
  605. data/History.txt +0 -3094
  606. data/MAINTAINERS.md +0 -5
  607. data/POLICIES.rdoc +0 -61
  608. data/README.rdoc +0 -54
  609. data/Rakefile +0 -449
  610. data/UPGRADING.rdoc +0 -92
  611. data/appveyor.yml +0 -36
  612. data/bin/gem +0 -25
  613. data/bin/update_rubygems +0 -37
  614. data/lib/gauntlet_rubygems.rb +0 -51
  615. data/lib/rubygems/indexer.rb +0 -434
  616. data/lib/rubygems/installer_test_case.rb +0 -194
  617. data/lib/rubygems/mock_gem_ui.rb +0 -89
  618. data/lib/rubygems/package/tar_test_case.rb +0 -147
  619. data/lib/rubygems/psych_additions.rb +0 -10
  620. data/lib/rubygems/server.rb +0 -869
  621. data/lib/rubygems/source_local.rb +0 -6
  622. data/lib/rubygems/source_specific_file.rb +0 -5
  623. data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
  624. data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +0 -32
  625. data/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
  626. data/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
  627. data/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
  628. data/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem +0 -20
  629. data/lib/rubygems/syck_hack.rb +0 -77
  630. data/lib/rubygems/test_case.rb +0 -1496
  631. data/lib/rubygems/test_utilities.rb +0 -384
  632. data/lib/ubygems.rb +0 -11
  633. data/test/rubygems/alternate_cert.pem +0 -18
  634. data/test/rubygems/alternate_cert_32.pem +0 -18
  635. data/test/rubygems/alternate_key.pem +0 -27
  636. data/test/rubygems/bad_rake.rb +0 -2
  637. data/test/rubygems/ca_cert.pem +0 -68
  638. data/test/rubygems/child_cert.pem +0 -18
  639. data/test/rubygems/child_cert_32.pem +0 -18
  640. data/test/rubygems/child_key.pem +0 -27
  641. data/test/rubygems/client.pem +0 -49
  642. data/test/rubygems/data/gem-private_key.pem +0 -27
  643. data/test/rubygems/data/gem-public_cert.pem +0 -20
  644. data/test/rubygems/data/null-type.gemspec.rz +0 -0
  645. data/test/rubygems/encrypted_private_key.pem +0 -30
  646. data/test/rubygems/expired_cert.pem +0 -18
  647. data/test/rubygems/fake_certlib/openssl.rb +0 -8
  648. data/test/rubygems/fix_openssl_warnings.rb +0 -13
  649. data/test/rubygems/foo/discover.rb +0 -1
  650. data/test/rubygems/future_cert.pem +0 -18
  651. data/test/rubygems/future_cert_32.pem +0 -18
  652. data/test/rubygems/good_rake.rb +0 -2
  653. data/test/rubygems/grandchild_cert.pem +0 -18
  654. data/test/rubygems/grandchild_cert_32.pem +0 -18
  655. data/test/rubygems/grandchild_key.pem +0 -27
  656. data/test/rubygems/invalid_client.pem +0 -49
  657. data/test/rubygems/invalid_issuer_cert.pem +0 -18
  658. data/test/rubygems/invalid_issuer_cert_32.pem +0 -18
  659. data/test/rubygems/invalid_key.pem +0 -27
  660. data/test/rubygems/invalid_signer_cert.pem +0 -18
  661. data/test/rubygems/invalid_signer_cert_32.pem +0 -18
  662. data/test/rubygems/invalidchild_cert.pem +0 -18
  663. data/test/rubygems/invalidchild_cert_32.pem +0 -18
  664. data/test/rubygems/invalidchild_key.pem +0 -27
  665. data/test/rubygems/plugin/exception/rubygems_plugin.rb +0 -3
  666. data/test/rubygems/plugin/load/rubygems_plugin.rb +0 -4
  667. data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +0 -3
  668. data/test/rubygems/private_key.pem +0 -27
  669. data/test/rubygems/public_cert.pem +0 -18
  670. data/test/rubygems/public_cert_32.pem +0 -18
  671. data/test/rubygems/public_key.pem +0 -9
  672. data/test/rubygems/rubygems/commands/crash_command.rb +0 -6
  673. data/test/rubygems/rubygems_plugin.rb +0 -22
  674. data/test/rubygems/sff/discover.rb +0 -1
  675. data/test/rubygems/simple_gem.rb +0 -67
  676. data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -9
  677. data/test/rubygems/specifications/foo-0.0.1-x86-mswin32.gemspec +0 -0
  678. data/test/rubygems/ssl_cert.pem +0 -19
  679. data/test/rubygems/ssl_key.pem +0 -15
  680. data/test/rubygems/test_bundled_ca.rb +0 -59
  681. data/test/rubygems/test_config.rb +0 -24
  682. data/test/rubygems/test_deprecate.rb +0 -77
  683. data/test/rubygems/test_gem.rb +0 -1679
  684. data/test/rubygems/test_gem_available_set.rb +0 -130
  685. data/test/rubygems/test_gem_command.rb +0 -248
  686. data/test/rubygems/test_gem_command_manager.rb +0 -264
  687. data/test/rubygems/test_gem_commands_build_command.rb +0 -121
  688. data/test/rubygems/test_gem_commands_cert_command.rb +0 -671
  689. data/test/rubygems/test_gem_commands_check_command.rb +0 -69
  690. data/test/rubygems/test_gem_commands_cleanup_command.rb +0 -197
  691. data/test/rubygems/test_gem_commands_contents_command.rb +0 -240
  692. data/test/rubygems/test_gem_commands_dependency_command.rb +0 -230
  693. data/test/rubygems/test_gem_commands_environment_command.rb +0 -154
  694. data/test/rubygems/test_gem_commands_fetch_command.rb +0 -127
  695. data/test/rubygems/test_gem_commands_generate_index_command.rb +0 -51
  696. data/test/rubygems/test_gem_commands_help_command.rb +0 -75
  697. data/test/rubygems/test_gem_commands_install_command.rb +0 -987
  698. data/test/rubygems/test_gem_commands_list_command.rb +0 -34
  699. data/test/rubygems/test_gem_commands_lock_command.rb +0 -69
  700. data/test/rubygems/test_gem_commands_mirror.rb +0 -20
  701. data/test/rubygems/test_gem_commands_open_command.rb +0 -70
  702. data/test/rubygems/test_gem_commands_outdated_command.rb +0 -33
  703. data/test/rubygems/test_gem_commands_owner_command.rb +0 -205
  704. data/test/rubygems/test_gem_commands_pristine_command.rb +0 -491
  705. data/test/rubygems/test_gem_commands_push_command.rb +0 -330
  706. data/test/rubygems/test_gem_commands_query_command.rb +0 -657
  707. data/test/rubygems/test_gem_commands_search_command.rb +0 -18
  708. data/test/rubygems/test_gem_commands_server_command.rb +0 -60
  709. data/test/rubygems/test_gem_commands_setup_command.rb +0 -136
  710. data/test/rubygems/test_gem_commands_sources_command.rb +0 -249
  711. data/test/rubygems/test_gem_commands_specification_command.rb +0 -251
  712. data/test/rubygems/test_gem_commands_stale_command.rb +0 -43
  713. data/test/rubygems/test_gem_commands_uninstall_command.rb +0 -283
  714. data/test/rubygems/test_gem_commands_unpack_command.rb +0 -209
  715. data/test/rubygems/test_gem_commands_update_command.rb +0 -514
  716. data/test/rubygems/test_gem_commands_which_command.rb +0 -87
  717. data/test/rubygems/test_gem_commands_yank_command.rb +0 -100
  718. data/test/rubygems/test_gem_config_file.rb +0 -491
  719. data/test/rubygems/test_gem_dependency.rb +0 -362
  720. data/test/rubygems/test_gem_dependency_installer.rb +0 -1235
  721. data/test/rubygems/test_gem_dependency_list.rb +0 -260
  722. data/test/rubygems/test_gem_dependency_resolution_error.rb +0 -29
  723. data/test/rubygems/test_gem_doctor.rb +0 -169
  724. data/test/rubygems/test_gem_ext_builder.rb +0 -341
  725. data/test/rubygems/test_gem_ext_cmake_builder.rb +0 -87
  726. data/test/rubygems/test_gem_ext_configure_builder.rb +0 -87
  727. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +0 -211
  728. data/test/rubygems/test_gem_ext_rake_builder.rb +0 -65
  729. data/test/rubygems/test_gem_gem_runner.rb +0 -69
  730. data/test/rubygems/test_gem_gemcutter_utilities.rb +0 -235
  731. data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -62
  732. data/test/rubygems/test_gem_indexer.rb +0 -367
  733. data/test/rubygems/test_gem_install_update_options.rb +0 -197
  734. data/test/rubygems/test_gem_installer.rb +0 -1552
  735. data/test/rubygems/test_gem_local_remote_options.rb +0 -134
  736. data/test/rubygems/test_gem_name_tuple.rb +0 -45
  737. data/test/rubygems/test_gem_package.rb +0 -876
  738. data/test/rubygems/test_gem_package_old.rb +0 -90
  739. data/test/rubygems/test_gem_package_tar_header.rb +0 -147
  740. data/test/rubygems/test_gem_package_tar_reader.rb +0 -90
  741. data/test/rubygems/test_gem_package_tar_reader_entry.rb +0 -142
  742. data/test/rubygems/test_gem_package_tar_writer.rb +0 -264
  743. data/test/rubygems/test_gem_package_task.rb +0 -84
  744. data/test/rubygems/test_gem_path_support.rb +0 -121
  745. data/test/rubygems/test_gem_platform.rb +0 -308
  746. data/test/rubygems/test_gem_rdoc.rb +0 -270
  747. data/test/rubygems/test_gem_remote_fetcher.rb +0 -1051
  748. data/test/rubygems/test_gem_request.rb +0 -363
  749. data/test/rubygems/test_gem_request_connection_pools.rb +0 -130
  750. data/test/rubygems/test_gem_request_set.rb +0 -595
  751. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +0 -831
  752. data/test/rubygems/test_gem_request_set_lockfile.rb +0 -470
  753. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +0 -549
  754. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +0 -306
  755. data/test/rubygems/test_gem_requirement.rb +0 -387
  756. data/test/rubygems/test_gem_resolver.rb +0 -715
  757. data/test/rubygems/test_gem_resolver_activation_request.rb +0 -74
  758. data/test/rubygems/test_gem_resolver_api_set.rb +0 -209
  759. data/test/rubygems/test_gem_resolver_api_specification.rb +0 -145
  760. data/test/rubygems/test_gem_resolver_best_set.rb +0 -138
  761. data/test/rubygems/test_gem_resolver_composed_set.rb +0 -46
  762. data/test/rubygems/test_gem_resolver_conflict.rb +0 -88
  763. data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -85
  764. data/test/rubygems/test_gem_resolver_git_set.rb +0 -190
  765. data/test/rubygems/test_gem_resolver_git_specification.rb +0 -114
  766. data/test/rubygems/test_gem_resolver_index_set.rb +0 -90
  767. data/test/rubygems/test_gem_resolver_index_specification.rb +0 -90
  768. data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -50
  769. data/test/rubygems/test_gem_resolver_installer_set.rb +0 -258
  770. data/test/rubygems/test_gem_resolver_local_specification.rb +0 -46
  771. data/test/rubygems/test_gem_resolver_lock_set.rb +0 -64
  772. data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -100
  773. data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -21
  774. data/test/rubygems/test_gem_resolver_specification.rb +0 -65
  775. data/test/rubygems/test_gem_resolver_vendor_set.rb +0 -84
  776. data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -84
  777. data/test/rubygems/test_gem_security.rb +0 -307
  778. data/test/rubygems/test_gem_security_policy.rb +0 -541
  779. data/test/rubygems/test_gem_security_signer.rb +0 -209
  780. data/test/rubygems/test_gem_security_trust_dir.rb +0 -101
  781. data/test/rubygems/test_gem_server.rb +0 -409
  782. data/test/rubygems/test_gem_silent_ui.rb +0 -117
  783. data/test/rubygems/test_gem_source.rb +0 -242
  784. data/test/rubygems/test_gem_source_fetch_problem.rb +0 -20
  785. data/test/rubygems/test_gem_source_git.rb +0 -309
  786. data/test/rubygems/test_gem_source_installed.rb +0 -37
  787. data/test/rubygems/test_gem_source_list.rb +0 -118
  788. data/test/rubygems/test_gem_source_local.rb +0 -107
  789. data/test/rubygems/test_gem_source_lock.rb +0 -115
  790. data/test/rubygems/test_gem_source_specific_file.rb +0 -76
  791. data/test/rubygems/test_gem_source_vendor.rb +0 -32
  792. data/test/rubygems/test_gem_spec_fetcher.rb +0 -311
  793. data/test/rubygems/test_gem_specification.rb +0 -3519
  794. data/test/rubygems/test_gem_stream_ui.rb +0 -239
  795. data/test/rubygems/test_gem_stub_specification.rb +0 -217
  796. data/test/rubygems/test_gem_text.rb +0 -77
  797. data/test/rubygems/test_gem_uninstaller.rb +0 -485
  798. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -33
  799. data/test/rubygems/test_gem_uri_formatter.rb +0 -29
  800. data/test/rubygems/test_gem_util.rb +0 -40
  801. data/test/rubygems/test_gem_validator.rb +0 -46
  802. data/test/rubygems/test_gem_version.rb +0 -222
  803. data/test/rubygems/test_gem_version_option.rb +0 -152
  804. data/test/rubygems/test_kernel.rb +0 -86
  805. data/test/rubygems/test_require.rb +0 -322
  806. data/test/rubygems/wrong_key_cert.pem +0 -18
  807. data/test/rubygems/wrong_key_cert_32.pem +0 -18
  808. data/util/CL2notes +0 -56
  809. data/util/create_certs.rb +0 -157
  810. data/util/create_encrypted_key.rb +0 -17
  811. data/util/generate_spdx_license_list.rb +0 -51
  812. data/util/update_bundled_ca_certificates.rb +0 -118
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
- require 'uri'
3
- require 'fileutils'
4
2
 
3
+ require_relative "text"
5
4
  ##
6
5
  # A Source knows how to list and fetch gems from a RubyGems marshal index.
7
6
  #
@@ -9,14 +8,14 @@ require 'fileutils'
9
8
  # bundler dependency API and so-forth.
10
9
 
11
10
  class Gem::Source
12
-
13
11
  include Comparable
12
+ include Gem::Text
14
13
 
15
14
  FILES = { # :nodoc:
16
- :released => 'specs',
17
- :latest => 'latest_specs',
18
- :prerelease => 'prerelease_specs',
19
- }
15
+ released: "specs",
16
+ latest: "latest_specs",
17
+ prerelease: "prerelease_specs",
18
+ }.freeze
20
19
 
21
20
  ##
22
21
  # The URI this source will fetch gems from.
@@ -27,24 +26,9 @@ class Gem::Source
27
26
  # Creates a new Source which will use the index located at +uri+.
28
27
 
29
28
  def initialize(uri)
30
- begin
31
- unless uri.kind_of? URI
32
- uri = URI.parse(uri.to_s)
33
- end
34
- rescue URI::InvalidURIError
35
- raise if Gem::Source == self.class
36
- end
37
-
38
- @uri = uri
39
- @api_uri = nil
40
- end
41
-
42
- ##
43
- # Use an SRV record on the host to look up the true endpoint for the index.
44
-
45
- def api_uri # :nodoc:
46
- require 'rubygems/remote_fetcher'
47
- @api_uri ||= Gem::RemoteFetcher.fetcher.api_endpoint uri
29
+ require_relative "uri"
30
+ @uri = Gem::Uri.parse!(uri)
31
+ @update_cache = nil
48
32
  end
49
33
 
50
34
  ##
@@ -60,21 +44,23 @@ class Gem::Source
60
44
  Gem::Source::Vendor then
61
45
  -1
62
46
  when Gem::Source then
63
- if !@uri
47
+ unless @uri
64
48
  return 0 unless other.uri
65
49
  return 1
66
50
  end
67
51
 
68
- return -1 if !other.uri
52
+ return -1 unless other.uri
69
53
 
70
- @uri.to_s <=> other.uri.to_s
71
- else
72
- nil
54
+ # Returning 1 here ensures that when sorting a list of sources, the
55
+ # original ordering of sources supplied by the user is preserved.
56
+ return 1 unless @uri.to_s == other.uri.to_s
57
+
58
+ 0
73
59
  end
74
60
  end
75
61
 
76
- def == other # :nodoc:
77
- self.class === other and @uri == other.uri
62
+ def ==(other) # :nodoc:
63
+ self.class === other && @uri == other.uri
78
64
  end
79
65
 
80
66
  alias_method :eql?, :== # :nodoc:
@@ -83,9 +69,17 @@ class Gem::Source
83
69
  # Returns a Set that can fetch specifications from this source.
84
70
 
85
71
  def dependency_resolver_set # :nodoc:
86
- return Gem::Resolver::IndexSet.new self if 'file' == api_uri.scheme
72
+ return Gem::Resolver::IndexSet.new self if uri.scheme == "file"
87
73
 
88
- bundler_api_uri = api_uri + './api/v1/dependencies'
74
+ fetch_uri = if uri.host == "rubygems.org"
75
+ index_uri = uri.dup
76
+ index_uri.host = "index.rubygems.org"
77
+ index_uri
78
+ else
79
+ uri
80
+ end
81
+
82
+ bundler_api_uri = enforce_trailing_slash(fetch_uri)
89
83
 
90
84
  begin
91
85
  fetcher = Gem::RemoteFetcher.fetcher
@@ -93,11 +87,7 @@ class Gem::Source
93
87
  rescue Gem::RemoteFetcher::FetchError
94
88
  Gem::Resolver::IndexSet.new self
95
89
  else
96
- if response.respond_to? :uri then
97
- Gem::Resolver::APISet.new response.uri
98
- else
99
- Gem::Resolver::APISet.new bundler_api_uri
100
- end
90
+ Gem::Resolver::APISet.new response.uri + "./info/"
101
91
  end
102
92
  end
103
93
 
@@ -110,8 +100,7 @@ class Gem::Source
110
100
 
111
101
  def cache_dir(uri)
112
102
  # Correct for windows paths
113
- escaped_path = uri.path.sub(/^\/([a-z]):\//i, '/\\1-/')
114
- escaped_path.untaint
103
+ escaped_path = uri.path.sub(%r{^/([a-z]):/}i, '/\\1-/')
115
104
 
116
105
  File.join Gem.spec_cache_dir, "#{uri.host}%#{uri.port}", File.dirname(escaped_path)
117
106
  end
@@ -120,7 +109,8 @@ class Gem::Source
120
109
  # Returns true when it is possible and safe to update the cache directory.
121
110
 
122
111
  def update_cache?
123
- @update_cache ||=
112
+ return @update_cache unless @update_cache.nil?
113
+ @update_cache =
124
114
  begin
125
115
  File.stat(Gem.user_home).uid == Process.uid
126
116
  rescue Errno::ENOENT
@@ -131,38 +121,45 @@ class Gem::Source
131
121
  ##
132
122
  # Fetches a specification for the given +name_tuple+.
133
123
 
134
- def fetch_spec name_tuple
124
+ def fetch_spec(name_tuple)
135
125
  fetcher = Gem::RemoteFetcher.fetcher
136
126
 
137
127
  spec_file_name = name_tuple.spec_name
138
128
 
139
- uri = api_uri + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
129
+ source_uri = enforce_trailing_slash(uri) + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
140
130
 
141
- cache_dir = cache_dir uri
131
+ cache_dir = cache_dir source_uri
142
132
 
143
133
  local_spec = File.join cache_dir, spec_file_name
144
134
 
145
- if File.exist? local_spec then
135
+ if File.exist? local_spec
146
136
  spec = Gem.read_binary local_spec
147
- spec = Marshal.load(spec) rescue nil
137
+ Gem.load_safe_marshal
138
+ spec = begin
139
+ Gem::SafeMarshal.safe_load(spec)
140
+ rescue StandardError
141
+ nil
142
+ end
148
143
  return spec if spec
149
144
  end
150
145
 
151
- uri.path << '.rz'
146
+ source_uri.path << ".rz"
152
147
 
153
- spec = fetcher.fetch_path uri
154
- spec = Gem.inflate spec
148
+ spec = fetcher.fetch_path source_uri
149
+ spec = Gem::Util.inflate spec
155
150
 
156
- if update_cache? then
151
+ if update_cache?
152
+ require "fileutils"
157
153
  FileUtils.mkdir_p cache_dir
158
154
 
159
- open local_spec, 'wb' do |io|
155
+ File.open local_spec, "wb" do |io|
160
156
  io.write spec
161
157
  end
162
158
  end
163
159
 
160
+ Gem.load_safe_marshal
164
161
  # TODO: Investigate setting Gem::Specification#loaded_from to a URI
165
- Marshal.load spec
162
+ Gem::SafeMarshal.safe_load spec
166
163
  end
167
164
 
168
165
  ##
@@ -180,17 +177,21 @@ class Gem::Source
180
177
  file = FILES[type]
181
178
  fetcher = Gem::RemoteFetcher.fetcher
182
179
  file_name = "#{file}.#{Gem.marshal_version}"
183
- spec_path = api_uri + "#{file_name}.gz"
180
+ spec_path = enforce_trailing_slash(uri) + "#{file_name}.gz"
184
181
  cache_dir = cache_dir spec_path
185
182
  local_file = File.join(cache_dir, file_name)
186
183
  retried = false
187
184
 
188
- FileUtils.mkdir_p cache_dir if update_cache?
185
+ if update_cache?
186
+ require "fileutils"
187
+ FileUtils.mkdir_p cache_dir
188
+ end
189
189
 
190
190
  spec_dump = fetcher.cache_update_path spec_path, local_file, update_cache?
191
191
 
192
+ Gem.load_safe_marshal
192
193
  begin
193
- Gem::NameTuple.from_list Marshal.load(spec_dump)
194
+ Gem::NameTuple.from_list Gem::SafeMarshal.safe_load(spec_dump)
194
195
  rescue ArgumentError
195
196
  if update_cache? && !retried
196
197
  FileUtils.rm local_file
@@ -208,28 +209,37 @@ class Gem::Source
208
209
 
209
210
  def download(spec, dir=Dir.pwd)
210
211
  fetcher = Gem::RemoteFetcher.fetcher
211
- fetcher.download spec, api_uri.to_s, dir
212
+ fetcher.download spec, uri.to_s, dir
212
213
  end
213
214
 
214
- def pretty_print q # :nodoc:
215
- q.group 2, '[Remote:', ']' do
215
+ def pretty_print(q) # :nodoc:
216
+ q.group 2, "[Remote:", "]" do
216
217
  q.breakable
217
218
  q.text @uri.to_s
218
219
 
219
- if api = api_uri
220
+ if api = uri
220
221
  q.breakable
221
- q.text 'API URI: '
222
+ q.text "API URI: "
222
223
  q.text api.to_s
223
224
  end
224
225
  end
225
226
  end
226
227
 
227
- end
228
+ def typo_squatting?(host, distance_threshold=4)
229
+ return if @uri.host.nil?
230
+ levenshtein_distance(@uri.host, host).between? 1, distance_threshold
231
+ end
232
+
233
+ private
228
234
 
229
- require 'rubygems/source/git'
230
- require 'rubygems/source/installed'
231
- require 'rubygems/source/specific_file'
232
- require 'rubygems/source/local'
233
- require 'rubygems/source/lock'
234
- require 'rubygems/source/vendor'
235
+ def enforce_trailing_slash(uri)
236
+ uri.merge(uri.path.gsub(%r{/+$}, "") + "/")
237
+ end
238
+ end
235
239
 
240
+ require_relative "source/git"
241
+ require_relative "source/installed"
242
+ require_relative "source/specific_file"
243
+ require_relative "source/local"
244
+ require_relative "source/lock"
245
+ require_relative "source/vendor"
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/source'
3
2
 
4
3
  ##
5
4
  # The SourceList represents the sources rubygems has been configured to use.
@@ -15,7 +14,6 @@ require 'rubygems/source'
15
14
  # The most common way to get a SourceList is Gem.sources.
16
15
 
17
16
  class Gem::SourceList
18
-
19
17
  include Enumerable
20
18
 
21
19
  ##
@@ -38,7 +36,7 @@ class Gem::SourceList
38
36
 
39
37
  list.replace ary
40
38
 
41
- return list
39
+ list
42
40
  end
43
41
 
44
42
  def initialize_copy(other) # :nodoc:
@@ -51,13 +49,11 @@ class Gem::SourceList
51
49
 
52
50
  def <<(obj)
53
51
  src = case obj
54
- when URI
55
- Gem::Source.new(obj)
56
52
  when Gem::Source
57
53
  obj
58
54
  else
59
- Gem::Source.new(URI.parse(obj))
60
- end
55
+ Gem::Source.new(obj)
56
+ end
61
57
 
62
58
  @sources << src unless @sources.include?(src)
63
59
  src
@@ -88,7 +84,7 @@ class Gem::SourceList
88
84
  # Yields each source URI in the list.
89
85
 
90
86
  def each
91
- @sources.each { |s| yield s.uri.to_s }
87
+ @sources.each {|s| yield s.uri.to_s }
92
88
  end
93
89
 
94
90
  ##
@@ -105,7 +101,7 @@ class Gem::SourceList
105
101
  @sources.empty?
106
102
  end
107
103
 
108
- def == other # :nodoc:
104
+ def ==(other) # :nodoc:
109
105
  to_a == other
110
106
  end
111
107
 
@@ -113,7 +109,7 @@ class Gem::SourceList
113
109
  # Returns an Array of source URI Strings.
114
110
 
115
111
  def to_a
116
- @sources.map { |x| x.uri.to_s }
112
+ @sources.map {|x| x.uri.to_s }
117
113
  end
118
114
 
119
115
  alias_method :to_ary, :to_a
@@ -130,21 +126,21 @@ class Gem::SourceList
130
126
  # Gem::Source or a source URI.
131
127
 
132
128
  def include?(other)
133
- if other.kind_of? Gem::Source
129
+ if other.is_a? Gem::Source
134
130
  @sources.include? other
135
131
  else
136
- @sources.find { |x| x.uri.to_s == other.to_s }
132
+ @sources.find {|x| x.uri.to_s == other.to_s }
137
133
  end
138
134
  end
139
135
 
140
136
  ##
141
137
  # Deletes +source+ from the source list which may be a Gem::Source or a URI.
142
138
 
143
- def delete source
144
- if source.kind_of? Gem::Source
139
+ def delete(source)
140
+ if source.is_a? Gem::Source
145
141
  @sources.delete source
146
142
  else
147
- @sources.delete_if { |x| x.uri.to_s == source.to_s }
143
+ @sources.delete_if {|x| x.uri.to_s == source.to_s }
148
144
  end
149
145
  end
150
146
  end
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/remote_fetcher'
3
- require 'rubygems/user_interaction'
4
- require 'rubygems/errors'
5
- require 'rubygems/text'
6
- require 'rubygems/name_tuple'
2
+
3
+ require_relative "remote_fetcher"
4
+ require_relative "user_interaction"
5
+ require_relative "errors"
6
+ require_relative "text"
7
+ require_relative "name_tuple"
7
8
 
8
9
  ##
9
10
  # SpecFetcher handles metadata updates from remote gem repositories.
10
11
 
11
12
  class Gem::SpecFetcher
12
-
13
13
  include Gem::UserInteraction
14
14
  include Gem::Text
15
15
 
@@ -54,7 +54,7 @@ class Gem::SpecFetcher
54
54
  # If you need to retrieve specifications from a different +source+, you can
55
55
  # send it as an argument.
56
56
 
57
- def initialize sources = nil
57
+ def initialize(sources = nil)
58
58
  @sources = sources || Gem.sources
59
59
 
60
60
  @update_cache =
@@ -69,9 +69,9 @@ class Gem::SpecFetcher
69
69
  @prerelease_specs = {}
70
70
 
71
71
  @caches = {
72
- :latest => @latest_specs,
73
- :prerelease => @prerelease_specs,
74
- :released => @specs,
72
+ latest: @latest_specs,
73
+ prerelease: @prerelease_specs,
74
+ released: @specs,
75
75
  }
76
76
 
77
77
  @fetcher = Gem::RemoteFetcher.fetcher
@@ -88,29 +88,18 @@ class Gem::SpecFetcher
88
88
 
89
89
  rejected_specs = {}
90
90
 
91
- if dependency.prerelease?
92
- if dependency.specific?
93
- type = :complete
94
- else
95
- type = :abs_latest
96
- end
97
- elsif dependency.latest_version?
98
- type = :latest
99
- else
100
- type = :released
101
- end
91
+ list, errors = available_specs(dependency.identity)
102
92
 
103
- list, errors = available_specs(type)
104
93
  list.each do |source, specs|
105
94
  if dependency.name.is_a?(String) && specs.respond_to?(:bsearch)
106
- start_index = (0 ... specs.length).bsearch{ |i| specs[i].name >= dependency.name }
107
- end_index = (0 ... specs.length).bsearch{ |i| specs[i].name > dependency.name }
108
- specs = specs[start_index ... end_index] if start_index && end_index
95
+ start_index = (0...specs.length).bsearch {|i| specs[i].name >= dependency.name }
96
+ end_index = (0...specs.length).bsearch {|i| specs[i].name > dependency.name }
97
+ specs = specs[start_index...end_index] if start_index && end_index
109
98
  end
110
99
 
111
100
  found[source] = specs.select do |tup|
112
101
  if dependency.match?(tup)
113
- if matching_platform and !Gem::Platform.match(tup.platform)
102
+ if matching_platform && !Gem::Platform.match_gem?(tup.platform, tup.name)
114
103
  pm = (
115
104
  rejected_specs[dependency] ||= \
116
105
  Gem::PlatformMismatch.new(tup.name, tup.version))
@@ -133,12 +122,11 @@ class Gem::SpecFetcher
133
122
  end
134
123
  end
135
124
 
136
- tuples = tuples.sort_by { |x| x[0] }
125
+ tuples = tuples.sort_by {|x| x[0].version }
137
126
 
138
- return [tuples, errors]
127
+ [tuples, errors]
139
128
  end
140
129
 
141
-
142
130
  ##
143
131
  # Return all gem name tuples who's names match +obj+
144
132
 
@@ -157,7 +145,6 @@ class Gem::SpecFetcher
157
145
  tuples
158
146
  end
159
147
 
160
-
161
148
  ##
162
149
  # Find and fetch specs that match +dependency+.
163
150
  #
@@ -168,42 +155,47 @@ class Gem::SpecFetcher
168
155
 
169
156
  specs = []
170
157
  tuples.each do |tup, source|
171
- begin
172
- spec = source.fetch_spec(tup)
173
- rescue Gem::RemoteFetcher::FetchError => e
174
- errors << Gem::SourceFetchProblem.new(source, e)
175
- else
176
- specs << [spec, source]
177
- end
158
+ spec = source.fetch_spec(tup)
159
+ rescue Gem::RemoteFetcher::FetchError => e
160
+ errors << Gem::SourceFetchProblem.new(source, e)
161
+ else
162
+ specs << [spec, source]
178
163
  end
179
164
 
180
- return [specs, errors]
165
+ [specs, errors]
181
166
  end
182
167
 
183
168
  ##
184
169
  # Suggests gems based on the supplied +gem_name+. Returns an array of
185
170
  # alternative gem names.
186
171
 
187
- def suggest_gems_from_name gem_name
188
- gem_name = gem_name.downcase.tr('_-', '')
172
+ def suggest_gems_from_name(gem_name, type = :latest, num_results = 5)
173
+ gem_name = gem_name.downcase.tr("_-", "")
189
174
  max = gem_name.size / 2
190
- names = available_specs(:latest).first.values.flatten(1)
175
+ names = available_specs(type).first.values.flatten(1)
191
176
 
192
- matches = names.map { |n|
177
+ matches = names.map do |n|
193
178
  next unless n.match_platform?
179
+ [n.name, 0] if n.name.downcase.tr("_-", "").include?(gem_name)
180
+ end.compact
181
+
182
+ if matches.length < num_results
183
+ matches += names.map do |n|
184
+ next unless n.match_platform?
185
+ distance = levenshtein_distance gem_name, n.name.downcase.tr("_-", "")
186
+ next if distance >= max
187
+ return [n.name] if distance == 0
188
+ [n.name, distance]
189
+ end.compact
190
+ end
194
191
 
195
- distance = levenshtein_distance gem_name, n.name.downcase.tr('_-', '')
196
-
197
- next if distance >= max
198
-
199
- return [n.name] if distance == 0
200
-
201
- [n.name, distance]
202
- }.compact
203
-
204
- matches = matches.uniq.sort_by { |name, dist| dist }
192
+ matches = if matches.empty? && type != :prerelease
193
+ suggest_gems_from_name gem_name, :prerelease
194
+ else
195
+ matches.uniq.sort_by {|_name, dist| dist }
196
+ end
205
197
 
206
- matches.first(5).map { |name, dist| name }
198
+ matches.map {|name, _dist| name }.uniq.first(num_results)
207
199
  end
208
200
 
209
201
  ##
@@ -221,34 +213,32 @@ class Gem::SpecFetcher
221
213
  list = {}
222
214
 
223
215
  @sources.each_source do |source|
224
- begin
225
- names = case type
226
- when :latest
227
- tuples_for source, :latest
228
- when :released
229
- tuples_for source, :released
230
- when :complete
231
- names =
232
- tuples_for(source, :prerelease, true) +
233
- tuples_for(source, :released)
234
-
235
- names.sort
236
- when :abs_latest
237
- names =
238
- tuples_for(source, :prerelease, true) +
239
- tuples_for(source, :latest)
240
-
241
- names.sort
242
- when :prerelease
243
- tuples_for(source, :prerelease)
244
- else
245
- raise Gem::Exception, "Unknown type - :#{type}"
246
- end
247
- rescue Gem::RemoteFetcher::FetchError => e
248
- errors << Gem::SourceFetchProblem.new(source, e)
249
- else
250
- list[source] = names
216
+ names = case type
217
+ when :latest
218
+ tuples_for source, :latest
219
+ when :released
220
+ tuples_for source, :released
221
+ when :complete
222
+ names =
223
+ tuples_for(source, :prerelease, true) +
224
+ tuples_for(source, :released)
225
+
226
+ names.sort
227
+ when :abs_latest
228
+ names =
229
+ tuples_for(source, :prerelease, true) +
230
+ tuples_for(source, :latest)
231
+
232
+ names.sort
233
+ when :prerelease
234
+ tuples_for(source, :prerelease)
235
+ else
236
+ raise Gem::Exception, "Unknown type - :#{type}"
251
237
  end
238
+ rescue Gem::RemoteFetcher::FetchError => e
239
+ errors << Gem::SourceFetchProblem.new(source, e)
240
+ else
241
+ list[source] = names
252
242
  end
253
243
 
254
244
  [list, errors]
@@ -260,11 +250,9 @@ class Gem::SpecFetcher
260
250
 
261
251
  def tuples_for(source, type, gracefully_ignore=false) # :nodoc:
262
252
  @caches[type][source.uri] ||=
263
- source.load_specs(type).sort_by { |tup| tup.name }
253
+ source.load_specs(type).sort_by(&:name)
264
254
  rescue Gem::RemoteFetcher::FetchError
265
255
  raise unless gracefully_ignore
266
256
  []
267
257
  end
268
-
269
258
  end
270
-