rubygems-update 3.3.18 → 3.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +65 -0
  3. data/Manifest.txt +11 -0
  4. data/bin/gem +2 -2
  5. data/bin/update_rubygems +4 -4
  6. data/bundler/CHANGELOG.md +100 -0
  7. data/bundler/UPGRADING.md +11 -4
  8. data/bundler/bundler.gemspec +6 -8
  9. data/bundler/lib/bundler/build_metadata.rb +2 -2
  10. data/bundler/lib/bundler/cli/common.rb +1 -0
  11. data/bundler/lib/bundler/cli/install.rb +5 -2
  12. data/bundler/lib/bundler/cli/outdated.rb +12 -3
  13. data/bundler/lib/bundler/cli/platform.rb +1 -1
  14. data/bundler/lib/bundler/cli.rb +7 -4
  15. data/bundler/lib/bundler/current_ruby.rb +14 -5
  16. data/bundler/lib/bundler/definition.rb +102 -31
  17. data/bundler/lib/bundler/dependency.rb +18 -85
  18. data/bundler/lib/bundler/dsl.rb +2 -2
  19. data/bundler/lib/bundler/endpoint_specification.rb +2 -13
  20. data/bundler/lib/bundler/feature_flag.rb +0 -1
  21. data/bundler/lib/bundler/fetcher.rb +6 -6
  22. data/bundler/lib/bundler/gem_helpers.rb +7 -1
  23. data/bundler/lib/bundler/gem_version_promoter.rb +8 -18
  24. data/bundler/lib/bundler/index.rb +10 -12
  25. data/bundler/lib/bundler/injector.rb +2 -1
  26. data/bundler/lib/bundler/inline.rb +1 -1
  27. data/bundler/lib/bundler/installer/standalone.rb +1 -1
  28. data/bundler/lib/bundler/installer.rb +14 -12
  29. data/bundler/lib/bundler/lazy_specification.rb +30 -23
  30. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  31. data/bundler/lib/bundler/man/bundle-add.1 +6 -2
  32. data/bundler/lib/bundler/man/bundle-add.1.ronn +4 -1
  33. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  34. data/bundler/lib/bundler/man/bundle-cache.1 +7 -1
  35. data/bundler/lib/bundler/man/bundle-cache.1.ronn +7 -0
  36. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-config.1 +25 -6
  39. data/bundler/lib/bundler/man/bundle-config.1.ronn +16 -6
  40. data/bundler/lib/bundler/man/bundle-console.1 +53 -0
  41. data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
  42. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  43. data/bundler/lib/bundler/man/bundle-exec.1 +2 -2
  44. data/bundler/lib/bundler/man/bundle-exec.1.ronn +1 -1
  45. data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
  46. data/bundler/lib/bundler/man/bundle-help.1 +13 -0
  47. data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
  48. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  49. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  50. data/bundler/lib/bundler/man/bundle-inject.1 +5 -2
  51. data/bundler/lib/bundler/man/bundle-inject.1.ronn +3 -1
  52. data/bundler/lib/bundler/man/bundle-install.1 +5 -1
  53. data/bundler/lib/bundler/man/bundle-install.1.ronn +6 -0
  54. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  55. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  56. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  57. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  58. data/bundler/lib/bundler/man/bundle-platform.1 +16 -6
  59. data/bundler/lib/bundler/man/bundle-platform.1.ronn +14 -7
  60. data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
  61. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  62. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  63. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  64. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  65. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  66. data/bundler/lib/bundler/man/bundle-version.1 +35 -0
  67. data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
  68. data/bundler/lib/bundler/man/bundle-viz.1 +4 -1
  69. data/bundler/lib/bundler/man/bundle-viz.1.ronn +2 -0
  70. data/bundler/lib/bundler/man/bundle.1 +15 -10
  71. data/bundler/lib/bundler/man/bundle.1.ronn +12 -7
  72. data/bundler/lib/bundler/man/gemfile.5 +23 -47
  73. data/bundler/lib/bundler/man/gemfile.5.ronn +32 -43
  74. data/bundler/lib/bundler/man/index.txt +4 -0
  75. data/bundler/lib/bundler/match_metadata.rb +13 -0
  76. data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
  77. data/bundler/lib/bundler/plugin.rb +2 -0
  78. data/bundler/lib/bundler/remote_specification.rb +6 -11
  79. data/bundler/lib/bundler/resolver/base.rb +50 -0
  80. data/bundler/lib/bundler/resolver/spec_group.rb +11 -8
  81. data/bundler/lib/bundler/resolver.rb +95 -90
  82. data/bundler/lib/bundler/ruby_dsl.rb +1 -1
  83. data/bundler/lib/bundler/ruby_version.rb +5 -5
  84. data/bundler/lib/bundler/rubygems_ext.rb +52 -1
  85. data/bundler/lib/bundler/rubygems_gem_installer.rb +19 -12
  86. data/bundler/lib/bundler/settings.rb +1 -1
  87. data/bundler/lib/bundler/source/metadata.rb +1 -1
  88. data/bundler/lib/bundler/source_list.rb +4 -0
  89. data/bundler/lib/bundler/spec_set.rb +48 -33
  90. data/bundler/lib/bundler/version.rb +1 -1
  91. data/bundler/lib/bundler.rb +3 -3
  92. data/lib/rubygems/available_set.rb +3 -3
  93. data/lib/rubygems/basic_specification.rb +4 -4
  94. data/lib/rubygems/command.rb +25 -25
  95. data/lib/rubygems/command_manager.rb +9 -9
  96. data/lib/rubygems/commands/build_command.rb +8 -8
  97. data/lib/rubygems/commands/cert_command.rb +33 -33
  98. data/lib/rubygems/commands/check_command.rb +20 -20
  99. data/lib/rubygems/commands/cleanup_command.rb +17 -17
  100. data/lib/rubygems/commands/contents_command.rb +13 -13
  101. data/lib/rubygems/commands/dependency_command.rb +16 -16
  102. data/lib/rubygems/commands/environment_command.rb +5 -5
  103. data/lib/rubygems/commands/fetch_command.rb +8 -8
  104. data/lib/rubygems/commands/generate_index_command.rb +17 -17
  105. data/lib/rubygems/commands/help_command.rb +3 -3
  106. data/lib/rubygems/commands/info_command.rb +3 -3
  107. data/lib/rubygems/commands/install_command.rb +20 -20
  108. data/lib/rubygems/commands/list_command.rb +3 -3
  109. data/lib/rubygems/commands/lock_command.rb +4 -4
  110. data/lib/rubygems/commands/mirror_command.rb +3 -3
  111. data/lib/rubygems/commands/open_command.rb +9 -9
  112. data/lib/rubygems/commands/outdated_command.rb +5 -5
  113. data/lib/rubygems/commands/owner_command.rb +11 -11
  114. data/lib/rubygems/commands/pristine_command.rb +36 -36
  115. data/lib/rubygems/commands/push_command.rb +8 -8
  116. data/lib/rubygems/commands/query_command.rb +8 -8
  117. data/lib/rubygems/commands/rdoc_command.rb +17 -17
  118. data/lib/rubygems/commands/search_command.rb +3 -3
  119. data/lib/rubygems/commands/server_command.rb +3 -3
  120. data/lib/rubygems/commands/setup_command.rb +96 -106
  121. data/lib/rubygems/commands/signin_command.rb +9 -9
  122. data/lib/rubygems/commands/signout_command.rb +7 -7
  123. data/lib/rubygems/commands/sources_command.rb +21 -21
  124. data/lib/rubygems/commands/specification_command.rb +13 -13
  125. data/lib/rubygems/commands/stale_command.rb +2 -2
  126. data/lib/rubygems/commands/uninstall_command.rb +40 -40
  127. data/lib/rubygems/commands/unpack_command.rb +12 -12
  128. data/lib/rubygems/commands/update_command.rb +40 -56
  129. data/lib/rubygems/commands/which_command.rb +7 -7
  130. data/lib/rubygems/commands/yank_command.rb +11 -11
  131. data/lib/rubygems/config_file.rb +21 -21
  132. data/lib/rubygems/core_ext/kernel_gem.rb +1 -1
  133. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  134. data/lib/rubygems/core_ext/kernel_warn.rb +1 -1
  135. data/lib/rubygems/core_ext/tcpsocket_init.rb +1 -1
  136. data/lib/rubygems/defaults.rb +16 -16
  137. data/lib/rubygems/dependency.rb +9 -9
  138. data/lib/rubygems/dependency_installer.rb +13 -13
  139. data/lib/rubygems/dependency_list.rb +6 -6
  140. data/lib/rubygems/doctor.rb +18 -18
  141. data/lib/rubygems/errors.rb +2 -2
  142. data/lib/rubygems/exceptions.rb +5 -5
  143. data/lib/rubygems/ext/build_error.rb +1 -1
  144. data/lib/rubygems/ext/builder.rb +16 -16
  145. data/lib/rubygems/ext/cargo_builder.rb +7 -7
  146. data/lib/rubygems/ext/cmake_builder.rb +2 -2
  147. data/lib/rubygems/ext/configure_builder.rb +1 -1
  148. data/lib/rubygems/ext/ext_conf_builder.rb +8 -8
  149. data/lib/rubygems/ext/rake_builder.rb +3 -3
  150. data/lib/rubygems/ext.rb +7 -7
  151. data/lib/rubygems/gem_runner.rb +5 -5
  152. data/lib/rubygems/gemcutter_utilities.rb +31 -28
  153. data/lib/rubygems/indexer.rb +27 -27
  154. data/lib/rubygems/install_default_message.rb +2 -2
  155. data/lib/rubygems/install_message.rb +2 -2
  156. data/lib/rubygems/install_update_options.rb +55 -55
  157. data/lib/rubygems/installer.rb +32 -40
  158. data/lib/rubygems/installer_uninstaller_utils.rb +2 -2
  159. data/lib/rubygems/local_remote_options.rb +18 -20
  160. data/lib/rubygems/mock_gem_ui.rb +2 -2
  161. data/lib/rubygems/name_tuple.rb +4 -4
  162. data/lib/rubygems/optparse.rb +1 -1
  163. data/lib/rubygems/package/file_source.rb +2 -2
  164. data/lib/rubygems/package/old.rb +8 -8
  165. data/lib/rubygems/package/tar_header.rb +50 -50
  166. data/lib/rubygems/package/tar_reader/entry.rb +2 -2
  167. data/lib/rubygems/package/tar_reader.rb +1 -1
  168. data/lib/rubygems/package/tar_writer.rb +7 -7
  169. data/lib/rubygems/package.rb +54 -43
  170. data/lib/rubygems/package_task.rb +4 -4
  171. data/lib/rubygems/platform.rb +66 -55
  172. data/lib/rubygems/psych_tree.rb +1 -1
  173. data/lib/rubygems/query_utils.rb +35 -35
  174. data/lib/rubygems/rdoc.rb +2 -2
  175. data/lib/rubygems/remote_fetcher.rb +22 -22
  176. data/lib/rubygems/request/connection_pools.rb +4 -4
  177. data/lib/rubygems/request/http_pool.rb +1 -1
  178. data/lib/rubygems/request.rb +22 -22
  179. data/lib/rubygems/request_set/gem_dependency_api.rb +18 -18
  180. data/lib/rubygems/request_set/lockfile/parser.rb +26 -26
  181. data/lib/rubygems/request_set/lockfile/tokenizer.rb +4 -4
  182. data/lib/rubygems/request_set/lockfile.rb +5 -5
  183. data/lib/rubygems/request_set.rb +17 -17
  184. data/lib/rubygems/requirement.rb +6 -6
  185. data/lib/rubygems/resolver/activation_request.rb +3 -3
  186. data/lib/rubygems/resolver/api_set.rb +4 -4
  187. data/lib/rubygems/resolver/api_specification.rb +6 -6
  188. data/lib/rubygems/resolver/best_set.rb +5 -5
  189. data/lib/rubygems/resolver/conflict.rb +10 -10
  190. data/lib/rubygems/resolver/dependency_request.rb +2 -2
  191. data/lib/rubygems/resolver/git_set.rb +2 -2
  192. data/lib/rubygems/resolver/git_specification.rb +6 -6
  193. data/lib/rubygems/resolver/index_set.rb +3 -3
  194. data/lib/rubygems/resolver/index_specification.rb +6 -5
  195. data/lib/rubygems/resolver/installed_specification.rb +4 -4
  196. data/lib/rubygems/resolver/installer_set.rb +11 -16
  197. data/lib/rubygems/resolver/local_specification.rb +2 -2
  198. data/lib/rubygems/resolver/lock_set.rb +4 -4
  199. data/lib/rubygems/resolver/lock_specification.rb +4 -4
  200. data/lib/rubygems/resolver/molinillo.rb +1 -1
  201. data/lib/rubygems/resolver/specification.rb +1 -1
  202. data/lib/rubygems/resolver/vendor_set.rb +1 -1
  203. data/lib/rubygems/resolver/vendor_specification.rb +3 -3
  204. data/lib/rubygems/resolver.rb +39 -39
  205. data/lib/rubygems/s3_uri_signer.rb +6 -6
  206. data/lib/rubygems/safe_yaml.rb +2 -2
  207. data/lib/rubygems/security/policies.rb +11 -11
  208. data/lib/rubygems/security/policy.rb +18 -18
  209. data/lib/rubygems/security/signer.rb +5 -5
  210. data/lib/rubygems/security/trust_dir.rb +3 -3
  211. data/lib/rubygems/security.rb +28 -28
  212. data/lib/rubygems/security_option.rb +5 -5
  213. data/lib/rubygems/source/git.rb +21 -21
  214. data/lib/rubygems/source/installed.rb +1 -1
  215. data/lib/rubygems/source/local.rb +2 -2
  216. data/lib/rubygems/source/specific_file.rb +1 -1
  217. data/lib/rubygems/source.rb +16 -16
  218. data/lib/rubygems/spec_fetcher.rb +9 -9
  219. data/lib/rubygems/specification.rb +63 -62
  220. data/lib/rubygems/specification_policy.rb +15 -15
  221. data/lib/rubygems/stub_specification.rb +5 -5
  222. data/lib/rubygems/tsort.rb +1 -1
  223. data/lib/rubygems/uninstaller.rb +18 -18
  224. data/lib/rubygems/uri.rb +4 -4
  225. data/lib/rubygems/uri_formatter.rb +1 -1
  226. data/lib/rubygems/user_interaction.rb +33 -19
  227. data/lib/rubygems/util/licenses.rb +3 -3
  228. data/lib/rubygems/util.rb +10 -10
  229. data/lib/rubygems/validator.rb +5 -5
  230. data/lib/rubygems/version.rb +15 -9
  231. data/lib/rubygems/version_option.rb +3 -3
  232. data/lib/rubygems.rb +62 -61
  233. data/rubygems-update.gemspec +2 -2
  234. data/setup.rb +9 -9
  235. data/test/rubygems/helper.rb +132 -134
  236. data/test/rubygems/installer_test_case.rb +13 -13
  237. data/test/rubygems/package/tar_test_case.rb +2 -2
  238. data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
  239. data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
  240. data/test/rubygems/rubygems_plugin.rb +2 -2
  241. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +4 -4
  242. data/test/rubygems/test_bundled_ca.rb +10 -10
  243. data/test/rubygems/test_config.rb +3 -3
  244. data/test/rubygems/test_deprecate.rb +3 -3
  245. data/test/rubygems/test_exit.rb +2 -2
  246. data/test/rubygems/test_gem.rb +342 -342
  247. data/test/rubygems/test_gem_available_set.rb +21 -21
  248. data/test/rubygems/test_gem_bundler_version_finder.rb +1 -1
  249. data/test/rubygems/test_gem_command.rb +44 -44
  250. data/test/rubygems/test_gem_command_manager.rb +29 -29
  251. data/test/rubygems/test_gem_commands_build_command.rb +63 -63
  252. data/test/rubygems/test_gem_commands_cert_command.rb +97 -99
  253. data/test/rubygems/test_gem_commands_check_command.rb +4 -4
  254. data/test/rubygems/test_gem_commands_cleanup_command.rb +40 -40
  255. data/test/rubygems/test_gem_commands_contents_command.rb +27 -27
  256. data/test/rubygems/test_gem_commands_dependency_command.rb +36 -36
  257. data/test/rubygems/test_gem_commands_environment_command.rb +16 -16
  258. data/test/rubygems/test_gem_commands_fetch_command.rb +37 -37
  259. data/test/rubygems/test_gem_commands_generate_index_command.rb +7 -7
  260. data/test/rubygems/test_gem_commands_help_command.rb +13 -13
  261. data/test/rubygems/test_gem_commands_info_command.rb +28 -2
  262. data/test/rubygems/test_gem_commands_install_command.rb +131 -131
  263. data/test/rubygems/test_gem_commands_list_command.rb +4 -4
  264. data/test/rubygems/test_gem_commands_lock_command.rb +10 -10
  265. data/test/rubygems/test_gem_commands_mirror.rb +2 -2
  266. data/test/rubygems/test_gem_commands_open_command.rb +4 -4
  267. data/test/rubygems/test_gem_commands_outdated_command.rb +9 -9
  268. data/test/rubygems/test_gem_commands_owner_command.rb +41 -41
  269. data/test/rubygems/test_gem_commands_pristine_command.rb +92 -92
  270. data/test/rubygems/test_gem_commands_push_command.rb +54 -54
  271. data/test/rubygems/test_gem_commands_query_command.rb +73 -73
  272. data/test/rubygems/test_gem_commands_search_command.rb +2 -2
  273. data/test/rubygems/test_gem_commands_server_command.rb +2 -2
  274. data/test/rubygems/test_gem_commands_setup_command.rb +119 -85
  275. data/test/rubygems/test_gem_commands_signin_command.rb +45 -31
  276. data/test/rubygems/test_gem_commands_signout_command.rb +3 -3
  277. data/test/rubygems/test_gem_commands_sources_command.rb +28 -29
  278. data/test/rubygems/test_gem_commands_specification_command.rb +32 -32
  279. data/test/rubygems/test_gem_commands_stale_command.rb +4 -4
  280. data/test/rubygems/test_gem_commands_uninstall_command.rb +75 -75
  281. data/test/rubygems/test_gem_commands_unpack_command.rb +31 -31
  282. data/test/rubygems/test_gem_commands_update_command.rb +89 -89
  283. data/test/rubygems/test_gem_commands_which_command.rb +6 -6
  284. data/test/rubygems/test_gem_commands_yank_command.rb +40 -40
  285. data/test/rubygems/test_gem_config_file.rb +93 -81
  286. data/test/rubygems/test_gem_dependency.rb +73 -73
  287. data/test/rubygems/test_gem_dependency_installer.rb +165 -165
  288. data/test/rubygems/test_gem_dependency_list.rb +47 -47
  289. data/test/rubygems/test_gem_dependency_resolution_error.rb +4 -4
  290. data/test/rubygems/test_gem_doctor.rb +26 -26
  291. data/test/rubygems/test_gem_ext_builder.rb +59 -59
  292. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +6 -6
  293. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
  294. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +8 -8
  295. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +1 -1
  296. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +6 -6
  297. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
  298. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +8 -8
  299. data/test/rubygems/test_gem_ext_cargo_builder.rb +26 -26
  300. data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +3 -3
  301. data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +23 -23
  302. data/test/rubygems/test_gem_ext_cmake_builder.rb +15 -15
  303. data/test/rubygems/test_gem_ext_configure_builder.rb +13 -13
  304. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +51 -52
  305. data/test/rubygems/test_gem_ext_rake_builder.rb +15 -15
  306. data/test/rubygems/test_gem_gem_runner.rb +7 -7
  307. data/test/rubygems/test_gem_gemcutter_utilities.rb +66 -66
  308. data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -4
  309. data/test/rubygems/test_gem_indexer.rb +48 -48
  310. data/test/rubygems/test_gem_install_update_options.rb +16 -16
  311. data/test/rubygems/test_gem_installer.rb +303 -300
  312. data/test/rubygems/test_gem_local_remote_options.rb +10 -10
  313. data/test/rubygems/test_gem_name_tuple.rb +4 -4
  314. data/test/rubygems/test_gem_package.rb +228 -206
  315. data/test/rubygems/test_gem_package_old.rb +13 -13
  316. data/test/rubygems/test_gem_package_tar_header.rb +42 -42
  317. data/test/rubygems/test_gem_package_tar_reader.rb +8 -8
  318. data/test/rubygems/test_gem_package_tar_reader_entry.rb +10 -10
  319. data/test/rubygems/test_gem_package_tar_writer.rb +76 -76
  320. data/test/rubygems/test_gem_package_task.rb +18 -18
  321. data/test/rubygems/test_gem_path_support.rb +14 -14
  322. data/test/rubygems/test_gem_platform.rb +298 -227
  323. data/test/rubygems/test_gem_rdoc.rb +14 -14
  324. data/test/rubygems/test_gem_remote_fetcher.rb +149 -149
  325. data/test/rubygems/test_gem_request.rb +55 -55
  326. data/test/rubygems/test_gem_request_connection_pools.rb +29 -29
  327. data/test/rubygems/test_gem_request_set.rb +99 -99
  328. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +204 -206
  329. data/test/rubygems/test_gem_request_set_lockfile.rb +86 -86
  330. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +56 -56
  331. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +62 -62
  332. data/test/rubygems/test_gem_requirement.rb +47 -41
  333. data/test/rubygems/test_gem_resolver.rb +133 -99
  334. data/test/rubygems/test_gem_resolver_activation_request.rb +6 -6
  335. data/test/rubygems/test_gem_resolver_api_set.rb +33 -33
  336. data/test/rubygems/test_gem_resolver_api_specification.rb +47 -47
  337. data/test/rubygems/test_gem_resolver_best_set.rb +22 -22
  338. data/test/rubygems/test_gem_resolver_composed_set.rb +1 -1
  339. data/test/rubygems/test_gem_resolver_conflict.rb +12 -12
  340. data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -15
  341. data/test/rubygems/test_gem_resolver_git_set.rb +21 -21
  342. data/test/rubygems/test_gem_resolver_git_specification.rb +21 -21
  343. data/test/rubygems/test_gem_resolver_index_set.rb +12 -12
  344. data/test/rubygems/test_gem_resolver_index_specification.rb +16 -16
  345. data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -5
  346. data/test/rubygems/test_gem_resolver_installer_set.rb +78 -34
  347. data/test/rubygems/test_gem_resolver_local_specification.rb +7 -7
  348. data/test/rubygems/test_gem_resolver_lock_set.rb +12 -12
  349. data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -17
  350. data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -1
  351. data/test/rubygems/test_gem_resolver_specification.rb +8 -8
  352. data/test/rubygems/test_gem_resolver_vendor_set.rb +6 -6
  353. data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -10
  354. data/test/rubygems/test_gem_security.rb +67 -67
  355. data/test/rubygems/test_gem_security_policy.rb +62 -62
  356. data/test/rubygems/test_gem_security_signer.rb +28 -28
  357. data/test/rubygems/test_gem_security_trust_dir.rb +4 -4
  358. data/test/rubygems/test_gem_silent_ui.rb +38 -32
  359. data/test/rubygems/test_gem_source.rb +44 -44
  360. data/test/rubygems/test_gem_source_fetch_problem.rb +9 -9
  361. data/test/rubygems/test_gem_source_git.rb +59 -59
  362. data/test/rubygems/test_gem_source_installed.rb +16 -16
  363. data/test/rubygems/test_gem_source_list.rb +5 -5
  364. data/test/rubygems/test_gem_source_local.rb +14 -14
  365. data/test/rubygems/test_gem_source_lock.rb +31 -31
  366. data/test/rubygems/test_gem_source_specific_file.rb +17 -17
  367. data/test/rubygems/test_gem_source_subpath_problem.rb +7 -7
  368. data/test/rubygems/test_gem_source_vendor.rb +13 -13
  369. data/test/rubygems/test_gem_spec_fetcher.rb +72 -72
  370. data/test/rubygems/test_gem_specification.rb +444 -436
  371. data/test/rubygems/test_gem_stream_ui.rb +19 -19
  372. data/test/rubygems/test_gem_stub_specification.rb +32 -32
  373. data/test/rubygems/test_gem_text.rb +1 -1
  374. data/test/rubygems/test_gem_uninstaller.rb +112 -112
  375. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -3
  376. data/test/rubygems/test_gem_uri.rb +4 -4
  377. data/test/rubygems/test_gem_uri_formatter.rb +14 -14
  378. data/test/rubygems/test_gem_util.rb +23 -23
  379. data/test/rubygems/test_gem_validator.rb +8 -8
  380. data/test/rubygems/test_gem_version.rb +22 -15
  381. data/test/rubygems/test_gem_version_option.rb +15 -15
  382. data/test/rubygems/test_kernel.rb +31 -31
  383. data/test/rubygems/test_project_sanity.rb +1 -1
  384. data/test/rubygems/test_remote_fetch_error.rb +6 -6
  385. data/test/rubygems/test_require.rb +43 -43
  386. data/test/rubygems/test_rubygems.rb +8 -8
  387. data/test/rubygems/utilities.rb +19 -19
  388. metadata +14 -3
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'helper'
4
- require 'rubygems/commands/setup_command'
3
+ require_relative "helper"
4
+ require "rubygems/commands/setup_command"
5
5
 
6
6
  class TestGemCommandsSetupCommand < Gem::TestCase
7
- bundler_gemspec = File.expand_path('../../bundler/lib/bundler/version.rb', __dir__)
7
+ bundler_gemspec = File.expand_path("../../bundler/lib/bundler/version.rb", __dir__)
8
8
  if File.exist?(bundler_gemspec)
9
9
  BUNDLER_VERS = File.read(bundler_gemspec).match(/VERSION = "(#{Gem::Version::VERSION_PATTERN})"/)[1]
10
10
  else
@@ -42,11 +42,11 @@ class TestGemCommandsSetupCommand < Gem::TestCase
42
42
  gemspec.bindir = "exe"
43
43
  gemspec.executables = ["bundle", "bundler"]
44
44
 
45
- File.open 'bundler/bundler.gemspec', 'w' do |io|
45
+ File.open "bundler/bundler.gemspec", "w" do |io|
46
46
  io.puts gemspec.to_ruby
47
47
  end
48
48
 
49
- File.open(File.join(Gem.default_specifications_dir, "bundler-1.15.4.gemspec"), 'w') do |io|
49
+ File.open(File.join(Gem.default_specifications_dir, "bundler-1.15.4.gemspec"), "w") do |io|
50
50
  gemspec.version = "1.15.4"
51
51
  io.puts gemspec.to_ruby
52
52
  end
@@ -54,16 +54,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase
54
54
  spec_fetcher do |fetcher|
55
55
  fetcher.download "bundler", "1.15.4"
56
56
 
57
- fetcher.gem "bundler", BUNDLER_VERS
57
+ fetcher.gem "bundler", bundler_version
58
58
 
59
59
  fetcher.gem "bundler-audit", "1.0.0"
60
60
  end
61
61
  end
62
62
 
63
63
  def test_execute_regenerate_binstubs
64
- gem_bin_path = gem_install 'a'
64
+ gem_bin_path = gem_install "a"
65
65
  write_file gem_bin_path do |io|
66
- io.puts 'I changed it!'
66
+ io.puts "I changed it!"
67
67
  end
68
68
 
69
69
  @cmd.options[:document] = []
@@ -73,9 +73,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
73
73
  end
74
74
 
75
75
  def test_execute_no_regenerate_binstubs
76
- gem_bin_path = gem_install 'a'
76
+ gem_bin_path = gem_install "a"
77
77
  write_file gem_bin_path do |io|
78
- io.puts 'I changed it!'
78
+ io.puts "I changed it!"
79
79
  end
80
80
 
81
81
  @cmd.options[:document] = []
@@ -86,9 +86,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
86
86
  end
87
87
 
88
88
  def test_execute_regenerate_plugins
89
- gem_plugin_path = gem_install_with_plugin 'a'
89
+ gem_plugin_path = gem_install_with_plugin "a"
90
90
  write_file gem_plugin_path do |io|
91
- io.puts 'I changed it!'
91
+ io.puts "I changed it!"
92
92
  end
93
93
 
94
94
  @cmd.options[:document] = []
@@ -98,9 +98,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
98
98
  end
99
99
 
100
100
  def test_execute_no_regenerate_plugins
101
- gem_plugin_path = gem_install_with_plugin 'a'
101
+ gem_plugin_path = gem_install_with_plugin "a"
102
102
  write_file gem_plugin_path do |io|
103
- io.puts 'I changed it!'
103
+ io.puts "I changed it!"
104
104
  end
105
105
 
106
106
  @cmd.options[:document] = []
@@ -111,7 +111,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
111
111
  end
112
112
 
113
113
  def test_execute_regenerate_plugins_creates_plugins_dir_if_not_there
114
- gem_plugin_path = gem_install_with_plugin 'a'
114
+ gem_plugin_path = gem_install_with_plugin "a"
115
115
 
116
116
  # Simulate gem installed with an older rubygems without a plugins layout
117
117
  FileUtils.rm_rf Gem.plugindir
@@ -138,16 +138,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase
138
138
  end
139
139
 
140
140
  def test_env_shebang_flag
141
- gem_bin_path = gem_install 'a'
141
+ gem_bin_path = gem_install "a"
142
142
  write_file gem_bin_path do |io|
143
- io.puts 'I changed it!'
143
+ io.puts "I changed it!"
144
144
  end
145
145
 
146
146
  @cmd.options[:document] = []
147
147
  @cmd.options[:env_shebang] = true
148
148
  @cmd.execute
149
149
 
150
- ruby_exec = sprintf Gem.default_exec_format, 'ruby'
150
+ ruby_exec = sprintf Gem.default_exec_format, "ruby"
151
151
 
152
152
  bin_env = win_platform? ? "" : %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } + " "
153
153
  assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_gem_bin_path)
@@ -159,47 +159,44 @@ class TestGemCommandsSetupCommand < Gem::TestCase
159
159
  def test_destdir_flag_does_not_try_to_write_to_the_default_gem_home
160
160
  FileUtils.chmod "-w", File.join(@gemhome, "plugins")
161
161
 
162
- destdir = File.join(@tempdir, 'foo')
162
+ destdir = File.join(@tempdir, "foo")
163
163
 
164
164
  @cmd.options[:destdir] = destdir
165
165
  @cmd.execute
166
166
 
167
- spec = Gem::Specification.load("bundler/bundler.gemspec")
168
-
169
- spec.executables.each do |e|
170
- assert_path_exist File.join destdir, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'gems', spec.full_name, spec.bindir, e
167
+ bundler_spec.executables.each do |e|
168
+ assert_path_exist prepend_destdir(destdir, File.join(@gemhome, "gems", bundler_spec.full_name, bundler_spec.bindir, e))
171
169
  end
172
170
  end
173
171
 
174
172
  def test_files_in
175
173
  assert_equal %w[rubygems.rb rubygems/requirement.rb rubygems/ssl_certs/rubygems.org/foo.pem],
176
- @cmd.files_in('lib').sort
174
+ @cmd.files_in("lib").sort
177
175
  end
178
176
 
179
177
  def test_install_lib
180
178
  @cmd.extend FileUtils
181
179
 
182
- Dir.mktmpdir 'lib' do |dir|
180
+ Dir.mktmpdir "lib" do |dir|
183
181
  @cmd.install_lib dir
184
182
 
185
- assert_path_exist File.join(dir, 'rubygems.rb')
186
- assert_path_exist File.join(dir, 'rubygems/ssl_certs/rubygems.org/foo.pem')
183
+ assert_path_exist File.join(dir, "rubygems.rb")
184
+ assert_path_exist File.join(dir, "rubygems/ssl_certs/rubygems.org/foo.pem")
187
185
 
188
- assert_path_exist File.join(dir, 'bundler.rb')
189
- assert_path_exist File.join(dir, 'bundler/b.rb')
186
+ assert_path_exist File.join(dir, "bundler.rb")
187
+ assert_path_exist File.join(dir, "bundler/b.rb")
190
188
 
191
- assert_path_exist File.join(dir, 'bundler/templates/.circleci/config.yml')
192
- assert_path_exist File.join(dir, 'bundler/templates/.travis.yml')
189
+ assert_path_exist File.join(dir, "bundler/templates/.circleci/config.yml")
190
+ assert_path_exist File.join(dir, "bundler/templates/.travis.yml")
193
191
  end
194
192
  end
195
193
 
196
194
  def test_install_default_bundler_gem
197
195
  @cmd.extend FileUtils
198
196
 
199
- bin_dir = File.join(@gemhome, 'bin')
197
+ bin_dir = File.join(@gemhome, "bin")
200
198
  @cmd.install_default_bundler_gem bin_dir
201
199
 
202
- bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
203
200
  default_spec_path = File.join(Gem.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
204
201
  spec = Gem::Specification.load(default_spec_path)
205
202
 
@@ -211,32 +208,46 @@ class TestGemCommandsSetupCommand < Gem::TestCase
211
208
  assert_path_exist File.join bin_dir, e
212
209
  end
213
210
 
214
- default_dir = Gem.default_specifications_dir
215
-
216
211
  # expect to remove other versions of bundler gemspecs on default specification directory.
217
- assert_path_not_exist File.join(default_dir, "bundler-1.15.4.gemspec")
218
- assert_path_exist File.join(default_dir, "bundler-#{BUNDLER_VERS}.gemspec")
212
+ assert_path_not_exist previous_bundler_specification_path
213
+ assert_path_exist new_bundler_specification_path
219
214
 
220
215
  # expect to not remove bundler-* gemspecs.
221
216
  assert_path_exist File.join(Gem.dir, "specifications", "bundler-audit-1.0.0.gemspec")
222
217
 
223
218
  # expect to remove normal gem that was same version. because it's promoted default gems.
224
- assert_path_not_exist File.join(Gem.dir, "specifications", "bundler-#{BUNDLER_VERS}.gemspec")
219
+ assert_path_not_exist File.join(Gem.dir, "specifications", "bundler-#{bundler_version}.gemspec")
225
220
 
226
- assert_path_exist "#{Gem.dir}/gems/bundler-#{BUNDLER_VERS}"
221
+ assert_path_exist "#{Gem.dir}/gems/bundler-#{bundler_version}"
227
222
  assert_path_exist "#{Gem.dir}/gems/bundler-1.15.4"
228
223
  assert_path_exist "#{Gem.dir}/gems/bundler-audit-1.0.0"
229
224
  end
230
225
 
226
+ def test_install_default_bundler_gem_with_default_gems_not_installed_at_default_dir
227
+ @cmd.extend FileUtils
228
+
229
+ gemhome2 = File.join(@tempdir, "gemhome2")
230
+ Gem.instance_variable_set(:@default_dir, gemhome2)
231
+
232
+ FileUtils.mkdir_p gemhome2
233
+ bin_dir = File.join(gemhome2, "bin")
234
+
235
+ @cmd.install_default_bundler_gem bin_dir
236
+
237
+ # expect to remove other versions of bundler gemspecs on default specification directory.
238
+ assert_path_not_exist previous_bundler_specification_path
239
+ assert_path_exist new_bundler_specification_path
240
+ end
241
+
231
242
  def test_install_default_bundler_gem_with_force_flag
232
243
  @cmd.extend FileUtils
233
244
 
234
- bin_dir = File.join(@gemhome, 'bin')
235
- bundle_bin = File.join(bin_dir, 'bundle')
245
+ bin_dir = File.join(@gemhome, "bin")
246
+ bundle_bin = File.join(bin_dir, "bundle")
236
247
 
237
248
  write_file bundle_bin do |f|
238
- f.puts '#!/usr/bin/ruby'
239
- f.puts ''
249
+ f.puts "#!/usr/bin/ruby"
250
+ f.puts ""
240
251
  f.puts 'echo "hello"'
241
252
  end
242
253
 
@@ -244,7 +255,6 @@ class TestGemCommandsSetupCommand < Gem::TestCase
244
255
 
245
256
  @cmd.install_default_bundler_gem bin_dir
246
257
 
247
- bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
248
258
  default_spec_path = File.join(Gem.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
249
259
  spec = Gem::Specification.load(default_spec_path)
250
260
 
@@ -262,17 +272,23 @@ class TestGemCommandsSetupCommand < Gem::TestCase
262
272
 
263
273
  FileUtils.chmod "-w", @gemhome
264
274
 
265
- destdir = File.join(@tempdir, 'foo')
266
- bin_dir = File.join(destdir, 'bin')
275
+ destdir = File.join(@tempdir, "foo")
276
+ bin_dir = File.join(destdir, "bin")
267
277
 
268
278
  @cmd.options[:destdir] = destdir
269
279
 
270
280
  @cmd.install_default_bundler_gem bin_dir
271
281
 
272
- spec = Gem::Specification.load("bundler/bundler.gemspec")
282
+ # leaves other versions of bundler gemspecs on default specification directory.
283
+ assert_path_exist previous_bundler_specification_path
284
+ assert_path_not_exist new_bundler_specification_path
273
285
 
274
- spec.executables.each do |e|
275
- assert_path_exist File.join destdir, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'gems', spec.full_name, spec.bindir, e
286
+ # installs the updated bundler gemspec to destdir
287
+ assert_path_not_exist prepend_destdir(destdir, previous_bundler_specification_path)
288
+ assert_path_exist prepend_destdir(destdir, new_bundler_specification_path)
289
+
290
+ bundler_spec.executables.each do |e|
291
+ assert_path_exist prepend_destdir(destdir, File.join(@gemhome, "gems", bundler_spec.full_name, bundler_spec.bindir, e))
276
292
  end
277
293
  ensure
278
294
  FileUtils.chmod "+w", @gemhome
@@ -281,39 +297,37 @@ class TestGemCommandsSetupCommand < Gem::TestCase
281
297
  def test_install_default_bundler_gem_with_destdir_and_prefix_flags
282
298
  @cmd.extend FileUtils
283
299
 
284
- destdir = File.join(@tempdir, 'foo')
285
- bin_dir = File.join(destdir, 'bin')
300
+ destdir = File.join(@tempdir, "foo")
301
+ bin_dir = File.join(destdir, "bin")
286
302
 
287
303
  @cmd.options[:destdir] = destdir
288
304
  @cmd.options[:prefix] = "/"
289
305
 
290
306
  @cmd.install_default_bundler_gem bin_dir
291
307
 
292
- spec = Gem::Specification.load("bundler/bundler.gemspec")
293
-
294
- spec.executables.each do |e|
295
- assert_path_exist File.join destdir, 'gems', spec.full_name, spec.bindir, e
308
+ bundler_spec.executables.each do |e|
309
+ assert_path_exist File.join destdir, "gems", bundler_spec.full_name, bundler_spec.bindir, e
296
310
  end
297
311
  end
298
312
 
299
313
  def test_remove_old_lib_files
300
314
  lib = RbConfig::CONFIG["sitelibdir"]
301
- lib_rubygems = File.join lib, 'rubygems'
302
- lib_bundler = File.join lib, 'bundler'
303
- lib_rubygems_defaults = File.join lib_rubygems, 'defaults'
304
- lib_bundler_templates = File.join lib_bundler, 'templates'
315
+ lib_rubygems = File.join lib, "rubygems"
316
+ lib_bundler = File.join lib, "bundler"
317
+ lib_rubygems_defaults = File.join lib_rubygems, "defaults"
318
+ lib_bundler_templates = File.join lib_bundler, "templates"
305
319
 
306
- securerandom_rb = File.join lib, 'securerandom.rb'
320
+ securerandom_rb = File.join lib, "securerandom.rb"
307
321
 
308
- engine_defaults_rb = File.join lib_rubygems_defaults, 'jruby.rb'
309
- os_defaults_rb = File.join lib_rubygems_defaults, 'operating_system.rb'
322
+ engine_defaults_rb = File.join lib_rubygems_defaults, "jruby.rb"
323
+ os_defaults_rb = File.join lib_rubygems_defaults, "operating_system.rb"
310
324
 
311
- old_gauntlet_rubygems_rb = File.join lib, 'gauntlet_rubygems.rb'
325
+ old_gauntlet_rubygems_rb = File.join lib, "gauntlet_rubygems.rb"
312
326
 
313
- old_builder_rb = File.join lib_rubygems, 'builder.rb'
314
- old_format_rb = File.join lib_rubygems, 'format.rb'
315
- old_bundler_c_rb = File.join lib_bundler, 'c.rb'
316
- old_bundler_ci = File.join lib_bundler_templates, '.lecacy_ci', 'config.yml'
327
+ old_builder_rb = File.join lib_rubygems, "builder.rb"
328
+ old_format_rb = File.join lib_rubygems, "format.rb"
329
+ old_bundler_c_rb = File.join lib_bundler, "c.rb"
330
+ old_bundler_ci = File.join lib_bundler_templates, ".lecacy_ci", "config.yml"
317
331
 
318
332
  files_that_go = [old_gauntlet_rubygems_rb, old_builder_rb, old_format_rb, old_bundler_c_rb, old_bundler_ci]
319
333
  files_that_stay = [securerandom_rb, engine_defaults_rb, os_defaults_rb]
@@ -328,15 +342,15 @@ class TestGemCommandsSetupCommand < Gem::TestCase
328
342
  end
329
343
 
330
344
  def test_remove_old_man_files
331
- man = File.join RbConfig::CONFIG['mandir'], 'man'
345
+ man = File.join RbConfig::CONFIG["mandir"], "man"
332
346
 
333
- ruby_1 = File.join man, 'man1', 'ruby.1'
334
- bundle_b_1 = File.join man, 'man1', 'bundle-b.1'
335
- bundle_b_1_ronn = File.join man, 'man1', 'bundle-b.1.ronn'
336
- bundle_b_1_txt = File.join man, 'man1', 'bundle-b.1.txt'
337
- gemfile_5 = File.join man, 'man5', 'gemfile.5'
338
- gemfile_5_ronn = File.join man, 'man5', 'gemfile.5.ronn'
339
- gemfile_5_txt = File.join man, 'man5', 'gemfile.5.txt'
347
+ ruby_1 = File.join man, "man1", "ruby.1"
348
+ bundle_b_1 = File.join man, "man1", "bundle-b.1"
349
+ bundle_b_1_ronn = File.join man, "man1", "bundle-b.1.ronn"
350
+ bundle_b_1_txt = File.join man, "man1", "bundle-b.1.txt"
351
+ gemfile_5 = File.join man, "man5", "gemfile.5"
352
+ gemfile_5_ronn = File.join man, "man5", "gemfile.5.ronn"
353
+ gemfile_5_txt = File.join man, "man5", "gemfile.5.txt"
340
354
 
341
355
  files_that_go = [bundle_b_1, bundle_b_1_txt, bundle_b_1_ronn, gemfile_5, gemfile_5_txt, gemfile_5_ronn]
342
356
  files_that_stay = [ruby_1]
@@ -354,9 +368,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
354
368
  @default_external = @ui.outs.external_encoding
355
369
  @ui.outs.set_encoding Encoding::US_ASCII
356
370
 
357
- @cmd.options[:previous_version] = Gem::Version.new '2.0.2'
371
+ @cmd.options[:previous_version] = Gem::Version.new "2.0.2"
358
372
 
359
- File.open 'CHANGELOG.md', 'w' do |io|
373
+ File.open "CHANGELOG.md", "w" do |io|
360
374
  io.puts <<-HISTORY_TXT
361
375
  # #{Gem::VERSION} / 2013-03-26
362
376
 
@@ -403,7 +417,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
403
417
  list.each do |file|
404
418
  FileUtils.mkdir_p File.dirname(file)
405
419
 
406
- File.open file, 'w' do |io|
420
+ File.open file, "w" do |io|
407
421
  io.puts "# #{File.basename(file)}"
408
422
  end
409
423
  end
@@ -414,18 +428,18 @@ class TestGemCommandsSetupCommand < Gem::TestCase
414
428
  s.executables = [name]
415
429
  s.files = %W[bin/#{name}]
416
430
  end
417
- write_file File.join @tempdir, 'bin', name do |f|
418
- f.puts '#!/usr/bin/ruby'
431
+ write_file File.join @tempdir, "bin", name do |f|
432
+ f.puts "#!/usr/bin/ruby"
419
433
  end
420
434
  install_gem gem
421
- File.join @gemhome, 'bin', name
435
+ File.join @gemhome, "bin", name
422
436
  end
423
437
 
424
438
  def gem_install_with_plugin(name)
425
439
  gem = util_spec name do |s|
426
440
  s.files = %W[lib/rubygems_plugin.rb]
427
441
  end
428
- write_file File.join @tempdir, 'lib', 'rubygems_plugin.rb' do |f|
442
+ write_file File.join @tempdir, "lib", "rubygems_plugin.rb" do |f|
429
443
  f.puts "require '#{gem.plugins.first}'"
430
444
  end
431
445
  install_gem gem
@@ -434,14 +448,34 @@ class TestGemCommandsSetupCommand < Gem::TestCase
434
448
  end
435
449
 
436
450
  def default_gem_bin_path
437
- File.join RbConfig::CONFIG['bindir'], 'gem'
451
+ File.join RbConfig::CONFIG["bindir"], "gem"
438
452
  end
439
453
 
440
454
  def default_bundle_bin_path
441
- File.join RbConfig::CONFIG['bindir'], 'bundle'
455
+ File.join RbConfig::CONFIG["bindir"], "bundle"
442
456
  end
443
457
 
444
458
  def default_bundler_bin_path
445
- File.join RbConfig::CONFIG['bindir'], 'bundler'
459
+ File.join RbConfig::CONFIG["bindir"], "bundler"
460
+ end
461
+
462
+ def previous_bundler_specification_path
463
+ File.join(Gem.default_specifications_dir, "bundler-1.15.4.gemspec")
464
+ end
465
+
466
+ def new_bundler_specification_path
467
+ File.join(Gem.default_specifications_dir, "bundler-#{bundler_version}.gemspec")
468
+ end
469
+
470
+ def bundler_spec
471
+ Gem::Specification.load("bundler/bundler.gemspec")
472
+ end
473
+
474
+ def bundler_version
475
+ bundler_spec.version
476
+ end
477
+
478
+ def prepend_destdir(destdir, path)
479
+ File.join(destdir, path.gsub(/^[a-zA-Z]:/, ""))
446
480
  end
447
481
  end unless Gem.java_platform?
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'helper'
3
- require 'rubygems/commands/signin_command'
4
- require 'rubygems/installer'
2
+ require_relative "helper"
3
+ require "rubygems/commands/signin_command"
4
+ require "rubygems/installer"
5
5
 
6
6
  class TestGemCommandsSigninCommand < Gem::TestCase
7
7
  def setup
@@ -34,7 +34,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
34
34
  end
35
35
 
36
36
  def test_execute_when_already_signed_in_with_same_host
37
- host = 'http://some-gemcutter-compatible-host.org'
37
+ host = "http://some-gemcutter-compatible-host.org"
38
38
 
39
39
  util_capture(nil, host) { @cmd.execute }
40
40
  old_credentials = load_yaml_file Gem.configuration.credentials_path
@@ -46,10 +46,10 @@ class TestGemCommandsSigninCommand < Gem::TestCase
46
46
  end
47
47
 
48
48
  def test_execute_when_already_signed_in_with_different_host
49
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf04045xxxx'
49
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf04045xxxx"
50
50
 
51
51
  util_capture(nil, nil, api_key) { @cmd.execute }
52
- host = 'http://some-gemcutter-compatible-host.org'
52
+ host = "http://some-gemcutter-compatible-host.org"
53
53
 
54
54
  util_capture(nil, host, api_key) { @cmd.execute }
55
55
  credentials = load_yaml_file Gem.configuration.credentials_path
@@ -60,13 +60,13 @@ class TestGemCommandsSigninCommand < Gem::TestCase
60
60
  end
61
61
 
62
62
  def test_execute_with_host_supplied
63
- host = 'http://some-gemcutter-compatible-host.org'
63
+ host = "http://some-gemcutter-compatible-host.org"
64
64
 
65
65
  sign_in_ui = util_capture(nil, host) { @cmd.execute }
66
66
  assert_match %r{Enter your #{host} credentials.}, sign_in_ui.output
67
67
  assert_match %r{Signed in.}, sign_in_ui.output
68
68
 
69
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
69
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
70
70
  credentials = load_yaml_file Gem.configuration.credentials_path
71
71
  assert_equal api_key, credentials[host]
72
72
  end
@@ -74,16 +74,16 @@ class TestGemCommandsSigninCommand < Gem::TestCase
74
74
  def test_execute_with_valid_creds_set_for_default_host
75
75
  util_capture { @cmd.execute }
76
76
 
77
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
77
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
78
78
  credentials = load_yaml_file Gem.configuration.credentials_path
79
79
 
80
80
  assert_equal api_key, credentials[:rubygems_api_key]
81
81
  end
82
82
 
83
83
  def test_execute_with_key_name_and_scope
84
- email = 'you@example.com'
85
- password = 'secret'
86
- api_key = '1234'
84
+ email = "you@example.com"
85
+ password = "secret"
86
+ api_key = "1234"
87
87
  fetcher = Gem::RemoteFetcher.fetcher
88
88
 
89
89
  key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\n"
@@ -106,9 +106,9 @@ class TestGemCommandsSigninCommand < Gem::TestCase
106
106
  end
107
107
 
108
108
  def test_execute_with_key_name_scope_and_mfa_level_of_ui_only
109
- email = 'you@example.com'
110
- password = 'secret'
111
- api_key = '1234'
109
+ email = "you@example.com"
110
+ password = "secret"
111
+ api_key = "1234"
112
112
  fetcher = Gem::RemoteFetcher.fetcher
113
113
  mfa_level = "ui_only"
114
114
 
@@ -133,9 +133,9 @@ class TestGemCommandsSigninCommand < Gem::TestCase
133
133
  end
134
134
 
135
135
  def test_execute_with_key_name_scope_and_mfa_level_of_gem_signin
136
- email = 'you@example.com'
137
- password = 'secret'
138
- api_key = '1234'
136
+ email = "you@example.com"
137
+ password = "secret"
138
+ api_key = "1234"
139
139
  fetcher = Gem::RemoteFetcher.fetcher
140
140
  mfa_level = "ui_and_gem_signin"
141
141
 
@@ -159,20 +159,34 @@ class TestGemCommandsSigninCommand < Gem::TestCase
159
159
  assert_equal api_key, credentials[:rubygems_api_key]
160
160
  end
161
161
 
162
+ def test_execute_with_warnings
163
+ email = "you@example.com"
164
+ password = "secret"
165
+ api_key = "1234"
166
+ fetcher = Gem::RemoteFetcher.fetcher
167
+ mfa_level = "disabled"
168
+ warning = "/[WARNING/] For protection of your account and gems"
169
+
170
+ key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\ny"
171
+ util_capture(key_name_ui, nil, api_key, fetcher, mfa_level, warning) { @cmd.execute }
172
+
173
+ assert_match warning, key_name_ui.output
174
+ end
175
+
162
176
  def test_execute_on_gemserver_without_profile_me_endpoint
163
- host = 'http://some-gemcutter-compatible-host.org'
177
+ host = "http://some-gemcutter-compatible-host.org"
164
178
 
165
- email = 'you@example.com'
166
- password = 'secret'
167
- api_key = '1234'
179
+ email = "you@example.com"
180
+ password = "secret"
181
+ api_key = "1234"
168
182
  fetcher = Gem::RemoteFetcher.fetcher
169
183
 
170
184
  key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\ny"
171
185
 
172
186
  # Set the expected response for the Web-API supplied
173
- ENV['RUBYGEMS_HOST'] = host
187
+ ENV["RUBYGEMS_HOST"] = host
174
188
  data_key = "#{ENV['RUBYGEMS_HOST']}/api/v1/api_key"
175
- fetcher.data[data_key] = [api_key, 200, 'OK']
189
+ fetcher.data[data_key] = [api_key, 200, "OK"]
176
190
 
177
191
  use_ui key_name_ui do
178
192
  @cmd.execute
@@ -193,15 +207,15 @@ class TestGemCommandsSigninCommand < Gem::TestCase
193
207
 
194
208
  # Utility method to capture IO/UI within the block passed
195
209
 
196
- def util_capture(ui_stub = nil, host = nil, api_key = nil, fetcher = Gem::FakeFetcher.new, mfa_level = "disabled")
197
- api_key ||= 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
198
- response = [api_key, 200, 'OK']
199
- profile_response = [ "mfa: #{mfa_level}\n" , 200, 'OK']
200
- email = 'you@example.com'
201
- password = 'secret'
210
+ def util_capture(ui_stub = nil, host = nil, api_key = nil, fetcher = Gem::FakeFetcher.new, mfa_level = "disabled", warning = nil)
211
+ api_key ||= "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
212
+ response = [api_key, 200, "OK"]
213
+ profile_response = [ "mfa: #{mfa_level}\nwarning: #{warning}" , 200, "OK"]
214
+ email = "you@example.com"
215
+ password = "secret"
202
216
 
203
217
  # Set the expected response for the Web-API supplied
204
- ENV['RUBYGEMS_HOST'] = host || Gem::DEFAULT_HOST
218
+ ENV["RUBYGEMS_HOST"] = host || Gem::DEFAULT_HOST
205
219
  data_key = "#{ENV['RUBYGEMS_HOST']}/api/v1/api_key"
206
220
  fetcher.data[data_key] = response
207
221
  profile = "#{ENV['RUBYGEMS_HOST']}/api/v1/profile/me.yaml"
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'helper'
4
- require 'rubygems/commands/signout_command'
5
- require 'rubygems/installer'
3
+ require_relative "helper"
4
+ require "rubygems/commands/signout_command"
5
+ require "rubygems/installer"
6
6
 
7
7
  class TestGemCommandsSignoutCommand < Gem::TestCase
8
8
  def setup