rubygems-update 2.6.14 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (347) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -7
  3. data/CONTRIBUTING.rdoc +53 -54
  4. data/History.txt +173 -9
  5. data/Manifest.txt +39 -11
  6. data/POLICIES.rdoc +3 -3
  7. data/README.md +72 -0
  8. data/Rakefile +30 -5
  9. data/appveyor.yml +29 -1
  10. data/bin/gem +1 -1
  11. data/bin/update_rubygems +2 -2
  12. data/bundler/CHANGELOG.md +269 -9
  13. data/bundler/CODE_OF_CONDUCT.md +1 -1
  14. data/bundler/CONTRIBUTING.md +10 -29
  15. data/bundler/README.md +22 -10
  16. data/bundler/exe/bundle +5 -7
  17. data/bundler/exe/bundle_ruby +4 -3
  18. data/bundler/lib/bundler.rb +94 -74
  19. data/bundler/lib/bundler/build_metadata.rb +36 -0
  20. data/bundler/lib/bundler/capistrano.rb +5 -0
  21. data/bundler/lib/bundler/cli.rb +229 -66
  22. data/bundler/lib/bundler/cli/add.rb +25 -0
  23. data/bundler/lib/bundler/cli/binstubs.rb +9 -7
  24. data/bundler/lib/bundler/cli/cache.rb +5 -4
  25. data/bundler/lib/bundler/cli/check.rb +3 -5
  26. data/bundler/lib/bundler/cli/clean.rb +5 -6
  27. data/bundler/lib/bundler/cli/common.rb +18 -2
  28. data/bundler/lib/bundler/cli/config.rb +26 -7
  29. data/bundler/lib/bundler/cli/console.rb +2 -1
  30. data/bundler/lib/bundler/cli/doctor.rb +1 -0
  31. data/bundler/lib/bundler/cli/exec.rb +3 -2
  32. data/bundler/lib/bundler/cli/gem.rb +36 -15
  33. data/bundler/lib/bundler/cli/info.rb +50 -0
  34. data/bundler/lib/bundler/cli/init.rb +20 -7
  35. data/bundler/lib/bundler/cli/inject.rb +13 -4
  36. data/bundler/lib/bundler/cli/install.rb +61 -77
  37. data/bundler/lib/bundler/cli/issue.rb +40 -0
  38. data/bundler/lib/bundler/cli/list.rb +22 -0
  39. data/bundler/lib/bundler/cli/lock.rb +4 -2
  40. data/bundler/lib/bundler/cli/open.rb +2 -2
  41. data/bundler/lib/bundler/cli/outdated.rb +30 -28
  42. data/bundler/lib/bundler/cli/package.rb +9 -6
  43. data/bundler/lib/bundler/cli/platform.rb +1 -0
  44. data/bundler/lib/bundler/cli/plugin.rb +1 -0
  45. data/bundler/lib/bundler/cli/pristine.rb +43 -0
  46. data/bundler/lib/bundler/cli/show.rb +1 -1
  47. data/bundler/lib/bundler/cli/update.rb +32 -11
  48. data/bundler/lib/bundler/cli/viz.rb +5 -1
  49. data/bundler/lib/bundler/compact_index_client.rb +1 -0
  50. data/bundler/lib/bundler/compact_index_client/cache.rb +1 -2
  51. data/bundler/lib/bundler/compact_index_client/updater.rb +26 -7
  52. data/bundler/lib/bundler/compatibility_guard.rb +14 -0
  53. data/bundler/lib/bundler/constants.rb +1 -0
  54. data/bundler/lib/bundler/current_ruby.rb +8 -7
  55. data/bundler/lib/bundler/definition.rb +231 -159
  56. data/bundler/lib/bundler/dep_proxy.rb +2 -0
  57. data/bundler/lib/bundler/dependency.rb +6 -7
  58. data/bundler/lib/bundler/deployment.rb +1 -1
  59. data/bundler/lib/bundler/deprecate.rb +14 -3
  60. data/bundler/lib/bundler/dsl.rb +103 -62
  61. data/bundler/lib/bundler/endpoint_specification.rb +12 -2
  62. data/bundler/lib/bundler/env.rb +97 -36
  63. data/bundler/lib/bundler/environment_preserver.rb +27 -6
  64. data/bundler/lib/bundler/errors.rb +3 -1
  65. data/bundler/lib/bundler/feature_flag.rb +39 -4
  66. data/bundler/lib/bundler/fetcher.rb +15 -8
  67. data/bundler/lib/bundler/fetcher/base.rb +1 -0
  68. data/bundler/lib/bundler/fetcher/compact_index.rb +2 -12
  69. data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
  70. data/bundler/lib/bundler/fetcher/downloader.rb +4 -2
  71. data/bundler/lib/bundler/fetcher/index.rb +1 -0
  72. data/bundler/lib/bundler/friendly_errors.rb +5 -2
  73. data/bundler/lib/bundler/gem_helper.rb +23 -9
  74. data/bundler/lib/bundler/gem_helpers.rb +1 -0
  75. data/bundler/lib/bundler/gem_remote_fetcher.rb +1 -0
  76. data/bundler/lib/bundler/gem_tasks.rb +1 -0
  77. data/bundler/lib/bundler/gem_version_promoter.rb +1 -0
  78. data/bundler/lib/bundler/gemdeps.rb +1 -0
  79. data/bundler/lib/bundler/graph.rb +1 -0
  80. data/bundler/lib/bundler/index.rb +19 -11
  81. data/bundler/lib/bundler/injector.rb +51 -27
  82. data/bundler/lib/bundler/inline.rb +10 -10
  83. data/bundler/lib/bundler/installer.rb +104 -50
  84. data/bundler/lib/bundler/installer/gem_installer.rb +5 -2
  85. data/bundler/lib/bundler/installer/parallel_installer.rb +91 -42
  86. data/bundler/lib/bundler/installer/standalone.rb +1 -0
  87. data/bundler/lib/bundler/lazy_specification.rb +17 -4
  88. data/bundler/lib/bundler/lockfile_generator.rb +95 -0
  89. data/bundler/lib/bundler/lockfile_parser.rb +49 -35
  90. data/bundler/lib/bundler/match_platform.rb +1 -0
  91. data/bundler/lib/bundler/mirror.rb +8 -3
  92. data/bundler/lib/bundler/plugin.rb +6 -1
  93. data/bundler/lib/bundler/plugin/api/source.rb +16 -3
  94. data/bundler/lib/bundler/plugin/index.rb +2 -0
  95. data/bundler/lib/bundler/plugin/installer.rb +7 -6
  96. data/bundler/lib/bundler/plugin/source_list.rb +7 -8
  97. data/bundler/lib/bundler/process_lock.rb +24 -0
  98. data/bundler/lib/bundler/psyched_yaml.rb +10 -0
  99. data/bundler/lib/bundler/remote_specification.rb +25 -1
  100. data/bundler/lib/bundler/resolver.rb +171 -192
  101. data/bundler/lib/bundler/resolver/spec_group.rb +111 -0
  102. data/bundler/lib/bundler/retry.rb +1 -0
  103. data/bundler/lib/bundler/ruby_dsl.rb +1 -0
  104. data/bundler/lib/bundler/ruby_version.rb +6 -1
  105. data/bundler/lib/bundler/rubygems_ext.rb +18 -8
  106. data/bundler/lib/bundler/rubygems_gem_installer.rb +25 -2
  107. data/bundler/lib/bundler/rubygems_integration.rb +157 -66
  108. data/bundler/lib/bundler/runtime.rb +28 -18
  109. data/bundler/lib/bundler/settings.rb +202 -87
  110. data/bundler/lib/bundler/settings/validator.rb +79 -0
  111. data/bundler/lib/bundler/setup.rb +4 -7
  112. data/bundler/lib/bundler/shared_helpers.rb +129 -25
  113. data/bundler/lib/bundler/similarity_detector.rb +1 -0
  114. data/bundler/lib/bundler/source.rb +53 -1
  115. data/bundler/lib/bundler/source/gemspec.rb +1 -0
  116. data/bundler/lib/bundler/source/git.rb +49 -21
  117. data/bundler/lib/bundler/source/git/git_proxy.rb +17 -12
  118. data/bundler/lib/bundler/source/metadata.rb +63 -0
  119. data/bundler/lib/bundler/source/path.rb +38 -17
  120. data/bundler/lib/bundler/source/path/installer.rb +4 -2
  121. data/bundler/lib/bundler/source/rubygems.rb +154 -82
  122. data/bundler/lib/bundler/source/rubygems/remote.rb +8 -1
  123. data/bundler/lib/bundler/source_list.rb +75 -15
  124. data/bundler/lib/bundler/spec_set.rb +34 -21
  125. data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
  126. data/bundler/lib/bundler/stub_specification.rb +86 -2
  127. data/bundler/lib/bundler/templates/Executable +5 -1
  128. data/bundler/lib/bundler/templates/Executable.bundler +105 -0
  129. data/bundler/lib/bundler/templates/Executable.standalone +5 -5
  130. data/bundler/lib/bundler/templates/Gemfile +3 -0
  131. data/bundler/lib/bundler/templates/gems.rb +8 -0
  132. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +4 -2
  133. data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
  134. data/bundler/lib/bundler/templates/newgem/README.md.tt +14 -8
  135. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +5 -5
  136. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +4 -4
  137. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +3 -3
  138. data/bundler/lib/bundler/templates/newgem/gitignore.tt +0 -1
  139. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +6 -6
  140. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
  141. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -10
  142. data/bundler/lib/bundler/templates/newgem/rspec.tt +1 -0
  143. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
  144. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +3 -0
  145. data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +1 -1
  146. data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +3 -3
  147. data/bundler/lib/bundler/ui.rb +1 -0
  148. data/bundler/lib/bundler/ui/rg_proxy.rb +1 -0
  149. data/bundler/lib/bundler/ui/shell.rb +24 -10
  150. data/bundler/lib/bundler/ui/silent.rb +12 -1
  151. data/bundler/lib/bundler/uri_credentials_filter.rb +1 -0
  152. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
  153. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
  154. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
  155. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  156. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
  157. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +16 -5
  158. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  159. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +10 -2
  160. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
  161. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
  162. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
  163. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
  164. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
  165. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
  166. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +5 -4
  167. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +69 -6
  168. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  169. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
  170. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
  171. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +501 -138
  172. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
  173. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
  174. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +3 -1
  175. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +46 -21
  176. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +24 -22
  177. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +2 -1
  178. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  179. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +2 -2
  180. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
  181. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +66 -18
  182. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +17 -15
  183. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +55 -32
  184. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +13 -11
  185. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
  186. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +7 -5
  187. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +94 -63
  188. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +3 -3
  189. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +13 -13
  190. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +4 -5
  191. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
  192. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
  193. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +16 -16
  194. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +42 -21
  195. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -10
  196. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +31 -29
  197. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  198. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +49 -33
  199. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
  200. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -4
  201. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
  202. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  203. data/bundler/lib/bundler/vendored_fileutils.rb +9 -0
  204. data/bundler/lib/bundler/vendored_molinillo.rb +1 -0
  205. data/bundler/lib/bundler/vendored_persistent.rb +35 -0
  206. data/bundler/lib/bundler/vendored_thor.rb +6 -2
  207. data/bundler/lib/bundler/version.rb +19 -2
  208. data/bundler/lib/bundler/version_ranges.rb +76 -0
  209. data/bundler/lib/bundler/vlad.rb +5 -0
  210. data/bundler/lib/bundler/worker.rb +3 -1
  211. data/bundler/lib/bundler/yaml_serializer.rb +3 -3
  212. data/bundler/man/bundle-add.ronn +29 -0
  213. data/bundler/man/bundle-binstubs.ronn +14 -0
  214. data/bundler/man/bundle-check.ronn +26 -0
  215. data/bundler/man/bundle-clean.ronn +18 -0
  216. data/bundler/man/bundle-config.ronn +180 -60
  217. data/bundler/man/bundle-exec.ronn +7 -0
  218. data/bundler/man/bundle-gem.ronn +3 -2
  219. data/bundler/man/bundle-info.ronn +17 -0
  220. data/bundler/man/bundle-init.ronn +18 -0
  221. data/bundler/man/bundle-inject.ronn +22 -0
  222. data/bundler/man/bundle-install.ronn +32 -32
  223. data/bundler/man/bundle-list.ronn +15 -0
  224. data/bundler/man/bundle-open.ronn +19 -0
  225. data/bundler/man/bundle-outdated.ronn +1 -1
  226. data/bundler/man/bundle-package.ronn +5 -0
  227. data/bundler/man/bundle-pristine.ronn +34 -0
  228. data/bundler/man/bundle-show.ronn +20 -0
  229. data/bundler/man/bundle-update.ronn +6 -3
  230. data/bundler/man/bundle-viz.ronn +30 -0
  231. data/bundler/man/bundle.ronn +11 -20
  232. data/bundler/man/gemfile.5.ronn +55 -64
  233. data/lib/rubygems.rb +79 -36
  234. data/lib/rubygems/basic_specification.rb +8 -4
  235. data/lib/rubygems/bundler_version_finder.rb +112 -0
  236. data/lib/rubygems/command.rb +1 -1
  237. data/lib/rubygems/command_manager.rb +3 -1
  238. data/lib/rubygems/commands/cert_command.rb +31 -6
  239. data/lib/rubygems/commands/cleanup_command.rb +1 -1
  240. data/lib/rubygems/commands/help_command.rb +1 -1
  241. data/lib/rubygems/commands/owner_command.rb +3 -1
  242. data/lib/rubygems/commands/pristine_command.rb +11 -8
  243. data/lib/rubygems/commands/push_command.rb +2 -1
  244. data/lib/rubygems/commands/query_command.rb +13 -14
  245. data/lib/rubygems/commands/setup_command.rb +124 -69
  246. data/lib/rubygems/commands/signin_command.rb +33 -0
  247. data/lib/rubygems/commands/signout_command.rb +33 -0
  248. data/lib/rubygems/commands/uninstall_command.rb +4 -3
  249. data/lib/rubygems/commands/unpack_command.rb +16 -4
  250. data/lib/rubygems/commands/update_command.rb +1 -1
  251. data/lib/rubygems/commands/which_command.rb +1 -1
  252. data/lib/rubygems/commands/yank_command.rb +4 -11
  253. data/lib/rubygems/config_file.rb +13 -24
  254. data/lib/rubygems/core_ext/kernel_require.rb +10 -9
  255. data/lib/rubygems/dependency.rb +2 -0
  256. data/lib/rubygems/dependency_installer.rb +4 -0
  257. data/lib/rubygems/errors.rb +3 -0
  258. data/lib/rubygems/exceptions.rb +6 -0
  259. data/lib/rubygems/ext/builder.rb +1 -1
  260. data/lib/rubygems/ext/ext_conf_builder.rb +2 -4
  261. data/lib/rubygems/ext/rake_builder.rb +1 -1
  262. data/lib/rubygems/gem_runner.rb +5 -1
  263. data/lib/rubygems/install_update_options.rb +5 -28
  264. data/lib/rubygems/installer.rb +12 -7
  265. data/lib/rubygems/installer_test_case.rb +6 -3
  266. data/lib/rubygems/package/old.rb +1 -1
  267. data/lib/rubygems/request.rb +1 -1
  268. data/lib/rubygems/request_set.rb +20 -3
  269. data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
  270. data/lib/rubygems/requirement.rb +5 -1
  271. data/lib/rubygems/resolver.rb +24 -3
  272. data/lib/rubygems/resolver/installer_set.rb +4 -6
  273. data/lib/rubygems/safe_yaml.rb +4 -1
  274. data/lib/rubygems/security.rb +10 -3
  275. data/lib/rubygems/security_option.rb +43 -0
  276. data/lib/rubygems/server.rb +4 -12
  277. data/lib/rubygems/source.rb +7 -4
  278. data/lib/rubygems/source/git.rb +2 -1
  279. data/lib/rubygems/source/local.rb +38 -35
  280. data/lib/rubygems/source/lock.rb +4 -1
  281. data/lib/rubygems/source_local.rb +3 -1
  282. data/lib/rubygems/source_specific_file.rb +3 -2
  283. data/lib/rubygems/spec_fetcher.rb +7 -3
  284. data/lib/rubygems/specification.rb +281 -231
  285. data/lib/rubygems/stub_specification.rb +2 -3
  286. data/lib/rubygems/test_case.rb +14 -1
  287. data/lib/rubygems/user_interaction.rb +15 -13
  288. data/lib/rubygems/util.rb +6 -17
  289. data/lib/rubygems/version.rb +17 -3
  290. data/lib/rubygems/version_option.rb +6 -1
  291. data/setup.rb +1 -1
  292. data/test/rubygems/private3072_key.pem +40 -0
  293. data/test/rubygems/public3072_cert.pem +25 -0
  294. data/test/rubygems/test_config.rb +1 -1
  295. data/test/rubygems/test_gem.rb +72 -14
  296. data/test/rubygems/test_gem_bundler_version_finder.rb +125 -0
  297. data/test/rubygems/test_gem_command.rb +1 -1
  298. data/test/rubygems/test_gem_commands_build_command.rb +27 -1
  299. data/test/rubygems/test_gem_commands_cert_command.rb +64 -0
  300. data/test/rubygems/test_gem_commands_install_command.rb +35 -2
  301. data/test/rubygems/test_gem_commands_pristine_command.rb +1 -1
  302. data/test/rubygems/test_gem_commands_query_command.rb +19 -0
  303. data/test/rubygems/test_gem_commands_setup_command.rb +17 -0
  304. data/test/rubygems/test_gem_commands_signin_command.rb +95 -0
  305. data/test/rubygems/test_gem_commands_signout_command.rb +37 -0
  306. data/test/rubygems/test_gem_commands_sources_command.rb +1 -1
  307. data/test/rubygems/test_gem_commands_uninstall_command.rb +12 -0
  308. data/test/rubygems/test_gem_commands_update_command.rb +1 -1
  309. data/test/rubygems/test_gem_commands_which_command.rb +3 -3
  310. data/test/rubygems/test_gem_dependency.rb +28 -0
  311. data/test/rubygems/test_gem_ext_builder.rb +2 -2
  312. data/test/rubygems/test_gem_ext_rake_builder.rb +2 -2
  313. data/test/rubygems/test_gem_install_update_options.rb +2 -1
  314. data/test/rubygems/test_gem_installer.rb +29 -27
  315. data/test/rubygems/test_gem_package.rb +5 -5
  316. data/test/rubygems/test_gem_remote_fetcher.rb +2 -2
  317. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +3 -3
  318. data/test/rubygems/test_gem_requirement.rb +6 -0
  319. data/test/rubygems/test_gem_resolver.rb +26 -0
  320. data/test/rubygems/test_gem_resolver_conflict.rb +1 -1
  321. data/test/rubygems/test_gem_security.rb +5 -0
  322. data/test/rubygems/test_gem_security_policy.rb +24 -24
  323. data/test/rubygems/test_gem_security_signer.rb +6 -6
  324. data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
  325. data/test/rubygems/test_gem_server.rb +18 -1
  326. data/test/rubygems/test_gem_source.rb +9 -0
  327. data/test/rubygems/test_gem_spec_fetcher.rb +20 -0
  328. data/test/rubygems/test_gem_specification.rb +85 -10
  329. data/test/rubygems/test_gem_stream_ui.rb +6 -6
  330. data/test/rubygems/test_gem_stub_specification.rb +19 -1
  331. data/test/rubygems/test_gem_util.rb +1 -0
  332. data/test/rubygems/test_gem_version.rb +28 -7
  333. data/test/rubygems/test_gem_version_option.rb +15 -0
  334. data/test/rubygems/test_kernel.rb +30 -0
  335. data/test/rubygems/test_require.rb +44 -0
  336. metadata +47 -46
  337. data/README.rdoc +0 -54
  338. data/bundler/DEVELOPMENT.md +0 -150
  339. data/bundler/ISSUES.md +0 -117
  340. data/bundler/lib/bundler/postit_trampoline.rb +0 -73
  341. data/bundler/lib/bundler/vendor/postit/lib/postit.rb +0 -15
  342. data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
  343. data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
  344. data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
  345. data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
  346. data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
  347. data/bundler/man/index.txt +0 -8
@@ -34,6 +34,10 @@ class Gem::Source::Lock < Gem::Source
34
34
  0 == (self <=> other)
35
35
  end
36
36
 
37
+ def hash # :nodoc:
38
+ @wrapped.hash ^ 3
39
+ end
40
+
37
41
  ##
38
42
  # Delegates to the wrapped source's fetch_spec method.
39
43
 
@@ -46,4 +50,3 @@ class Gem::Source::Lock < Gem::Source
46
50
  end
47
51
 
48
52
  end
49
-
@@ -2,5 +2,7 @@
2
2
  require 'rubygems/source'
3
3
  require 'rubygems/source_local'
4
4
 
5
- # TODO warn upon require, this file is deprecated.
5
+ unless Gem::Deprecate.skip
6
+ Kernel.warn "#{Gem.location_of_caller(3).join(':')}: Warning: Requiring rubygems/source_local is deprecated; please use rubygems/source/local instead."
7
+ end
6
8
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'rubygems/source/specific_file'
3
3
 
4
- # TODO warn upon require, this file is deprecated.
5
-
4
+ unless Gem::Deprecate.skip
5
+ Kernel.warn "#{Gem.location_of_caller(3).join(':')}: Warning: Requiring rubygems/source_specific_file is deprecated; please use rubygems/source/specific_file instead."
6
+ end
@@ -184,10 +184,10 @@ class Gem::SpecFetcher
184
184
  # Suggests gems based on the supplied +gem_name+. Returns an array of
185
185
  # alternative gem names.
186
186
 
187
- def suggest_gems_from_name gem_name
187
+ def suggest_gems_from_name(gem_name, type = :latest)
188
188
  gem_name = gem_name.downcase.tr('_-', '')
189
189
  max = gem_name.size / 2
190
- names = available_specs(:latest).first.values.flatten(1)
190
+ names = available_specs(type).first.values.flatten(1)
191
191
 
192
192
  matches = names.map { |n|
193
193
  next unless n.match_platform?
@@ -201,7 +201,11 @@ class Gem::SpecFetcher
201
201
  [n.name, distance]
202
202
  }.compact
203
203
 
204
- matches = matches.uniq.sort_by { |name, dist| dist }
204
+ matches = if matches.empty? && type != :prerelease
205
+ suggest_gems_from_name gem_name, :prerelease
206
+ else
207
+ matches.uniq.sort_by { |name, dist| dist }
208
+ end
205
209
 
206
210
  matches.first(5).map { |name, dist| name }
207
211
  end
@@ -30,6 +30,7 @@ require 'stringio'
30
30
  # s.email = 'rubycoder@example.com'
31
31
  # s.files = ["lib/example.rb"]
32
32
  # s.homepage = 'https://rubygems.org/gems/example'
33
+ # s.metadata = { "source_code_uri" => "https://github.com/example/example" }
33
34
  # end
34
35
  #
35
36
  # Starting in RubyGems 2.0, a Specification can hold arbitrary
@@ -157,16 +158,20 @@ class Gem::Specification < Gem::BasicSpecification
157
158
  :summary => nil,
158
159
  :test_files => [],
159
160
  :version => nil,
160
- }
161
+ }.freeze
161
162
 
162
- Dupable = { } # :nodoc:
163
+ INITIALIZE_CODE_FOR_DEFAULTS = { } # :nodoc:
163
164
 
164
165
  @@default_value.each do |k,v|
165
- case v
166
- when Time, Numeric, Symbol, true, false, nil
167
- Dupable[k] = false
166
+ INITIALIZE_CODE_FOR_DEFAULTS[k] = case v
167
+ when [], {}, true, false, nil, Numeric, Symbol
168
+ v.inspect
169
+ when String
170
+ v.dump
171
+ when Numeric
172
+ "default_value(:#{k})"
168
173
  else
169
- Dupable[k] = true
174
+ "default_value(:#{k}).dup"
170
175
  end
171
176
  end
172
177
 
@@ -209,43 +214,51 @@ class Gem::Specification < Gem::BasicSpecification
209
214
  attr_reader :version
210
215
 
211
216
  ##
212
- # Paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
213
- # activated.
214
- #--
215
- # See also #require_paths
216
- #++
217
- # If you have an extension you do not need to add <code>"ext"</code> to the
218
- # require path, the extension build process will copy the extension files
219
- # into "lib" for you.
217
+ # A short summary of this gem's description. Displayed in `gem list -d`.
220
218
  #
221
- # The default value is <code>"lib"</code>
219
+ # The #description should be more detailed than the summary.
222
220
  #
223
221
  # Usage:
224
222
  #
225
- # # If all library files are in the root directory...
226
- # spec.require_paths = ['.']
223
+ # spec.summary = "This is a small summary of my gem"
227
224
 
228
- def require_paths=(val)
229
- @require_paths = Array(val)
230
- end
225
+ attr_reader :summary
231
226
 
232
227
  ##
233
- # The version of RubyGems used to create this gem.
228
+ # Files included in this gem. You cannot append to this accessor, you must
229
+ # assign to it.
234
230
  #
235
- # Do not set this, it is set automatically when the gem is packaged.
236
-
237
- attr_accessor :rubygems_version
238
-
239
- ##
240
- # A short summary of this gem's description. Displayed in `gem list -d`.
231
+ # Only add files you can require to this list, not directories, etc.
241
232
  #
242
- # The #description should be more detailed than the summary.
233
+ # Directories are automatically stripped from this list when building a gem,
234
+ # other non-files cause an error.
243
235
  #
244
236
  # Usage:
245
237
  #
246
- # spec.summary = "This is a small summary of my gem"
238
+ # require 'rake'
239
+ # spec.files = FileList['lib/**/*.rb',
240
+ # 'bin/*',
241
+ # '[A-Z]*',
242
+ # 'test/**/*'].to_a
243
+ #
244
+ # # or without Rake...
245
+ # spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
246
+ # spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
247
+ # spec.files.reject! { |fn| fn.include? "CVS" }
247
248
 
248
- attr_reader :summary
249
+ def files
250
+ # DO NOT CHANGE TO ||= ! This is not a normal accessor. (yes, it sucks)
251
+ # DOC: Why isn't it normal? Why does it suck? How can we fix this?
252
+ @files = [@files,
253
+ @test_files,
254
+ add_bindir(@executables),
255
+ @extra_rdoc_files,
256
+ @extensions,
257
+ ].flatten.compact.uniq.sort
258
+ end
259
+
260
+ ######################################################################
261
+ # :section: Recommended gemspec attributes
249
262
 
250
263
  ##
251
264
  # Singular writer for #authors
@@ -269,6 +282,148 @@ class Gem::Specification < Gem::BasicSpecification
269
282
  @authors = Array(value).flatten.grep(String)
270
283
  end
271
284
 
285
+ ##
286
+ # A long description of this gem
287
+ #
288
+ # The description should be more detailed than the summary but not
289
+ # excessively long. A few paragraphs is a recommended length with no
290
+ # examples or formatting.
291
+ #
292
+ # Usage:
293
+ #
294
+ # spec.description = <<-EOF
295
+ # Rake is a Make-like program implemented in Ruby. Tasks and
296
+ # dependencies are specified in standard Ruby syntax.
297
+ # EOF
298
+
299
+ attr_reader :description
300
+
301
+ ##
302
+ # A contact email address (or addresses) for this gem
303
+ #
304
+ # Usage:
305
+ #
306
+ # spec.email = 'john.jones@example.com'
307
+ # spec.email = ['jack@example.com', 'jill@example.com']
308
+
309
+ attr_accessor :email
310
+
311
+ ##
312
+ # The URL of this gem's home page
313
+ #
314
+ # Usage:
315
+ #
316
+ # spec.homepage = 'https://github.com/ruby/rake'
317
+
318
+ attr_accessor :homepage
319
+
320
+ ##
321
+ # The license for this gem.
322
+ #
323
+ # The license must be no more than 64 characters.
324
+ #
325
+ # This should just be the name of your license. The full text of the license
326
+ # should be inside of the gem (at the top level) when you build it.
327
+ #
328
+ # The simplest way, is to specify the standard SPDX ID
329
+ # https://spdx.org/licenses/ for the license.
330
+ # Ideally you should pick one that is OSI (Open Source Initiative)
331
+ # http://opensource.org/licenses/alphabetical approved.
332
+ #
333
+ # The most commonly used OSI approved licenses are MIT and Apache-2.0.
334
+ # GitHub also provides a license picker at http://choosealicense.com/.
335
+ #
336
+ # You should specify a license for your gem so that people know how they are
337
+ # permitted to use it, and any restrictions you're placing on it. Not
338
+ # specifying a license means all rights are reserved; others have no rights
339
+ # to use the code for any purpose.
340
+ #
341
+ # You can set multiple licenses with #licenses=
342
+ #
343
+ # Usage:
344
+ # spec.license = 'MIT'
345
+
346
+ def license=o
347
+ self.licenses = [o]
348
+ end
349
+
350
+ ##
351
+ # The license(s) for the library.
352
+ #
353
+ # Each license must be a short name, no more than 64 characters.
354
+ #
355
+ # This should just be the name of your license. The full
356
+ # text of the license should be inside of the gem when you build it.
357
+ #
358
+ # See #license= for more discussion
359
+ #
360
+ # Usage:
361
+ # spec.licenses = ['MIT', 'GPL-2.0']
362
+
363
+ def licenses= licenses
364
+ @licenses = Array licenses
365
+ end
366
+
367
+ ##
368
+ # The metadata holds extra data for this gem that may be useful to other
369
+ # consumers and is settable by gem authors without requiring an update to
370
+ # the rubygems software.
371
+ #
372
+ # Metadata items have the following restrictions:
373
+ #
374
+ # * The metadata must be a Hash object
375
+ # * All keys and values must be Strings
376
+ # * Keys can be a maximum of 128 bytes and values can be a maximum of 1024
377
+ # bytes
378
+ # * All strings must be UTF-8, no binary data is allowed
379
+ #
380
+ # You can use metadata to specify links to your gem's homepage, codebase,
381
+ # documentation, wiki, mailing list, issue tracker and changelog.
382
+ #
383
+ # s.metadata = {
384
+ # "bug_tracker_uri" => "https://example.com/user/bestgemever/issues",
385
+ # "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md",
386
+ # "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1",
387
+ # "homepage_uri" => "https://bestgemever.example.io",
388
+ # "mailing_list_uri" => "https://groups.example.com/bestgemever",
389
+ # "source_code_uri" => "https://example.com/user/bestgemever",
390
+ # "wiki_uri" => "https://example.com/user/bestgemever/wiki"
391
+ # }
392
+ #
393
+ # These links will be used on your gem's page on rubygems.org and must pass
394
+ # validation against following regex.
395
+ #
396
+ # %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}
397
+
398
+ attr_accessor :metadata
399
+
400
+ ######################################################################
401
+ # :section: Optional gemspec attributes
402
+
403
+ ##
404
+ # The path in the gem for executable scripts. Usually 'bin'
405
+ #
406
+ # Usage:
407
+ #
408
+ # spec.bindir = 'bin'
409
+
410
+ attr_accessor :bindir
411
+
412
+ ##
413
+ # The certificate chain used to sign this gem. See Gem::Security for
414
+ # details.
415
+
416
+ attr_accessor :cert_chain
417
+
418
+ ##
419
+ # A message that gets displayed after the gem is installed.
420
+ #
421
+ # Usage:
422
+ #
423
+ # spec.post_install_message = "Thanks for installing!"
424
+
425
+ attr_accessor :post_install_message
426
+
272
427
  ##
273
428
  # The platform this gem runs on.
274
429
  #
@@ -327,104 +482,26 @@ class Gem::Specification < Gem::BasicSpecification
327
482
  end
328
483
 
329
484
  ##
330
- # Files included in this gem. You cannot append to this accessor, you must
331
- # assign to it.
332
- #
333
- # Only add files you can require to this list, not directories, etc.
485
+ # Paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
486
+ # activated.
487
+ #--
488
+ # See also #require_paths
489
+ #++
490
+ # If you have an extension you do not need to add <code>"ext"</code> to the
491
+ # require path, the extension build process will copy the extension files
492
+ # into "lib" for you.
334
493
  #
335
- # Directories are automatically stripped from this list when building a gem,
336
- # other non-files cause an error.
494
+ # The default value is <code>"lib"</code>
337
495
  #
338
496
  # Usage:
339
497
  #
340
- # require 'rake'
341
- # spec.files = FileList['lib/**/*.rb',
342
- # 'bin/*',
343
- # '[A-Z]*',
344
- # 'test/**/*'].to_a
345
- #
346
- # # or without Rake...
347
- # spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
348
- # spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
349
- # spec.files.reject! { |fn| fn.include? "CVS" }
498
+ # # If all library files are in the root directory...
499
+ # spec.require_paths = ['.']
350
500
 
351
- def files
352
- # DO NOT CHANGE TO ||= ! This is not a normal accessor. (yes, it sucks)
353
- # DOC: Why isn't it normal? Why does it suck? How can we fix this?
354
- @files = [@files,
355
- @test_files,
356
- add_bindir(@executables),
357
- @extra_rdoc_files,
358
- @extensions,
359
- ].flatten.compact.uniq.sort
501
+ def require_paths=(val)
502
+ @require_paths = Array(val)
360
503
  end
361
504
 
362
- ######################################################################
363
- # :section: Optional gemspec attributes
364
-
365
- ##
366
- # The path in the gem for executable scripts. Usually 'bin'
367
- #
368
- # Usage:
369
- #
370
- # spec.bindir = 'bin'
371
-
372
- attr_accessor :bindir
373
-
374
- ##
375
- # The certificate chain used to sign this gem. See Gem::Security for
376
- # details.
377
-
378
- attr_accessor :cert_chain
379
-
380
- ##
381
- # A long description of this gem
382
- #
383
- # The description should be more detailed than the summary but not
384
- # excessively long. A few paragraphs is a recommended length with no
385
- # examples or formatting.
386
- #
387
- # Usage:
388
- #
389
- # spec.description = <<-EOF
390
- # Rake is a Make-like program implemented in Ruby. Tasks and
391
- # dependencies are specified in standard Ruby syntax.
392
- # EOF
393
-
394
- attr_reader :description
395
-
396
- ##
397
- # :category: Recommended gemspec attributes
398
- #
399
- # A contact email address (or addresses) for this gem
400
- #
401
- # Usage:
402
- #
403
- # spec.email = 'john.jones@example.com'
404
- # spec.email = ['jack@example.com', 'jill@example.com']
405
-
406
- attr_accessor :email
407
-
408
- ##
409
- # :category: Recommended gemspec attributes
410
- #
411
- # The URL of this gem's home page
412
- #
413
- # Usage:
414
- #
415
- # spec.homepage = 'https://github.com/ruby/rake'
416
-
417
- attr_accessor :homepage
418
-
419
- ##
420
- # A message that gets displayed after the gem is installed.
421
- #
422
- # Usage:
423
- #
424
- # spec.post_install_message = "Thanks for installing!"
425
-
426
- attr_accessor :post_install_message
427
-
428
505
  ##
429
506
  # The version of Ruby required by this gem
430
507
 
@@ -436,30 +513,16 @@ class Gem::Specification < Gem::BasicSpecification
436
513
  attr_reader :required_rubygems_version
437
514
 
438
515
  ##
439
- # The key used to sign this gem. See Gem::Security for details.
516
+ # The version of RubyGems used to create this gem.
517
+ #
518
+ # Do not set this, it is set automatically when the gem is packaged.
440
519
 
441
- attr_accessor :signing_key
520
+ attr_accessor :rubygems_version
442
521
 
443
522
  ##
444
- # :attr_accessor: metadata
445
- #
446
- # The metadata holds extra data for this gem that may be useful to other
447
- # consumers and is settable by gem authors without requiring an update to
448
- # the rubygems software.
449
- #
450
- # Metadata items have the following restrictions:
451
- #
452
- # * The metadata must be a Hash object
453
- # * All keys and values must be Strings
454
- # * Keys can be a maximum of 128 bytes and values can be a maximum of 1024
455
- # bytes
456
- # * All strings must be UTF-8, no binary data is allowed
457
- #
458
- # To add metadata for the location of a issue tracker:
459
- #
460
- # s.metadata = { "issue_tracker" => "https://example/issues" }
523
+ # The key used to sign this gem. See Gem::Security for details.
461
524
 
462
- attr_accessor :metadata
525
+ attr_accessor :signing_key
463
526
 
464
527
  ##
465
528
  # Adds a development dependency named +gem+ with +requirements+ to this
@@ -473,7 +536,7 @@ class Gem::Specification < Gem::BasicSpecification
473
536
  # activated when a gem is required.
474
537
 
475
538
  def add_development_dependency(gem, *requirements)
476
- add_dependency_with_type(gem, :development, *requirements)
539
+ add_dependency_with_type(gem, :development, requirements)
477
540
  end
478
541
 
479
542
  ##
@@ -484,7 +547,7 @@ class Gem::Specification < Gem::BasicSpecification
484
547
  # spec.add_runtime_dependency 'example', '~> 1.1', '>= 1.1.4'
485
548
 
486
549
  def add_runtime_dependency(gem, *requirements)
487
- add_dependency_with_type(gem, :runtime, *requirements)
550
+ add_dependency_with_type(gem, :runtime, requirements)
488
551
  end
489
552
 
490
553
  ##
@@ -556,56 +619,6 @@ class Gem::Specification < Gem::BasicSpecification
556
619
  @installed_by_version = Gem::Version.new version
557
620
  end
558
621
 
559
- ##
560
- # :category: Recommended gemspec attributes
561
- #
562
- # The license for this gem.
563
- #
564
- # The license must be no more than 64 characters.
565
- #
566
- # This should just be the name of your license. The full text of the license
567
- # should be inside of the gem (at the top level) when you build it.
568
- #
569
- # The simplest way, is to specify the standard SPDX ID
570
- # https://spdx.org/licenses/ for the license.
571
- # Ideally you should pick one that is OSI (Open Source Initiative)
572
- # http://opensource.org/licenses/alphabetical approved.
573
- #
574
- # The most commonly used OSI approved licenses are MIT and Apache-2.0.
575
- # GitHub also provides a license picker at http://choosealicense.com/.
576
- #
577
- # You should specify a license for your gem so that people know how they are
578
- # permitted to use it, and any restrictions you're placing on it. Not
579
- # specifying a license means all rights are reserved; others have no rights
580
- # to use the code for any purpose.
581
- #
582
- # You can set multiple licenses with #licenses=
583
- #
584
- # Usage:
585
- # spec.license = 'MIT'
586
-
587
- def license=o
588
- self.licenses = [o]
589
- end
590
-
591
- ##
592
- # :category: Recommended gemspec attributes
593
- # The license(s) for the library.
594
- #
595
- # Each license must be a short name, no more than 64 characters.
596
- #
597
- # This should just be the name of your license. The full
598
- # text of the license should be inside of the gem when you build it.
599
- #
600
- # See #license= for more discussion
601
- #
602
- # Usage:
603
- # spec.licenses = ['MIT', 'GPL-2.0']
604
-
605
- def licenses= licenses
606
- @licenses = Array licenses
607
- end
608
-
609
622
  ##
610
623
  # Specifies the rdoc options to be used when generating API documentation.
611
624
  #
@@ -882,7 +895,7 @@ class Gem::Specification < Gem::BasicSpecification
882
895
  # properly sorted.
883
896
 
884
897
  def self.add_spec spec
885
- warn "Gem::Specification.add_spec is deprecated and will be removed in Rubygems 3.0" unless Gem::Deprecate.skip
898
+ warn "Gem::Specification.add_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
886
899
  # TODO: find all extraneous adds
887
900
  # puts
888
901
  # p :add_spec => [spec.full_name, caller.reject { |s| s =~ /minitest/ }]
@@ -907,7 +920,7 @@ class Gem::Specification < Gem::BasicSpecification
907
920
  # Adds multiple specs to the known specifications.
908
921
 
909
922
  def self.add_specs *specs
910
- warn "Gem::Specification.add_specs is deprecated and will be removed in Rubygems 3.0" unless Gem::Deprecate.skip
923
+ warn "Gem::Specification.add_specs is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
911
924
 
912
925
  raise "nil spec!" if specs.any?(&:nil?) # TODO: remove once we're happy
913
926
 
@@ -1018,6 +1031,13 @@ class Gem::Specification < Gem::BasicSpecification
1018
1031
  Gem::Dependency.new(name, *requirements).matching_specs
1019
1032
  end
1020
1033
 
1034
+ ##
1035
+ # Returns every spec that has the given +full_name+
1036
+
1037
+ def self.find_all_by_full_name(full_name)
1038
+ stubs.select {|s| s.full_name == full_name }.map(&:to_spec)
1039
+ end
1040
+
1021
1041
  ##
1022
1042
  # Find the best specification matching a +name+ and +requirements+. Raises
1023
1043
  # if the dependency doesn't resolve to a valid specification.
@@ -1036,6 +1056,7 @@ class Gem::Specification < Gem::BasicSpecification
1036
1056
  def self.find_by_path path
1037
1057
  path = path.dup.freeze
1038
1058
  spec = @@spec_with_requirable_file[path] ||= (stubs.find { |s|
1059
+ next unless Gem::BundlerVersionFinder.compatible?(s)
1039
1060
  s.contains_requirable_file? path
1040
1061
  } || NOT_FOUND)
1041
1062
  spec.to_spec
@@ -1047,7 +1068,9 @@ class Gem::Specification < Gem::BasicSpecification
1047
1068
 
1048
1069
  def self.find_inactive_by_path path
1049
1070
  stub = stubs.find { |s|
1050
- s.contains_requirable_file? path unless s.activated?
1071
+ next if s.activated?
1072
+ next unless Gem::BundlerVersionFinder.compatible?(s)
1073
+ s.contains_requirable_file? path
1051
1074
  }
1052
1075
  stub && stub.to_spec
1053
1076
  end
@@ -1246,7 +1269,7 @@ class Gem::Specification < Gem::BasicSpecification
1246
1269
  # Removes +spec+ from the known specs.
1247
1270
 
1248
1271
  def self.remove_spec spec
1249
- warn "Gem::Specification.remove_spec is deprecated and will be removed in Rubygems 3.0" unless Gem::Deprecate.skip
1272
+ warn "Gem::Specification.remove_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
1250
1273
  _all.delete spec
1251
1274
  stubs.delete_if { |s| s.full_name == spec.full_name }
1252
1275
  (@@stubs_by_name[spec.name] || []).delete_if { |s| s.full_name == spec.full_name }
@@ -1516,7 +1539,7 @@ class Gem::Specification < Gem::BasicSpecification
1516
1539
  # +requirements+. Valid types are currently <tt>:runtime</tt> and
1517
1540
  # <tt>:development</tt>.
1518
1541
 
1519
- def add_dependency_with_type(dependency, type, *requirements)
1542
+ def add_dependency_with_type(dependency, type, requirements)
1520
1543
  requirements = if requirements.empty? then
1521
1544
  Gem::Requirement.default
1522
1545
  else
@@ -2022,6 +2045,20 @@ class Gem::Specification < Gem::BasicSpecification
2022
2045
  yaml_initialize coder.tag, coder.map
2023
2046
  end
2024
2047
 
2048
+
2049
+
2050
+ eval <<-RB, binding, __FILE__, __LINE__ + 1
2051
+ def set_nil_attributes_to_nil
2052
+ #{@@nil_attributes.map {|key| "@#{key} = nil" }.join "; "}
2053
+ end
2054
+ private :set_nil_attributes_to_nil
2055
+
2056
+ def set_not_nil_attributes_to_default_values
2057
+ #{@@non_nil_attributes.map {|key| "@#{key} = #{INITIALIZE_CODE_FOR_DEFAULTS[key]}" }.join ";"}
2058
+ end
2059
+ private :set_not_nil_attributes_to_default_values
2060
+ RB
2061
+
2025
2062
  ##
2026
2063
  # Specification constructor. Assigns the default values to the attributes
2027
2064
  # and yields itself for further initialization. Optionally takes +name+ and
@@ -2037,15 +2074,8 @@ class Gem::Specification < Gem::BasicSpecification
2037
2074
  @original_platform = nil
2038
2075
  @installed_by_version = nil
2039
2076
 
2040
- @@nil_attributes.each do |key|
2041
- instance_variable_set "@#{key}", nil
2042
- end
2043
-
2044
- @@non_nil_attributes.each do |key|
2045
- default = default_value(key)
2046
- value = Dupable[key] ? default.dup : default
2047
- instance_variable_set "@#{key}", value
2048
- end
2077
+ set_nil_attributes_to_nil
2078
+ set_not_nil_attributes_to_default_values
2049
2079
 
2050
2080
  @new_platform = Gem::Platform::RUBY
2051
2081
 
@@ -2742,29 +2772,7 @@ class Gem::Specification < Gem::BasicSpecification
2742
2772
  'metadata must be a hash'
2743
2773
  end
2744
2774
 
2745
- metadata.keys.each do |k|
2746
- if !k.kind_of?(String)
2747
- raise Gem::InvalidSpecificationException,
2748
- 'metadata keys must be a String'
2749
- end
2750
-
2751
- if k.size > 128
2752
- raise Gem::InvalidSpecificationException,
2753
- "metadata key too large (#{k.size} > 128)"
2754
- end
2755
- end
2756
-
2757
- metadata.values.each do |k|
2758
- if !k.kind_of?(String)
2759
- raise Gem::InvalidSpecificationException,
2760
- 'metadata values must be a String'
2761
- end
2762
-
2763
- if k.size > 1024
2764
- raise Gem::InvalidSpecificationException,
2765
- "metadata value too large (#{k.size} > 1024)"
2766
- end
2767
- end
2775
+ validate_metadata
2768
2776
 
2769
2777
  licenses.each { |license|
2770
2778
  if license.length > 64
@@ -2818,7 +2826,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
2818
2826
 
2819
2827
  # Warnings
2820
2828
 
2821
- %w[author email homepage summary].each do |attribute|
2829
+ %w[author homepage summary files].each do |attribute|
2822
2830
  value = self.send attribute
2823
2831
  warning "no #{attribute} specified" if value.nil? or value.empty?
2824
2832
  end
@@ -2851,6 +2859,48 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
2851
2859
  end
2852
2860
  end
2853
2861
 
2862
+ def validate_metadata
2863
+ url_validation_regex = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}
2864
+ link_keys = %w(
2865
+ bug_tracker_uri
2866
+ changelog_uri
2867
+ documentation_uri
2868
+ homepage_uri
2869
+ mailing_list_uri
2870
+ source_code_uri
2871
+ wiki_uri
2872
+ )
2873
+
2874
+ metadata.each do|key, value|
2875
+ if !key.kind_of?(String)
2876
+ raise Gem::InvalidSpecificationException,
2877
+ "metadata keys must be a String"
2878
+ end
2879
+
2880
+ if key.size > 128
2881
+ raise Gem::InvalidSpecificationException,
2882
+ "metadata key too large (#{key.size} > 128)"
2883
+ end
2884
+
2885
+ if !value.kind_of?(String)
2886
+ raise Gem::InvalidSpecificationException,
2887
+ "metadata values must be a String"
2888
+ end
2889
+
2890
+ if value.size > 1024
2891
+ raise Gem::InvalidSpecificationException,
2892
+ "metadata value too large (#{value.size} > 1024)"
2893
+ end
2894
+
2895
+ if link_keys.include? key
2896
+ if value !~ url_validation_regex
2897
+ raise Gem::InvalidSpecificationException,
2898
+ "metadata['#{key}'] has invalid link: #{value.inspect}"
2899
+ end
2900
+ end
2901
+ end
2902
+ end
2903
+
2854
2904
  ##
2855
2905
  # Checks that dependencies use requirements as we recommend. Warnings are
2856
2906
  # issued when dependencies are open-ended or overly strict for semantic