rubygems-update 3.1.4 → 3.2.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (343) hide show
  1. checksums.yaml +4 -4
  2. data/CODE_OF_CONDUCT.md +55 -19
  3. data/CONTRIBUTING.md +1 -2
  4. data/History.txt +130 -5
  5. data/Manifest.txt +10 -23
  6. data/POLICIES.md +2 -9
  7. data/README.md +1 -1
  8. data/Rakefile +30 -32
  9. data/bin/update_rubygems +1 -1
  10. data/bundler/CHANGELOG.md +806 -741
  11. data/bundler/README.md +6 -8
  12. data/bundler/UPGRADING.md +16 -30
  13. data/bundler/bundler.gemspec +3 -3
  14. data/bundler/exe/bundle +3 -0
  15. data/bundler/lib/bundler.rb +15 -4
  16. data/bundler/lib/bundler/build_metadata.rb +2 -2
  17. data/bundler/lib/bundler/cli.rb +32 -11
  18. data/bundler/lib/bundler/cli/console.rb +1 -1
  19. data/bundler/lib/bundler/cli/gem.rb +83 -10
  20. data/bundler/lib/bundler/cli/info.rb +13 -3
  21. data/bundler/lib/bundler/cli/init.rb +1 -1
  22. data/bundler/lib/bundler/cli/install.rb +5 -14
  23. data/bundler/lib/bundler/cli/issue.rb +2 -2
  24. data/bundler/lib/bundler/cli/list.rb +11 -9
  25. data/bundler/lib/bundler/cli/outdated.rb +88 -65
  26. data/bundler/lib/bundler/cli/plugin.rb +10 -0
  27. data/bundler/lib/bundler/cli/pristine.rb +5 -0
  28. data/bundler/lib/bundler/definition.rb +32 -32
  29. data/bundler/lib/bundler/dependency.rb +0 -9
  30. data/bundler/lib/bundler/dsl.rb +1 -5
  31. data/bundler/lib/bundler/environment_preserver.rb +26 -2
  32. data/bundler/lib/bundler/errors.rb +1 -0
  33. data/bundler/lib/bundler/feature_flag.rb +0 -2
  34. data/bundler/lib/bundler/fetcher.rb +1 -0
  35. data/bundler/lib/bundler/friendly_errors.rb +4 -10
  36. data/bundler/lib/bundler/gem_helper.rb +17 -10
  37. data/bundler/lib/bundler/gem_version_promoter.rb +1 -1
  38. data/bundler/lib/bundler/injector.rb +14 -3
  39. data/bundler/lib/bundler/inline.rb +1 -1
  40. data/bundler/lib/bundler/installer.rb +29 -28
  41. data/bundler/lib/bundler/installer/gem_installer.rb +2 -2
  42. data/bundler/lib/bundler/installer/parallel_installer.rb +9 -9
  43. data/bundler/lib/bundler/lazy_specification.rb +16 -3
  44. data/bundler/lib/bundler/plugin.rb +26 -0
  45. data/bundler/lib/bundler/plugin/index.rb +9 -0
  46. data/bundler/lib/bundler/psyched_yaml.rb +0 -15
  47. data/bundler/lib/bundler/remote_specification.rb +4 -1
  48. data/bundler/lib/bundler/resolver.rb +31 -8
  49. data/bundler/lib/bundler/resolver/spec_group.rb +26 -5
  50. data/bundler/lib/bundler/rubygems_ext.rb +7 -8
  51. data/bundler/lib/bundler/rubygems_gem_installer.rb +1 -7
  52. data/bundler/lib/bundler/rubygems_integration.rb +3 -48
  53. data/bundler/lib/bundler/runtime.rb +2 -12
  54. data/bundler/lib/bundler/settings.rb +0 -3
  55. data/bundler/lib/bundler/shared_helpers.rb +1 -1
  56. data/bundler/lib/bundler/source/git.rb +4 -4
  57. data/bundler/lib/bundler/source/git/git_proxy.rb +53 -58
  58. data/bundler/lib/bundler/source/path.rb +5 -1
  59. data/bundler/lib/bundler/source/path/installer.rb +7 -9
  60. data/bundler/lib/bundler/source/rubygems.rb +11 -14
  61. data/bundler/lib/bundler/stub_specification.rb +16 -4
  62. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  63. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +9 -1
  64. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +19 -5
  65. data/bundler/lib/bundler/templates/newgem/bin/console.tt +2 -0
  66. data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
  67. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
  68. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +18 -0
  69. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  70. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -0
  71. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  72. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -4
  73. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +10 -0
  74. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  75. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
  76. data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
  77. data/bundler/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
  78. data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  79. data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  80. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +75 -189
  81. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +0 -7
  82. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  83. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
  84. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  85. data/bundler/lib/bundler/version.rb +1 -1
  86. data/bundler/man/bundle-add.1 +1 -1
  87. data/bundler/man/bundle-add.1.txt +15 -15
  88. data/bundler/man/bundle-binstubs.1 +1 -1
  89. data/bundler/man/bundle-binstubs.1.txt +10 -10
  90. data/bundler/man/bundle-cache.1 +1 -1
  91. data/bundler/man/bundle-cache.1.txt +15 -15
  92. data/bundler/man/bundle-check.1 +1 -1
  93. data/bundler/man/bundle-check.1.txt +8 -8
  94. data/bundler/man/bundle-clean.1 +1 -1
  95. data/bundler/man/bundle-clean.1.txt +6 -6
  96. data/bundler/man/bundle-config.1 +3 -9
  97. data/bundler/man/bundle-config.1.txt +271 -272
  98. data/bundler/man/bundle-config.ronn +5 -9
  99. data/bundler/man/bundle-doctor.1 +1 -1
  100. data/bundler/man/bundle-doctor.1.txt +9 -9
  101. data/bundler/man/bundle-exec.1 +1 -1
  102. data/bundler/man/bundle-exec.1.txt +84 -81
  103. data/bundler/man/bundle-gem.1 +25 -3
  104. data/bundler/man/bundle-gem.1.txt +65 -39
  105. data/bundler/man/bundle-gem.ronn +30 -7
  106. data/bundler/man/bundle-info.1 +1 -1
  107. data/bundler/man/bundle-info.1.txt +2 -2
  108. data/bundler/man/bundle-init.1 +1 -1
  109. data/bundler/man/bundle-init.1.txt +9 -9
  110. data/bundler/man/bundle-inject.1 +1 -1
  111. data/bundler/man/bundle-inject.1.txt +4 -4
  112. data/bundler/man/bundle-install.1 +1 -1
  113. data/bundler/man/bundle-install.1.txt +169 -169
  114. data/bundler/man/bundle-list.1 +7 -7
  115. data/bundler/man/bundle-list.1.txt +12 -11
  116. data/bundler/man/bundle-list.ronn +6 -6
  117. data/bundler/man/bundle-lock.1 +1 -1
  118. data/bundler/man/bundle-lock.1.txt +28 -28
  119. data/bundler/man/bundle-open.1 +1 -1
  120. data/bundler/man/bundle-open.1.txt +3 -3
  121. data/bundler/man/bundle-outdated.1 +1 -1
  122. data/bundler/man/bundle-outdated.1.txt +34 -34
  123. data/bundler/man/bundle-platform.1 +1 -1
  124. data/bundler/man/bundle-platform.1.txt +16 -16
  125. data/bundler/man/bundle-pristine.1 +1 -1
  126. data/bundler/man/bundle-pristine.1.txt +8 -8
  127. data/bundler/man/bundle-remove.1 +1 -1
  128. data/bundler/man/bundle-remove.1.txt +9 -9
  129. data/bundler/man/bundle-show.1 +1 -1
  130. data/bundler/man/bundle-show.1.txt +8 -8
  131. data/bundler/man/bundle-update.1 +1 -1
  132. data/bundler/man/bundle-update.1.txt +149 -148
  133. data/bundler/man/bundle-viz.1 +1 -1
  134. data/bundler/man/bundle-viz.1.txt +11 -11
  135. data/bundler/man/bundle.1 +1 -1
  136. data/bundler/man/bundle.1.txt +31 -31
  137. data/bundler/man/gemfile.5 +1 -1
  138. data/bundler/man/gemfile.5.txt +218 -216
  139. data/lib/rubygems.rb +80 -157
  140. data/lib/rubygems/available_set.rb +4 -4
  141. data/lib/rubygems/basic_specification.rb +11 -5
  142. data/lib/rubygems/bundler_version_finder.rb +14 -9
  143. data/lib/rubygems/command.rb +16 -14
  144. data/lib/rubygems/command_manager.rb +4 -3
  145. data/lib/rubygems/commands/cert_command.rb +1 -1
  146. data/lib/rubygems/commands/cleanup_command.rb +3 -3
  147. data/lib/rubygems/commands/contents_command.rb +4 -4
  148. data/lib/rubygems/commands/dependency_command.rb +6 -6
  149. data/lib/rubygems/commands/fetch_command.rb +2 -2
  150. data/lib/rubygems/commands/help_command.rb +1 -1
  151. data/lib/rubygems/commands/info_command.rb +9 -4
  152. data/lib/rubygems/commands/install_command.rb +3 -3
  153. data/lib/rubygems/commands/list_command.rb +9 -6
  154. data/lib/rubygems/commands/lock_command.rb +1 -1
  155. data/lib/rubygems/commands/open_command.rb +0 -2
  156. data/lib/rubygems/commands/pristine_command.rb +10 -2
  157. data/lib/rubygems/commands/push_command.rb +4 -42
  158. data/lib/rubygems/commands/query_command.rb +7 -352
  159. data/lib/rubygems/commands/search_command.rb +8 -6
  160. data/lib/rubygems/commands/setup_command.rb +128 -32
  161. data/lib/rubygems/commands/specification_command.rb +2 -2
  162. data/lib/rubygems/commands/stale_command.rb +1 -1
  163. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  164. data/lib/rubygems/commands/unpack_command.rb +1 -1
  165. data/lib/rubygems/commands/update_command.rb +40 -10
  166. data/lib/rubygems/config_file.rb +11 -2
  167. data/lib/rubygems/core_ext/kernel_require.rb +26 -36
  168. data/lib/rubygems/defaults.rb +99 -5
  169. data/lib/rubygems/dependency.rb +2 -5
  170. data/lib/rubygems/dependency_installer.rb +1 -73
  171. data/lib/rubygems/dependency_list.rb +7 -7
  172. data/lib/rubygems/deprecate.rb +46 -1
  173. data/lib/rubygems/doctor.rb +4 -2
  174. data/lib/rubygems/errors.rb +3 -2
  175. data/lib/rubygems/exceptions.rb +2 -13
  176. data/lib/rubygems/ext.rb +6 -6
  177. data/lib/rubygems/ext/build_error.rb +2 -0
  178. data/lib/rubygems/ext/builder.rb +1 -1
  179. data/lib/rubygems/ext/cmake_builder.rb +1 -1
  180. data/lib/rubygems/ext/ext_conf_builder.rb +6 -7
  181. data/lib/rubygems/gem_runner.rb +3 -8
  182. data/lib/rubygems/gemcutter_utilities.rb +1 -1
  183. data/lib/rubygems/indexer.rb +1 -19
  184. data/lib/rubygems/install_update_options.rb +5 -5
  185. data/lib/rubygems/installer.rb +45 -42
  186. data/lib/rubygems/installer_test_case.rb +19 -2
  187. data/lib/rubygems/installer_uninstaller_utils.rb +24 -0
  188. data/lib/rubygems/local_remote_options.rb +1 -1
  189. data/lib/rubygems/name_tuple.rb +2 -4
  190. data/lib/rubygems/package.rb +8 -13
  191. data/lib/rubygems/package/old.rb +1 -1
  192. data/lib/rubygems/package/tar_header.rb +3 -3
  193. data/lib/rubygems/package/tar_reader.rb +0 -1
  194. data/lib/rubygems/package/tar_reader/entry.rb +0 -1
  195. data/lib/rubygems/package/tar_test_case.rb +1 -1
  196. data/lib/rubygems/package/tar_writer.rb +2 -6
  197. data/lib/rubygems/package_task.rb +1 -5
  198. data/lib/rubygems/path_support.rb +1 -1
  199. data/lib/rubygems/platform.rb +3 -3
  200. data/lib/rubygems/query_utils.rb +362 -0
  201. data/lib/rubygems/rdoc.rb +0 -12
  202. data/lib/rubygems/remote_fetcher.rb +5 -19
  203. data/lib/rubygems/request/connection_pools.rb +1 -1
  204. data/lib/rubygems/request_set.rb +5 -5
  205. data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
  206. data/lib/rubygems/request_set/lockfile.rb +8 -8
  207. data/lib/rubygems/request_set/lockfile/tokenizer.rb +1 -1
  208. data/lib/rubygems/requirement.rb +14 -15
  209. data/lib/rubygems/resolver.rb +7 -8
  210. data/lib/rubygems/resolver/api_set.rb +3 -3
  211. data/lib/rubygems/resolver/composed_set.rb +3 -3
  212. data/lib/rubygems/resolver/conflict.rb +1 -1
  213. data/lib/rubygems/resolver/index_set.rb +1 -1
  214. data/lib/rubygems/resolver/installer_set.rb +3 -3
  215. data/lib/rubygems/resolver/lock_set.rb +1 -1
  216. data/lib/rubygems/safe_yaml.rb +4 -4
  217. data/lib/rubygems/security.rb +25 -25
  218. data/lib/rubygems/security/policy.rb +3 -3
  219. data/lib/rubygems/security/signer.rb +4 -4
  220. data/lib/rubygems/security/trust_dir.rb +1 -1
  221. data/lib/rubygems/server.rb +8 -8
  222. data/lib/rubygems/source/git.rb +7 -6
  223. data/lib/rubygems/source/local.rb +2 -2
  224. data/lib/rubygems/source_list.rb +4 -5
  225. data/lib/rubygems/spec_fetcher.rb +18 -15
  226. data/lib/rubygems/specification.rb +79 -104
  227. data/lib/rubygems/specification_policy.rb +79 -27
  228. data/lib/rubygems/test_case.rb +64 -83
  229. data/lib/rubygems/test_utilities.rb +6 -6
  230. data/lib/rubygems/uninstaller.rb +35 -14
  231. data/lib/rubygems/user_interaction.rb +1 -10
  232. data/lib/rubygems/util.rb +10 -2
  233. data/lib/rubygems/util/licenses.rb +4 -4
  234. data/lib/rubygems/validator.rb +1 -1
  235. data/lib/rubygems/version.rb +4 -4
  236. data/rubygems-update.gemspec +2 -2
  237. data/setup.rb +2 -7
  238. data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
  239. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +0 -2
  240. data/test/rubygems/test_bundled_ca.rb +1 -5
  241. data/test/rubygems/test_deprecate.rb +43 -4
  242. data/test/rubygems/test_gem.rb +79 -74
  243. data/test/rubygems/test_gem_available_set.rb +3 -3
  244. data/test/rubygems/test_gem_bundler_version_finder.rb +19 -1
  245. data/test/rubygems/test_gem_command.rb +24 -3
  246. data/test/rubygems/test_gem_command_manager.rb +37 -4
  247. data/test/rubygems/test_gem_commands_build_command.rb +7 -2
  248. data/test/rubygems/test_gem_commands_cert_command.rb +2 -2
  249. data/test/rubygems/test_gem_commands_cleanup_command.rb +1 -1
  250. data/test/rubygems/test_gem_commands_contents_command.rb +48 -15
  251. data/test/rubygems/test_gem_commands_environment_command.rb +21 -21
  252. data/test/rubygems/test_gem_commands_generate_index_command.rb +1 -5
  253. data/test/rubygems/test_gem_commands_info_command.rb +6 -6
  254. data/test/rubygems/test_gem_commands_install_command.rb +31 -31
  255. data/test/rubygems/test_gem_commands_mirror.rb +1 -1
  256. data/test/rubygems/test_gem_commands_open_command.rb +4 -4
  257. data/test/rubygems/test_gem_commands_owner_command.rb +11 -3
  258. data/test/rubygems/test_gem_commands_pristine_command.rb +41 -8
  259. data/test/rubygems/test_gem_commands_push_command.rb +7 -2
  260. data/test/rubygems/test_gem_commands_query_command.rb +9 -5
  261. data/test/rubygems/test_gem_commands_setup_command.rb +160 -108
  262. data/test/rubygems/test_gem_commands_signin_command.rb +6 -4
  263. data/test/rubygems/test_gem_commands_signout_command.rb +0 -5
  264. data/test/rubygems/test_gem_commands_specification_command.rb +18 -18
  265. data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -1
  266. data/test/rubygems/test_gem_commands_update_command.rb +68 -5
  267. data/test/rubygems/test_gem_commands_which_command.rb +3 -3
  268. data/test/rubygems/test_gem_commands_yank_command.rb +14 -6
  269. data/test/rubygems/test_gem_config_file.rb +7 -10
  270. data/test/rubygems/test_gem_dependency_installer.rb +52 -189
  271. data/test/rubygems/test_gem_dependency_list.rb +8 -8
  272. data/test/rubygems/test_gem_dependency_resolution_error.rb +1 -1
  273. data/test/rubygems/test_gem_doctor.rb +28 -0
  274. data/test/rubygems/test_gem_ext_builder.rb +14 -25
  275. data/test/rubygems/test_gem_ext_cmake_builder.rb +13 -12
  276. data/test/rubygems/test_gem_ext_configure_builder.rb +1 -9
  277. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +0 -1
  278. data/test/rubygems/test_gem_ext_rake_builder.rb +9 -9
  279. data/test/rubygems/test_gem_gem_runner.rb +42 -0
  280. data/test/rubygems/test_gem_gemcutter_utilities.rb +5 -0
  281. data/test/rubygems/test_gem_indexer.rb +9 -13
  282. data/test/rubygems/test_gem_installer.rb +149 -45
  283. data/test/rubygems/test_gem_package.rb +13 -12
  284. data/test/rubygems/test_gem_package_tar_header.rb +19 -0
  285. data/test/rubygems/test_gem_package_tar_writer.rb +3 -3
  286. data/test/rubygems/test_gem_package_task.rb +46 -11
  287. data/test/rubygems/test_gem_remote_fetcher.rb +152 -190
  288. data/test/rubygems/test_gem_request.rb +11 -11
  289. data/test/rubygems/test_gem_request_set.rb +20 -20
  290. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +3 -3
  291. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +9 -9
  292. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +118 -118
  293. data/test/rubygems/test_gem_requirement.rb +2 -2
  294. data/test/rubygems/test_gem_resolver.rb +6 -6
  295. data/test/rubygems/test_gem_resolver_api_set.rb +3 -3
  296. data/test/rubygems/test_gem_resolver_best_set.rb +2 -2
  297. data/test/rubygems/test_gem_resolver_index_set.rb +2 -2
  298. data/test/rubygems/test_gem_resolver_installer_set.rb +7 -7
  299. data/test/rubygems/test_gem_resolver_lock_set.rb +3 -3
  300. data/test/rubygems/test_gem_security.rb +20 -20
  301. data/test/rubygems/test_gem_security_policy.rb +5 -8
  302. data/test/rubygems/test_gem_security_signer.rb +8 -8
  303. data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
  304. data/test/rubygems/test_gem_server.rb +10 -10
  305. data/test/rubygems/test_gem_source.rb +12 -14
  306. data/test/rubygems/test_gem_source_git.rb +12 -11
  307. data/test/rubygems/test_gem_source_installed.rb +7 -7
  308. data/test/rubygems/test_gem_source_local.rb +8 -8
  309. data/test/rubygems/test_gem_source_lock.rb +10 -10
  310. data/test/rubygems/test_gem_source_specific_file.rb +7 -7
  311. data/test/rubygems/test_gem_source_vendor.rb +7 -7
  312. data/test/rubygems/test_gem_spec_fetcher.rb +11 -2
  313. data/test/rubygems/test_gem_specification.rb +143 -113
  314. data/test/rubygems/test_gem_stream_ui.rb +3 -1
  315. data/test/rubygems/test_gem_text.rb +1 -1
  316. data/test/rubygems/test_gem_uninstaller.rb +134 -10
  317. data/test/rubygems/test_gem_util.rb +7 -5
  318. data/test/rubygems/test_gem_version.rb +1 -1
  319. data/test/rubygems/test_kernel.rb +25 -8
  320. data/test/rubygems/test_project_sanity.rb +8 -1
  321. data/test/rubygems/test_require.rb +242 -40
  322. metadata +29 -43
  323. data/.bundle/config +0 -2
  324. data/.rubocop.yml +0 -91
  325. data/Gemfile +0 -8
  326. data/Gemfile.lock +0 -43
  327. data/bundler/CODE_OF_CONDUCT.md +0 -136
  328. data/lib/rubygems/source_local.rb +0 -7
  329. data/lib/rubygems/source_specific_file.rb +0 -6
  330. data/lib/ubygems.rb +0 -14
  331. data/tmp/.keep +0 -0
  332. data/util/CL2notes +0 -55
  333. data/util/bisect +0 -10
  334. data/util/ci.sh +0 -62
  335. data/util/cops/deprecations.rb +0 -52
  336. data/util/create_certs.rb +0 -171
  337. data/util/create_certs.sh +0 -27
  338. data/util/create_encrypted_key.rb +0 -16
  339. data/util/generate_spdx_license_list.rb +0 -63
  340. data/util/patch_with_prs.rb +0 -77
  341. data/util/rubocop +0 -8
  342. data/util/update_bundled_ca_certificates.rb +0 -139
  343. data/util/update_changelog.rb +0 -64
@@ -8,6 +8,8 @@ class TestGemCommandsSigninCommand < Gem::TestCase
8
8
  def setup
9
9
  super
10
10
 
11
+ credential_setup
12
+
11
13
  Gem.configuration.rubygems_api_key = nil
12
14
  Gem.configuration.api_keys.clear
13
15
 
@@ -15,13 +17,13 @@ class TestGemCommandsSigninCommand < Gem::TestCase
15
17
  end
16
18
 
17
19
  def teardown
18
- credentials_path = Gem.configuration.credentials_path
19
- File.delete(credentials_path) if File.exist?(credentials_path)
20
+ credential_teardown
21
+
20
22
  super
21
23
  end
22
24
 
23
25
  def test_execute_when_not_already_signed_in
24
- sign_in_ui = util_capture() { @cmd.execute }
26
+ sign_in_ui = util_capture { @cmd.execute }
25
27
  assert_match %r{Signed in.}, sign_in_ui.output
26
28
  end
27
29
 
@@ -64,7 +66,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
64
66
  end
65
67
 
66
68
  def test_execute_with_valid_creds_set_for_default_host
67
- util_capture {@cmd.execute}
69
+ util_capture { @cmd.execute }
68
70
 
69
71
  api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
70
72
  credentials = YAML.load_file Gem.configuration.credentials_path
@@ -11,11 +11,6 @@ class TestGemCommandsSignoutCommand < Gem::TestCase
11
11
  @cmd = Gem::Commands::SignoutCommand.new
12
12
  end
13
13
 
14
- def teardown
15
- super
16
- File.delete Gem.configuration.credentials_path if File.exist?(Gem.configuration.credentials_path)
17
- end
18
-
19
14
  def test_execute_when_user_is_signed_in
20
15
  FileUtils.mkdir_p File.dirname(Gem.configuration.credentials_path)
21
16
  FileUtils::touch Gem.configuration.credentials_path
@@ -21,8 +21,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
21
21
  @cmd.execute
22
22
  end
23
23
 
24
- assert_match %r|Gem::Specification|, @ui.output
25
- assert_match %r|name: foo|, @ui.output
24
+ assert_match %r{Gem::Specification}, @ui.output
25
+ assert_match %r{name: foo}, @ui.output
26
26
  assert_equal '', @ui.error
27
27
  end
28
28
 
@@ -37,10 +37,10 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
37
37
  @cmd.execute
38
38
  end
39
39
 
40
- assert_match %r|Gem::Specification|, @ui.output
41
- assert_match %r|name: foo|, @ui.output
42
- assert_match %r|version: 0.0.1|, @ui.output
43
- assert_match %r|version: 0.0.2|, @ui.output
40
+ assert_match %r{Gem::Specification}, @ui.output
41
+ assert_match %r{name: foo}, @ui.output
42
+ assert_match %r{version: 0.0.1}, @ui.output
43
+ assert_match %r{version: 0.0.2}, @ui.output
44
44
  assert_equal '', @ui.error
45
45
  end
46
46
 
@@ -99,8 +99,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
99
99
  @cmd.execute
100
100
  end
101
101
 
102
- assert_match %r|Gem::Specification|, @ui.output
103
- assert_match %r|name: foo|, @ui.output
102
+ assert_match %r{Gem::Specification}, @ui.output
103
+ assert_match %r{name: foo}, @ui.output
104
104
  assert_equal '', @ui.error
105
105
  end
106
106
 
@@ -131,8 +131,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
131
131
  @cmd.execute
132
132
  end
133
133
 
134
- assert_match %r|Gem::Specification|, @ui.output
135
- assert_match %r|name: foo|, @ui.output
134
+ assert_match %r{Gem::Specification}, @ui.output
135
+ assert_match %r{name: foo}, @ui.output
136
136
  assert_equal '', @ui.error
137
137
  end
138
138
 
@@ -164,8 +164,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
164
164
  @cmd.execute
165
165
  end
166
166
 
167
- assert_match %r|\A--- !ruby/object:Gem::Specification|, @ui.output
168
- assert_match %r|name: foo|, @ui.output
167
+ assert_match %r{\A--- !ruby/object:Gem::Specification}, @ui.output
168
+ assert_match %r{name: foo}, @ui.output
169
169
  end
170
170
 
171
171
  def test_execute_remote_with_version
@@ -200,8 +200,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
200
200
  @cmd.execute
201
201
  end
202
202
 
203
- assert_match %r|\A--- !ruby/object:Gem::Specification|, @ui.output
204
- assert_match %r|name: foo|, @ui.output
203
+ assert_match %r{\A--- !ruby/object:Gem::Specification}, @ui.output
204
+ assert_match %r{name: foo}, @ui.output
205
205
 
206
206
  spec = YAML.load @ui.output
207
207
 
@@ -222,8 +222,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
222
222
  @cmd.execute
223
223
  end
224
224
 
225
- assert_match %r|\A--- !ruby/object:Gem::Specification|, @ui.output
226
- assert_match %r|name: foo|, @ui.output
225
+ assert_match %r{\A--- !ruby/object:Gem::Specification}, @ui.output
226
+ assert_match %r{name: foo}, @ui.output
227
227
 
228
228
  spec = YAML.load @ui.output
229
229
 
@@ -242,8 +242,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
242
242
  @cmd.execute
243
243
  end
244
244
 
245
- assert_match %r|Gem::Specification.new|, @ui.output
246
- assert_match %r|s.name = "foo"|, @ui.output
245
+ assert_match %r{Gem::Specification.new}, @ui.output
246
+ assert_match %r{s.name = "foo"}, @ui.output
247
247
  assert_equal '', @ui.error
248
248
  end
249
249
 
@@ -487,7 +487,7 @@ WARNING: Use your OS package manager to uninstall vendor gems
487
487
  end
488
488
 
489
489
  assert_empty @ui.output
490
- assert_match %r!Error: unable to successfully uninstall '#{@spec.name}'!, @ui.error
490
+ assert_match %r{Error: unable to successfully uninstall '#{@spec.name}'}, @ui.error
491
491
  end
492
492
 
493
493
  private
@@ -159,6 +159,44 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
159
159
  assert_empty out
160
160
  end
161
161
 
162
+ def test_execute_system_specific_older_than_3_2_removes_plugins_dir
163
+ spec_fetcher do |fetcher|
164
+ fetcher.download 'rubygems-update', 3.1 do |s|
165
+ s.files = %w[setup.rb]
166
+ end
167
+ end
168
+
169
+ @cmd.options[:args] = []
170
+ @cmd.options[:system] = "3.1"
171
+
172
+ FileUtils.mkdir_p Gem.plugindir
173
+ write_file File.join(Gem.plugindir, 'a_plugin.rb')
174
+
175
+ @cmd.execute
176
+
177
+ refute_path_exists Gem.plugindir, "Plugins folder not removed when updating rubygems to pre-3.2"
178
+ end
179
+
180
+ def test_execute_system_specific_newer_than_or_equal_to_3_2_leaves_plugins_dir_alone
181
+ spec_fetcher do |fetcher|
182
+ fetcher.download 'rubygems-update', 3.2 do |s|
183
+ s.files = %w[setup.rb]
184
+ end
185
+ end
186
+
187
+ @cmd.options[:args] = []
188
+ @cmd.options[:system] = "3.2"
189
+
190
+ FileUtils.mkdir_p Gem.plugindir
191
+ plugin_file = File.join(Gem.plugindir, 'a_plugin.rb')
192
+ write_file plugin_file
193
+
194
+ @cmd.execute
195
+
196
+ assert_path_exists Gem.plugindir, "Plugin folder removed when updating rubygems to post-3.2"
197
+ assert_path_exists plugin_file, "Plugin removed when updating rubygems to post-3.2"
198
+ end
199
+
162
200
  def test_execute_system_specifically_to_latest_version
163
201
  spec_fetcher do |fetcher|
164
202
  fetcher.download 'rubygems-update', 8 do |s|
@@ -200,6 +238,25 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
200
238
  @ui.error
201
239
  end
202
240
 
241
+ def test_execute_system_with_disabled_update
242
+ old_disable_system_update_message = Gem.disable_system_update_message
243
+ Gem.disable_system_update_message = "Please use package manager instead."
244
+
245
+ @cmd.options[:args] = []
246
+ @cmd.options[:system] = true
247
+
248
+ assert_raises Gem::MockGemUi::TermError do
249
+ use_ui @ui do
250
+ @cmd.execute
251
+ end
252
+ end
253
+
254
+ assert_empty @ui.output
255
+ assert_equal "ERROR: Please use package manager instead.\n", @ui.error
256
+ ensure
257
+ Gem.disable_system_update_message = old_disable_system_update_message
258
+ end
259
+
203
260
  # before:
204
261
  # a1 -> c1.2
205
262
  # after:
@@ -359,10 +416,10 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
359
416
  end
360
417
 
361
418
  def test_execute_user_install
362
- spec_fetcher do |fetcher|
363
- fetcher.download 'a', 2
364
- fetcher.spec 'a', 1
365
- end
419
+ a = util_spec "a", 1
420
+ b = util_spec "b", 1
421
+ install_gem_user(a)
422
+ install_gem(b)
366
423
 
367
424
  @cmd.handle_options %w[--user-install]
368
425
 
@@ -373,7 +430,13 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
373
430
  installer = @cmd.installer
374
431
  user_install = installer.instance_variable_get :@user_install
375
432
 
376
- assert user_install, 'user_install must be set on the installer'
433
+ assert user_install, "user_install must be set on the installer"
434
+
435
+ out = @ui.output.split "\n"
436
+ assert_equal "Updating installed gems", out.shift
437
+ assert_equal "Updating a", out.shift
438
+ assert_equal "Gems updated: a", out.shift
439
+ assert_empty out
377
440
  end
378
441
 
379
442
  def test_fetch_remote_gems
@@ -33,7 +33,7 @@ class TestGemCommandsWhichCommand < Gem::TestCase
33
33
  end
34
34
 
35
35
  assert_equal '', @ui.output
36
- assert_match %r%Can.t find Ruby library file or shared library directory\n%,
36
+ assert_match %r{Can.t find Ruby library file or shared library directory\n},
37
37
  @ui.error
38
38
  end
39
39
 
@@ -51,7 +51,7 @@ class TestGemCommandsWhichCommand < Gem::TestCase
51
51
  end
52
52
 
53
53
  assert_equal "#{@foo_bar.full_gem_path}/lib/foo_bar.rb\n", @ui.output
54
- assert_match %r%Can.t find Ruby library file or shared library missinglib\n%,
54
+ assert_match %r{Can.t find Ruby library file or shared library missinglib\n},
55
55
  @ui.error
56
56
  end
57
57
 
@@ -65,7 +65,7 @@ class TestGemCommandsWhichCommand < Gem::TestCase
65
65
  end
66
66
 
67
67
  assert_equal '', @ui.output
68
- assert_match %r%Can.t find Ruby library file or shared library missinglib\n%,
68
+ assert_match %r{Can.t find Ruby library file or shared library missinglib\n},
69
69
  @ui.error
70
70
  end
71
71
 
@@ -7,6 +7,8 @@ class TestGemCommandsYankCommand < Gem::TestCase
7
7
  def setup
8
8
  super
9
9
 
10
+ credential_setup
11
+
10
12
  @cmd = Gem::Commands::YankCommand.new
11
13
  @cmd.options[:host] = 'http://example'
12
14
 
@@ -16,6 +18,12 @@ class TestGemCommandsYankCommand < Gem::TestCase
16
18
  Gem.configuration.api_keys[:KEY] = 'other'
17
19
  end
18
20
 
21
+ def teardown
22
+ credential_teardown
23
+
24
+ super
25
+ end
26
+
19
27
  def test_handle_options
20
28
  @cmd.handle_options %w[a --version 1.0 --platform x86-darwin -k KEY --host HOST]
21
29
 
@@ -46,8 +54,8 @@ class TestGemCommandsYankCommand < Gem::TestCase
46
54
  @cmd.execute
47
55
  end
48
56
 
49
- assert_match %r%Yanking gem from http://example%, @ui.output
50
- assert_match %r%Successfully yanked%, @ui.output
57
+ assert_match %r{Yanking gem from http://example}, @ui.output
58
+ assert_match %r{Successfully yanked}, @ui.output
51
59
 
52
60
  platform = Gem.platforms[1]
53
61
  body = @fetcher.last_request.body.split('&').sort
@@ -77,8 +85,8 @@ class TestGemCommandsYankCommand < Gem::TestCase
77
85
 
78
86
  assert_match 'You have enabled multi-factor authentication. Please enter OTP code.', @otp_ui.output
79
87
  assert_match 'Code: ', @otp_ui.output
80
- assert_match %r%Yanking gem from http://example%, @otp_ui.output
81
- assert_match %r%Successfully yanked%, @otp_ui.output
88
+ assert_match %r{Yanking gem from http://example}, @otp_ui.output
89
+ assert_match %r{Successfully yanked}, @otp_ui.output
82
90
  assert_equal '111111', @fetcher.last_request['OTP']
83
91
  end
84
92
 
@@ -132,8 +140,8 @@ class TestGemCommandsYankCommand < Gem::TestCase
132
140
  @cmd.execute
133
141
  end
134
142
 
135
- assert_match %r%Yanking gem from https://other.example%, @ui.output
136
- assert_match %r%Successfully yanked%, @ui.output
143
+ assert_match %r{Yanking gem from https://other.example}, @ui.output
144
+ assert_match %r{Successfully yanked}, @ui.output
137
145
 
138
146
  body = @fetcher.last_request.body.split('&').sort
139
147
  assert_equal %w[gem_name=a version=1.0], body
@@ -7,14 +7,12 @@ class TestGemConfigFile < Gem::TestCase
7
7
  def setup
8
8
  super
9
9
 
10
+ credential_setup
11
+
10
12
  @temp_conf = File.join @tempdir, '.gemrc'
11
13
 
12
14
  @cfg_args = %W[--config-file #{@temp_conf}]
13
15
 
14
- @orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
15
- Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
16
- Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
17
- File.join(@tempdir, 'system-gemrc')
18
16
  Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS.clear
19
17
  Gem::ConfigFile::PLATFORM_DEFAULTS.clear
20
18
 
@@ -27,12 +25,11 @@ class TestGemConfigFile < Gem::TestCase
27
25
  def teardown
28
26
  Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS.clear
29
27
  Gem::ConfigFile::PLATFORM_DEFAULTS.clear
30
- Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
31
- Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
32
- @orig_SYSTEM_WIDE_CONFIG_FILE
33
28
 
34
29
  ENV['GEMRC'] = @env_gemrc
35
30
 
31
+ credential_teardown
32
+
36
33
  super
37
34
  end
38
35
 
@@ -177,7 +174,7 @@ class TestGemConfigFile < Gem::TestCase
177
174
  assert_nil @cfg.instance_variable_get :@api_keys
178
175
 
179
176
  temp_cred = File.join Gem.user_home, '.gem', 'credentials'
180
- FileUtils.mkdir File.dirname(temp_cred)
177
+ FileUtils.mkdir_p File.dirname(temp_cred)
181
178
  File.open temp_cred, 'w', 0600 do |fp|
182
179
  fp.puts ':rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97'
183
180
  end
@@ -303,7 +300,7 @@ if you believe they were disclosed to a third party.
303
300
 
304
301
  def test_load_api_keys
305
302
  temp_cred = File.join Gem.user_home, '.gem', 'credentials'
306
- FileUtils.mkdir File.dirname(temp_cred)
303
+ FileUtils.mkdir_p File.dirname(temp_cred)
307
304
  File.open temp_cred, 'w', 0600 do |fp|
308
305
  fp.puts ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
309
306
  fp.puts ":other: a5fdbb6ba150cbb83aad2bb2fede64c"
@@ -392,7 +389,7 @@ if you believe they were disclosed to a third party.
392
389
  util_config_file
393
390
 
394
391
  # These should not be written out to the config file.
395
- assert_equal false, @cfg.backtrace, 'backtrace'
392
+ assert_equal false, @cfg.backtrace, 'backtrace'
396
393
  assert_equal Gem::ConfigFile::DEFAULT_BULK_THRESHOLD, @cfg.bulk_threshold,
397
394
  'bulk_threshold'
398
395
  assert_equal true, @cfg.update_sources, 'update_sources'
@@ -48,69 +48,6 @@ class TestGemDependencyInstaller < Gem::TestCase
48
48
  util_reset_gems
49
49
  end
50
50
 
51
- def test_available_set_for_name
52
- util_setup_gems
53
- p1a, = util_gem 'a', '10.a'
54
- util_setup_spec_fetcher p1a, @a1, @a1_pre
55
-
56
- inst = Gem::DependencyInstaller.new
57
-
58
- available = Gem::Deprecate.skip_during do
59
- inst.available_set_for 'a', Gem::Requirement.default
60
- end
61
-
62
- assert_equal %w[a-1], available.set.map { |s| s.spec.full_name }
63
- end
64
-
65
- def test_available_set_for_name_prerelease
66
- util_setup_gems
67
- p1a, = util_gem 'a', '10.a'
68
- util_setup_spec_fetcher p1a, @a1, @a1_pre
69
-
70
- inst = Gem::DependencyInstaller.new :prerelease => true
71
-
72
- available = Gem::Deprecate.skip_during do
73
- inst.available_set_for 'a', Gem::Requirement.default
74
- end
75
-
76
- assert_equal %w[a-10.a],
77
- available.sorted.map { |s| s.spec.full_name }
78
- end
79
-
80
- def test_available_set_for_dep
81
- util_setup_gems
82
- p1a, = util_gem 'a', '10.a'
83
- util_setup_spec_fetcher p1a, @a1, @a1_pre
84
-
85
- inst = Gem::DependencyInstaller.new
86
-
87
- dep = Gem::Dependency.new 'a', Gem::Requirement.default
88
-
89
- available = Gem::Deprecate.skip_during do
90
- inst.available_set_for dep, Gem::Requirement.default
91
- end
92
-
93
- assert_equal %w[a-1], available.set.map { |s| s.spec.full_name }
94
- end
95
-
96
- def test_available_set_for_dep_prerelease
97
- util_setup_gems
98
- p1a, = util_gem 'a', '10.a'
99
- util_setup_spec_fetcher p1a, @a1, @a1_pre
100
-
101
- inst = Gem::DependencyInstaller.new :prerelease => true
102
-
103
- dep = Gem::Dependency.new 'a', Gem::Requirement.default
104
- dep.prerelease = true
105
-
106
- available = Gem::Deprecate.skip_during do
107
- inst.available_set_for dep, Gem::Requirement.default
108
- end
109
-
110
- assert_equal %w[a-10.a],
111
- available.sorted.map { |s| s.spec.full_name }
112
- end
113
-
114
51
  def test_install
115
52
  util_setup_gems
116
53
 
@@ -211,7 +148,7 @@ class TestGemDependencyInstaller < Gem::TestCase
211
148
 
212
149
  FileUtils.mv @a1_gem, @tempdir
213
150
  FileUtils.mv @b1_gem, @tempdir
214
- FileUtils.mv e1_gem, @tempdir
151
+ FileUtils.mv e1_gem, @tempdir
215
152
 
216
153
  inst = nil
217
154
 
@@ -220,7 +157,7 @@ class TestGemDependencyInstaller < Gem::TestCase
220
157
  inst.install 'b'
221
158
  end
222
159
 
223
- assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name },
160
+ assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
224
161
  'sanity check'
225
162
 
226
163
  Dir.chdir @tempdir do
@@ -228,7 +165,7 @@ class TestGemDependencyInstaller < Gem::TestCase
228
165
  inst.install 'e'
229
166
  end
230
167
 
231
- assert_equal %w[a-1 e-1], inst.installed_gems.map { |s| s.full_name }
168
+ assert_equal %w[a-1 e-1], inst.installed_gems.map {|s| s.full_name }
232
169
  end
233
170
 
234
171
  def test_install_cache_dir
@@ -245,7 +182,7 @@ class TestGemDependencyInstaller < Gem::TestCase
245
182
  inst.install 'b'
246
183
  end
247
184
 
248
- assert_equal %w[a-1 b-1], inst.installed_gems.map { |s| s.full_name }
185
+ assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
249
186
 
250
187
  assert File.exist? File.join(@gemhome, "cache", @a1.file_name)
251
188
  assert File.exist? File.join(@gemhome, "cache", @b1.file_name)
@@ -270,7 +207,7 @@ class TestGemDependencyInstaller < Gem::TestCase
270
207
  inst.install 'a', req("= 2")
271
208
  end
272
209
 
273
- assert_equal %w[a-2], inst.installed_gems.map { |s| s.full_name },
210
+ assert_equal %w[a-2], inst.installed_gems.map {|s| s.full_name },
274
211
  'sanity check'
275
212
 
276
213
  FileUtils.rm File.join(@tempdir, a2.file_name)
@@ -281,7 +218,7 @@ class TestGemDependencyInstaller < Gem::TestCase
281
218
  end
282
219
 
283
220
  assert_equal %w[a-2 b-1], Gem::Specification.map(&:full_name)
284
- assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
221
+ assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
285
222
  end
286
223
 
287
224
  # This asserts that if a gem's dependency is satisfied by an
@@ -302,7 +239,7 @@ class TestGemDependencyInstaller < Gem::TestCase
302
239
  FileUtils.mv @a1_gem, @tempdir
303
240
  FileUtils.mv a2_gem, @tempdir # not in index
304
241
  FileUtils.mv @b1_gem, @tempdir
305
- FileUtils.mv a3_gem, @tempdir
242
+ FileUtils.mv a3_gem, @tempdir
306
243
 
307
244
  Dir.chdir @tempdir do
308
245
  Gem::DependencyInstaller.new.install 'a', req("= 2")
@@ -318,7 +255,7 @@ class TestGemDependencyInstaller < Gem::TestCase
318
255
  end
319
256
 
320
257
  assert_equal %w[a-2 b-1], Gem::Specification.map(&:full_name)
321
- assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
258
+ assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
322
259
  end
323
260
 
324
261
  def test_install_dependency
@@ -341,7 +278,7 @@ class TestGemDependencyInstaller < Gem::TestCase
341
278
  inst.install 'b'
342
279
  end
343
280
 
344
- assert_equal %w[a-1 b-1], inst.installed_gems.map { |s| s.full_name }
281
+ assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
345
282
 
346
283
  assert done_installing_ran, 'post installs hook was not run'
347
284
  end
@@ -363,7 +300,7 @@ class TestGemDependencyInstaller < Gem::TestCase
363
300
  inst.install 'b'
364
301
  end
365
302
 
366
- assert_equal %w[a-1 aa-1 b-1], inst.installed_gems.map { |s| s.full_name }
303
+ assert_equal %w[a-1 aa-1 b-1], inst.installed_gems.map {|s| s.full_name }
367
304
  end
368
305
 
369
306
  def test_install_dependency_development_deep
@@ -385,7 +322,7 @@ class TestGemDependencyInstaller < Gem::TestCase
385
322
  inst.install 'd'
386
323
  end
387
324
 
388
- assert_equal %w[a-1 aa-1 b-1 c-1 d-1], inst.installed_gems.map { |s| s.full_name }
325
+ assert_equal %w[a-1 aa-1 b-1 c-1 d-1], inst.installed_gems.map {|s| s.full_name }
389
326
  end
390
327
 
391
328
  def test_install_dependency_development_shallow
@@ -407,7 +344,7 @@ class TestGemDependencyInstaller < Gem::TestCase
407
344
  inst.install 'd'
408
345
  end
409
346
 
410
- assert_equal %w[c-1 d-1], inst.installed_gems.map { |s| s.full_name }
347
+ assert_equal %w[c-1 d-1], inst.installed_gems.map {|s| s.full_name }
411
348
  end
412
349
 
413
350
  def test_install_dependency_existing
@@ -423,7 +360,7 @@ class TestGemDependencyInstaller < Gem::TestCase
423
360
  inst.install 'b'
424
361
  end
425
362
 
426
- assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
363
+ assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
427
364
  end
428
365
 
429
366
  def test_install_dependency_existing_extension
@@ -440,7 +377,7 @@ class TestGemDependencyInstaller < Gem::TestCase
440
377
  e1 = util_spec 'e', '1', nil, 'extconf.rb' do |s|
441
378
  s.extensions << 'extconf.rb'
442
379
  end
443
- e1_gem = File.join @tempdir, 'gems', "#{e1.full_name}.gem"
380
+ e1_gem = e1.cache_file
444
381
 
445
382
  _, f1_gem = util_gem 'f', '1', 'e' => nil
446
383
 
@@ -460,7 +397,7 @@ class TestGemDependencyInstaller < Gem::TestCase
460
397
  Dir.chdir pwd
461
398
  end
462
399
 
463
- assert_equal %w[f-1], inst.installed_gems.map { |s| s.full_name }
400
+ assert_equal %w[f-1], inst.installed_gems.map {|s| s.full_name }
464
401
 
465
402
  assert_path_exists e1.extension_dir
466
403
  end
@@ -480,7 +417,7 @@ class TestGemDependencyInstaller < Gem::TestCase
480
417
  inst.install 'f'
481
418
  end
482
419
 
483
- assert_equal %w[f-2], inst.installed_gems.map { |s| s.full_name }
420
+ assert_equal %w[f-2], inst.installed_gems.map {|s| s.full_name }
484
421
  end
485
422
 
486
423
  def test_install_local
@@ -494,7 +431,7 @@ class TestGemDependencyInstaller < Gem::TestCase
494
431
  inst.install 'a-1.gem'
495
432
  end
496
433
 
497
- assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
434
+ assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
498
435
  end
499
436
 
500
437
  def test_install_local_prerelease
@@ -508,7 +445,7 @@ class TestGemDependencyInstaller < Gem::TestCase
508
445
  inst.install 'a-1.a.gem'
509
446
  end
510
447
 
511
- assert_equal %w[a-1.a], inst.installed_gems.map { |s| s.full_name }
448
+ assert_equal %w[a-1.a], inst.installed_gems.map {|s| s.full_name }
512
449
  end
513
450
 
514
451
  def test_install_local_dependency
@@ -524,7 +461,7 @@ class TestGemDependencyInstaller < Gem::TestCase
524
461
  inst.install 'b-1.gem'
525
462
  end
526
463
 
527
- assert_equal %w[a-1 b-1], inst.installed_gems.map { |s| s.full_name }
464
+ assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
528
465
  end
529
466
 
530
467
  def test_install_local_dependency_installed
@@ -542,7 +479,7 @@ class TestGemDependencyInstaller < Gem::TestCase
542
479
  inst.install 'b-1.gem'
543
480
  end
544
481
 
545
- assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
482
+ assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
546
483
  end
547
484
 
548
485
  def test_install_local_subdir
@@ -555,7 +492,7 @@ class TestGemDependencyInstaller < Gem::TestCase
555
492
  inst.install 'gems/a-1.gem'
556
493
  end
557
494
 
558
- assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
495
+ assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
559
496
  end
560
497
 
561
498
  def test_install_minimal_deps
@@ -581,7 +518,7 @@ class TestGemDependencyInstaller < Gem::TestCase
581
518
  inst.install 'b', req('= 1')
582
519
  end
583
520
 
584
- assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name },
521
+ assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
585
522
  'sanity check'
586
523
 
587
524
  Dir.chdir @tempdir do
@@ -589,7 +526,7 @@ class TestGemDependencyInstaller < Gem::TestCase
589
526
  inst.install 'e'
590
527
  end
591
528
 
592
- assert_equal %w[a-1 e-1], inst.installed_gems.map { |s| s.full_name }
529
+ assert_equal %w[a-1 e-1], inst.installed_gems.map {|s| s.full_name }
593
530
  end
594
531
 
595
532
  def test_install_no_document
@@ -622,7 +559,7 @@ class TestGemDependencyInstaller < Gem::TestCase
622
559
 
623
560
  env = "/\\S+/env" unless Gem.win_platform?
624
561
 
625
- assert_match %r|\A#!#{env} #{RbConfig::CONFIG['ruby_install_name']}\n|,
562
+ assert_match %r{\A#!#{env} #{RbConfig::CONFIG['ruby_install_name']}\n},
626
563
  File.read(File.join(@gemhome, 'bin', 'a_bin'))
627
564
  end
628
565
 
@@ -639,7 +576,7 @@ class TestGemDependencyInstaller < Gem::TestCase
639
576
  inst.install 'b'
640
577
  end
641
578
 
642
- assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
579
+ assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
643
580
  end
644
581
 
645
582
  def test_install_build_args
@@ -669,7 +606,7 @@ class TestGemDependencyInstaller < Gem::TestCase
669
606
  inst.install 'b'
670
607
  end
671
608
 
672
- assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
609
+ assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
673
610
  end
674
611
 
675
612
  def test_install_install_dir
@@ -690,7 +627,7 @@ class TestGemDependencyInstaller < Gem::TestCase
690
627
  inst.install 'b'
691
628
  end
692
629
 
693
- assert_equal %w[a-1 b-1], inst.installed_gems.map { |s| s.full_name }
630
+ assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
694
631
 
695
632
  assert File.exist?(File.join(gemhome2, 'specifications', @a1.spec_name))
696
633
  assert File.exist?(File.join(gemhome2, 'cache', @a1.file_name))
@@ -714,7 +651,7 @@ class TestGemDependencyInstaller < Gem::TestCase
714
651
  inst.install 'b'
715
652
  end
716
653
 
717
- assert_equal %w[a-1 b-1], inst.installed_gems.map { |s| s.full_name }
654
+ assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
718
655
  a1, b1 = inst.installed_gems
719
656
 
720
657
  assert_equal a1.spec_file, a1.loaded_from
@@ -738,7 +675,7 @@ class TestGemDependencyInstaller < Gem::TestCase
738
675
  inst.install 'b'
739
676
  end
740
677
 
741
- assert_equal %w[a-1 b-1], inst.installed_gems.map { |s| s.full_name }
678
+ assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
742
679
  end
743
680
 
744
681
  def test_install_domain_local
@@ -757,7 +694,7 @@ class TestGemDependencyInstaller < Gem::TestCase
757
694
  assert_equal expected, e.message
758
695
  end
759
696
 
760
- assert_equal [], inst.installed_gems.map { |s| s.full_name }
697
+ assert_equal [], inst.installed_gems.map {|s| s.full_name }
761
698
  end
762
699
 
763
700
  def test_install_domain_remote
@@ -773,7 +710,7 @@ class TestGemDependencyInstaller < Gem::TestCase
773
710
  inst = Gem::DependencyInstaller.new :domain => :remote
774
711
  inst.install 'a'
775
712
 
776
- assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
713
+ assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
777
714
  end
778
715
 
779
716
  def test_install_dual_repository
@@ -790,7 +727,7 @@ class TestGemDependencyInstaller < Gem::TestCase
790
727
  inst.install 'a'
791
728
  end
792
729
 
793
- assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name },
730
+ assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name },
794
731
  'sanity check'
795
732
 
796
733
  ENV['GEM_HOME'] = @gemhome
@@ -802,7 +739,7 @@ class TestGemDependencyInstaller < Gem::TestCase
802
739
  inst.install 'b'
803
740
  end
804
741
 
805
- assert_equal %w[b-1], inst.installed_gems.map { |s| s.full_name }
742
+ assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
806
743
  end
807
744
 
808
745
  def test_install_reinstall
@@ -837,7 +774,7 @@ class TestGemDependencyInstaller < Gem::TestCase
837
774
  inst.install 'a'
838
775
  end
839
776
 
840
- assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
777
+ assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
841
778
  end
842
779
 
843
780
  def test_install_remote_dep
@@ -857,7 +794,7 @@ class TestGemDependencyInstaller < Gem::TestCase
857
794
  inst.install dep
858
795
  end
859
796
 
860
- assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
797
+ assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
861
798
  end
862
799
 
863
800
  def test_install_remote_platform_newer
@@ -890,7 +827,7 @@ class TestGemDependencyInstaller < Gem::TestCase
890
827
  inst = Gem::DependencyInstaller.new :domain => :remote
891
828
  inst.install 'a'
892
829
 
893
- assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
830
+ assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
894
831
  end
895
832
 
896
833
  def test_install_platform_is_ignored_when_a_file_is_specified
@@ -901,17 +838,17 @@ class TestGemDependencyInstaller < Gem::TestCase
901
838
  inst = Gem::DependencyInstaller.new :domain => :local
902
839
  inst.install a_gem
903
840
 
904
- assert_equal %w[a-1-cpu-other_platform-1], inst.installed_gems.map { |s| s.full_name }
841
+ assert_equal %w[a-1-cpu-other_platform-1], inst.installed_gems.map {|s| s.full_name }
905
842
  end
906
843
 
907
844
  if defined? OpenSSL
908
845
  def test_install_security_policy
909
846
  util_setup_gems
910
847
 
911
- data = File.open(@a1_gem, 'rb') { |f| f.read }
848
+ data = File.open(@a1_gem, 'rb') {|f| f.read }
912
849
  @fetcher.data['http://gems.example.com/gems/a-1.gem'] = data
913
850
 
914
- data = File.open(@b1_gem, 'rb') { |f| f.read }
851
+ data = File.open(@b1_gem, 'rb') {|f| f.read }
915
852
  @fetcher.data['http://gems.example.com/gems/b-1.gem'] = data
916
853
 
917
854
  policy = Gem::Security::HighSecurity
@@ -924,7 +861,7 @@ class TestGemDependencyInstaller < Gem::TestCase
924
861
  assert_equal 'unsigned gems are not allowed by the High Security policy',
925
862
  e.message
926
863
 
927
- assert_equal %w[], inst.installed_gems.map { |s| s.full_name }
864
+ assert_equal %w[], inst.installed_gems.map {|s| s.full_name }
928
865
  end
929
866
  end
930
867
 
@@ -938,7 +875,7 @@ class TestGemDependencyInstaller < Gem::TestCase
938
875
  inst = Gem::DependencyInstaller.new :wrappers => false, :format_executable => false
939
876
  inst.install 'a'
940
877
 
941
- refute_match(%r|This file was generated by RubyGems.|,
878
+ refute_match(%r{This file was generated by RubyGems.},
942
879
  File.read(File.join(@gemhome, 'bin', 'a_bin')))
943
880
  end
944
881
  end
@@ -946,32 +883,32 @@ class TestGemDependencyInstaller < Gem::TestCase
946
883
  def test_install_version
947
884
  util_setup_d
948
885
 
949
- data = File.open(@d2_gem, 'rb') { |f| f.read }
886
+ data = File.open(@d2_gem, 'rb') {|f| f.read }
950
887
  @fetcher.data['http://gems.example.com/gems/d-2.gem'] = data
951
888
 
952
- data = File.open(@d1_gem, 'rb') { |f| f.read }
889
+ data = File.open(@d1_gem, 'rb') {|f| f.read }
953
890
  @fetcher.data['http://gems.example.com/gems/d-1.gem'] = data
954
891
 
955
892
  inst = Gem::DependencyInstaller.new
956
893
 
957
894
  inst.install 'd', '= 1'
958
895
 
959
- assert_equal %w[d-1], inst.installed_gems.map { |s| s.full_name }
896
+ assert_equal %w[d-1], inst.installed_gems.map {|s| s.full_name }
960
897
  end
961
898
 
962
899
  def test_install_version_default
963
900
  util_setup_d
964
901
 
965
- data = File.open(@d2_gem, 'rb') { |f| f.read }
902
+ data = File.open(@d2_gem, 'rb') {|f| f.read }
966
903
  @fetcher.data['http://gems.example.com/gems/d-2.gem'] = data
967
904
 
968
- data = File.open(@d1_gem, 'rb') { |f| f.read }
905
+ data = File.open(@d1_gem, 'rb') {|f| f.read }
969
906
  @fetcher.data['http://gems.example.com/gems/d-1.gem'] = data
970
907
 
971
908
  inst = Gem::DependencyInstaller.new
972
909
  inst.install 'd'
973
910
 
974
- assert_equal %w[d-2], inst.installed_gems.map { |s| s.full_name }
911
+ assert_equal %w[d-2], inst.installed_gems.map {|s| s.full_name }
975
912
  end
976
913
 
977
914
  def test_find_gems_gems_with_sources
@@ -994,80 +931,6 @@ class TestGemDependencyInstaller < Gem::TestCase
994
931
  assert_equal Gem::Source.new(@gem_repo), s.source
995
932
  end
996
933
 
997
- def test_find_spec_by_name_and_version_wildcard
998
- util_gem 'a', 1
999
- FileUtils.mv 'gems/a-1.gem', @tempdir
1000
-
1001
- FileUtils.touch 'rdoc.gem'
1002
-
1003
- inst = Gem::DependencyInstaller.new
1004
-
1005
- available = Gem::Deprecate.skip_during do
1006
- inst.find_spec_by_name_and_version('*.gem')
1007
- end
1008
-
1009
- assert_equal %w[a-1], available.each_spec.map { |spec| spec.full_name }
1010
- end
1011
-
1012
- def test_find_spec_by_name_and_version_wildcard_bad_gem
1013
- FileUtils.touch 'rdoc.gem'
1014
-
1015
- inst = Gem::DependencyInstaller.new
1016
-
1017
- assert_raises Gem::Package::FormatError do
1018
- Gem::Deprecate.skip_during do
1019
- inst.find_spec_by_name_and_version '*.gem'
1020
- end
1021
- end
1022
- end
1023
-
1024
- def test_find_spec_by_name_and_version_bad_gem
1025
- FileUtils.touch 'rdoc.gem'
1026
-
1027
- inst = Gem::DependencyInstaller.new
1028
-
1029
- e = assert_raises Gem::Package::FormatError do
1030
- Gem::Deprecate.skip_during do
1031
- inst.find_spec_by_name_and_version 'rdoc.gem'
1032
- end
1033
- end
1034
-
1035
- full_path = File.join @tempdir, 'rdoc.gem'
1036
- assert_equal "package metadata is missing in #{full_path}", e.message
1037
- end
1038
-
1039
- def test_find_spec_by_name_and_version_directory
1040
- Dir.mkdir 'rdoc'
1041
-
1042
- inst = Gem::DependencyInstaller.new
1043
-
1044
- e = assert_raises Gem::SpecificGemNotFoundException do
1045
- Gem::Deprecate.skip_during do
1046
- inst.find_spec_by_name_and_version 'rdoc'
1047
- end
1048
- end
1049
-
1050
- assert_equal "Could not find a valid gem 'rdoc' (>= 0) " +
1051
- "locally or in a repository",
1052
- e.message
1053
- end
1054
-
1055
- def test_find_spec_by_name_and_version_file
1056
- FileUtils.touch 'rdoc'
1057
-
1058
- inst = Gem::DependencyInstaller.new
1059
-
1060
- e = assert_raises Gem::SpecificGemNotFoundException do
1061
- Gem::Deprecate.skip_during do
1062
- inst.find_spec_by_name_and_version 'rdoc'
1063
- end
1064
- end
1065
-
1066
- assert_equal "Could not find a valid gem 'rdoc' (>= 0) " +
1067
- "locally or in a repository",
1068
- e.message
1069
- end
1070
-
1071
934
  def test_find_gems_with_sources_local
1072
935
  util_setup_gems
1073
936
 
@@ -1109,8 +972,8 @@ class TestGemDependencyInstaller < Gem::TestCase
1109
972
 
1110
973
  releases = set.all_specs
1111
974
 
1112
- assert releases.any? { |s| s.name == 'a' and s.version.to_s == '1' }
1113
- refute releases.any? { |s| s.name == 'a' and s.version.to_s == '1.a' }
975
+ assert releases.any? {|s| s.name == 'a' and s.version.to_s == '1' }
976
+ refute releases.any? {|s| s.name == 'a' and s.version.to_s == '1.a' }
1114
977
 
1115
978
  dependency.prerelease = true
1116
979
 
@@ -1168,7 +1031,7 @@ class TestGemDependencyInstaller < Gem::TestCase
1168
1031
  inst = Gem::DependencyInstaller.new
1169
1032
  request_set = inst.resolve_dependencies 'b', req('>= 0')
1170
1033
 
1171
- requests = request_set.sorted_requests.map { |req| req.full_name }
1034
+ requests = request_set.sorted_requests.map {|req| req.full_name }
1172
1035
 
1173
1036
  assert_equal %w[a-1 b-1], requests
1174
1037
  end
@@ -1182,7 +1045,7 @@ class TestGemDependencyInstaller < Gem::TestCase
1182
1045
  inst = Gem::DependencyInstaller.new :ignore_dependencies => true
1183
1046
  request_set = inst.resolve_dependencies 'b', req('>= 0')
1184
1047
 
1185
- requests = request_set.sorted_requests.map { |req| req.full_name }
1048
+ requests = request_set.sorted_requests.map {|req| req.full_name }
1186
1049
 
1187
1050
  assert request_set.ignore_dependencies
1188
1051
 
@@ -1199,7 +1062,7 @@ class TestGemDependencyInstaller < Gem::TestCase
1199
1062
  inst = Gem::DependencyInstaller.new
1200
1063
  request_set = inst.resolve_dependencies 'a-1.gem', req('>= 0')
1201
1064
 
1202
- requests = request_set.sorted_requests.map { |req| req.full_name }
1065
+ requests = request_set.sorted_requests.map {|req| req.full_name }
1203
1066
 
1204
1067
  assert_equal %w[a-1], requests
1205
1068
  end