rubygems-update 2.7.11 → 3.0.0

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

Potentially problematic release.


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

Files changed (350) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +66 -0
  3. data/.travis.yml +22 -18
  4. data/CONTRIBUTING.md +141 -0
  5. data/History.txt +289 -19
  6. data/MAINTAINERS.txt +1 -0
  7. data/Manifest.txt +16 -11
  8. data/POLICIES.md +92 -0
  9. data/README.md +47 -26
  10. data/Rakefile +47 -207
  11. data/{UPGRADING.rdoc → UPGRADING.md} +31 -32
  12. data/appveyor.yml +20 -45
  13. data/bin/gem +1 -2
  14. data/bin/update_rubygems +2 -3
  15. data/bundler/CHANGELOG.md +54 -0
  16. data/bundler/bundler.gemspec +7 -1
  17. data/bundler/lib/bundler.rb +26 -8
  18. data/bundler/lib/bundler/build_metadata.rb +2 -2
  19. data/bundler/lib/bundler/cli.rb +63 -21
  20. data/bundler/lib/bundler/cli/add.rb +15 -5
  21. data/bundler/lib/bundler/cli/binstubs.rb +8 -2
  22. data/bundler/lib/bundler/cli/doctor.rb +47 -1
  23. data/bundler/lib/bundler/cli/install.rb +8 -5
  24. data/bundler/lib/bundler/cli/list.rb +41 -5
  25. data/bundler/lib/bundler/cli/outdated.rb +7 -1
  26. data/bundler/lib/bundler/cli/pristine.rb +4 -0
  27. data/bundler/lib/bundler/cli/remove.rb +18 -0
  28. data/bundler/lib/bundler/definition.rb +15 -16
  29. data/bundler/lib/bundler/dependency.rb +2 -2
  30. data/bundler/lib/bundler/dsl.rb +19 -3
  31. data/bundler/lib/bundler/feature_flag.rb +7 -0
  32. data/bundler/lib/bundler/gem_version_promoter.rb +4 -2
  33. data/bundler/lib/bundler/injector.rb +168 -9
  34. data/bundler/lib/bundler/installer.rb +29 -6
  35. data/bundler/lib/bundler/installer/parallel_installer.rb +5 -0
  36. data/bundler/lib/bundler/plugin.rb +10 -3
  37. data/bundler/lib/bundler/plugin/events.rb +61 -0
  38. data/bundler/lib/bundler/resolver.rb +2 -2
  39. data/bundler/lib/bundler/runtime.rb +8 -2
  40. data/bundler/lib/bundler/settings.rb +24 -3
  41. data/bundler/lib/bundler/settings/validator.rb +23 -0
  42. data/bundler/lib/bundler/shared_helpers.rb +19 -3
  43. data/bundler/lib/bundler/source.rb +9 -9
  44. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -0
  45. data/bundler/lib/bundler/version.rb +1 -1
  46. data/bundler/man/bundle-add.ronn +13 -2
  47. data/bundler/man/bundle-config.ronn +21 -0
  48. data/bundler/man/bundle-install.ronn +1 -1
  49. data/bundler/man/bundle-list.ronn +19 -1
  50. data/bundler/man/bundle-outdated.ronn +4 -0
  51. data/bundler/man/bundle-remove.ronn +23 -0
  52. data/bundler/man/bundle-update.ronn +1 -1
  53. data/lib/rubygems.rb +70 -96
  54. data/lib/rubygems/available_set.rb +1 -1
  55. data/lib/rubygems/basic_specification.rb +12 -12
  56. data/lib/rubygems/bundler_version_finder.rb +3 -3
  57. data/lib/rubygems/command.rb +22 -15
  58. data/lib/rubygems/command_manager.rb +20 -11
  59. data/lib/rubygems/commands/build_command.rb +27 -8
  60. data/lib/rubygems/commands/cert_command.rb +45 -24
  61. data/lib/rubygems/commands/check_command.rb +1 -1
  62. data/lib/rubygems/commands/cleanup_command.rb +14 -7
  63. data/lib/rubygems/commands/contents_command.rb +14 -15
  64. data/lib/rubygems/commands/dependency_command.rb +17 -17
  65. data/lib/rubygems/commands/environment_command.rb +20 -1
  66. data/lib/rubygems/commands/fetch_command.rb +2 -3
  67. data/lib/rubygems/commands/generate_index_command.rb +2 -3
  68. data/lib/rubygems/commands/help_command.rb +12 -13
  69. data/lib/rubygems/commands/info_command.rb +33 -0
  70. data/lib/rubygems/commands/install_command.rb +21 -17
  71. data/lib/rubygems/commands/list_command.rb +0 -1
  72. data/lib/rubygems/commands/lock_command.rb +3 -4
  73. data/lib/rubygems/commands/open_command.rb +16 -10
  74. data/lib/rubygems/commands/owner_command.rb +20 -11
  75. data/lib/rubygems/commands/pristine_command.rb +23 -16
  76. data/lib/rubygems/commands/push_command.rb +17 -8
  77. data/lib/rubygems/commands/query_command.rb +24 -24
  78. data/lib/rubygems/commands/rdoc_command.rb +3 -4
  79. data/lib/rubygems/commands/search_command.rb +0 -1
  80. data/lib/rubygems/commands/server_command.rb +1 -2
  81. data/lib/rubygems/commands/setup_command.rb +78 -38
  82. data/lib/rubygems/commands/signin_command.rb +2 -1
  83. data/lib/rubygems/commands/signout_command.rb +2 -2
  84. data/lib/rubygems/commands/sources_command.rb +11 -12
  85. data/lib/rubygems/commands/specification_command.rb +7 -7
  86. data/lib/rubygems/commands/uninstall_command.rb +41 -19
  87. data/lib/rubygems/commands/unpack_command.rb +16 -7
  88. data/lib/rubygems/commands/update_command.rb +28 -23
  89. data/lib/rubygems/commands/which_command.rb +4 -5
  90. data/lib/rubygems/commands/yank_command.rb +1 -2
  91. data/lib/rubygems/compatibility.rb +1 -21
  92. data/lib/rubygems/config_file.rb +36 -36
  93. data/lib/rubygems/core_ext/kernel_require.rb +6 -6
  94. data/lib/rubygems/core_ext/kernel_warn.rb +45 -0
  95. data/lib/rubygems/defaults.rb +31 -12
  96. data/lib/rubygems/dependency.rb +14 -14
  97. data/lib/rubygems/dependency_installer.rb +29 -31
  98. data/lib/rubygems/dependency_list.rb +8 -9
  99. data/lib/rubygems/deprecate.rb +2 -3
  100. data/lib/rubygems/doctor.rb +5 -6
  101. data/lib/rubygems/errors.rb +3 -3
  102. data/lib/rubygems/exceptions.rb +11 -4
  103. data/lib/rubygems/ext.rb +0 -1
  104. data/lib/rubygems/ext/build_error.rb +0 -1
  105. data/lib/rubygems/ext/builder.rb +50 -23
  106. data/lib/rubygems/ext/cmake_builder.rb +2 -2
  107. data/lib/rubygems/ext/configure_builder.rb +2 -3
  108. data/lib/rubygems/ext/ext_conf_builder.rb +8 -7
  109. data/lib/rubygems/ext/rake_builder.rb +16 -18
  110. data/lib/rubygems/gem_runner.rb +2 -2
  111. data/lib/rubygems/gemcutter_utilities.rb +40 -13
  112. data/lib/rubygems/indexer.rb +19 -12
  113. data/lib/rubygems/install_default_message.rb +0 -1
  114. data/lib/rubygems/install_message.rb +0 -1
  115. data/lib/rubygems/install_update_options.rb +2 -28
  116. data/lib/rubygems/installer.rb +95 -75
  117. data/lib/rubygems/installer_test_case.rb +0 -14
  118. data/lib/rubygems/local_remote_options.rb +5 -4
  119. data/lib/rubygems/mock_gem_ui.rb +3 -4
  120. data/lib/rubygems/name_tuple.rb +4 -4
  121. data/lib/rubygems/package.rb +90 -73
  122. data/lib/rubygems/package/digest_io.rb +3 -4
  123. data/lib/rubygems/package/file_source.rb +3 -4
  124. data/lib/rubygems/package/io_source.rb +1 -2
  125. data/lib/rubygems/package/old.rb +8 -16
  126. data/lib/rubygems/package/source.rb +0 -1
  127. data/lib/rubygems/package/tar_header.rb +2 -2
  128. data/lib/rubygems/package/tar_reader.rb +2 -4
  129. data/lib/rubygems/package/tar_reader/entry.rb +20 -4
  130. data/lib/rubygems/package/tar_test_case.rb +2 -8
  131. data/lib/rubygems/package/tar_writer.rb +13 -15
  132. data/lib/rubygems/package_task.rb +0 -1
  133. data/lib/rubygems/path_support.rb +16 -6
  134. data/lib/rubygems/platform.rb +4 -5
  135. data/lib/rubygems/psych_tree.rb +1 -1
  136. data/lib/rubygems/rdoc.rb +0 -311
  137. data/lib/rubygems/remote_fetcher.rb +34 -48
  138. data/lib/rubygems/request.rb +16 -15
  139. data/lib/rubygems/request/connection_pools.rb +24 -13
  140. data/lib/rubygems/request/http_pool.rb +3 -4
  141. data/lib/rubygems/request/https_pool.rb +1 -3
  142. data/lib/rubygems/request_set.rb +52 -25
  143. data/lib/rubygems/request_set/gem_dependency_api.rb +36 -40
  144. data/lib/rubygems/request_set/lockfile.rb +12 -12
  145. data/lib/rubygems/request_set/lockfile/parser.rb +18 -29
  146. data/lib/rubygems/request_set/lockfile/tokenizer.rb +9 -9
  147. data/lib/rubygems/requirement.rb +16 -16
  148. data/lib/rubygems/resolver.rb +10 -15
  149. data/lib/rubygems/resolver/activation_request.rb +6 -6
  150. data/lib/rubygems/resolver/api_set.rb +5 -6
  151. data/lib/rubygems/resolver/api_specification.rb +2 -3
  152. data/lib/rubygems/resolver/best_set.rb +5 -6
  153. data/lib/rubygems/resolver/composed_set.rb +5 -6
  154. data/lib/rubygems/resolver/conflict.rb +5 -5
  155. data/lib/rubygems/resolver/current_set.rb +1 -2
  156. data/lib/rubygems/resolver/dependency_request.rb +4 -4
  157. data/lib/rubygems/resolver/git_set.rb +5 -6
  158. data/lib/rubygems/resolver/git_specification.rb +4 -5
  159. data/lib/rubygems/resolver/index_set.rb +5 -6
  160. data/lib/rubygems/resolver/index_specification.rb +3 -4
  161. data/lib/rubygems/resolver/installed_specification.rb +3 -4
  162. data/lib/rubygems/resolver/installer_set.rb +12 -12
  163. data/lib/rubygems/resolver/local_specification.rb +1 -2
  164. data/lib/rubygems/resolver/lock_set.rb +5 -6
  165. data/lib/rubygems/resolver/lock_specification.rb +7 -8
  166. data/lib/rubygems/resolver/requirement_list.rb +1 -1
  167. data/lib/rubygems/resolver/set.rb +2 -2
  168. data/lib/rubygems/resolver/source_set.rb +4 -5
  169. data/lib/rubygems/resolver/spec_specification.rb +1 -2
  170. data/lib/rubygems/resolver/specification.rb +10 -7
  171. data/lib/rubygems/resolver/stats.rb +1 -1
  172. data/lib/rubygems/resolver/vendor_set.rb +4 -5
  173. data/lib/rubygems/resolver/vendor_specification.rb +2 -3
  174. data/lib/rubygems/safe_yaml.rb +18 -10
  175. data/lib/rubygems/security.rb +21 -22
  176. data/lib/rubygems/security/policies.rb +1 -2
  177. data/lib/rubygems/security/policy.rb +25 -25
  178. data/lib/rubygems/security/signer.rb +72 -24
  179. data/lib/rubygems/security/trust_dir.rb +10 -10
  180. data/lib/rubygems/server.rb +21 -21
  181. data/lib/rubygems/source.rb +16 -25
  182. data/lib/rubygems/source/git.rb +9 -10
  183. data/lib/rubygems/source/installed.rb +3 -4
  184. data/lib/rubygems/source/local.rb +7 -7
  185. data/lib/rubygems/source/lock.rb +4 -4
  186. data/lib/rubygems/source/specific_file.rb +5 -5
  187. data/lib/rubygems/source/vendor.rb +2 -3
  188. data/lib/rubygems/source_list.rb +2 -2
  189. data/lib/rubygems/source_local.rb +0 -1
  190. data/lib/rubygems/spec_fetcher.rb +5 -6
  191. data/lib/rubygems/specification.rb +199 -536
  192. data/lib/rubygems/specification_policy.rb +407 -0
  193. data/lib/rubygems/ssl_certs/{rubygems.org → index.rubygems.org}/GlobalSignRootCA.pem +0 -0
  194. data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
  195. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
  196. data/lib/rubygems/stub_specification.rb +11 -15
  197. data/lib/rubygems/test_case.rb +141 -66
  198. data/lib/rubygems/test_utilities.rb +20 -35
  199. data/lib/rubygems/text.rb +6 -6
  200. data/lib/rubygems/uninstaller.rb +37 -26
  201. data/lib/rubygems/uri_formatter.rb +1 -2
  202. data/lib/rubygems/user_interaction.rb +38 -93
  203. data/lib/rubygems/util.rb +20 -14
  204. data/lib/rubygems/util/licenses.rb +27 -1
  205. data/lib/rubygems/util/list.rb +1 -1
  206. data/lib/rubygems/validator.rb +4 -5
  207. data/lib/rubygems/version.rb +15 -15
  208. data/lib/rubygems/version_option.rb +2 -3
  209. data/rubygems-update.gemspec +43 -0
  210. data/setup.rb +2 -8
  211. data/test/rubygems/rubygems_plugin.rb +0 -1
  212. data/test/rubygems/simple_gem.rb +1 -1
  213. data/test/rubygems/test_bundled_ca.rb +4 -7
  214. data/test/rubygems/test_config.rb +7 -2
  215. data/test/rubygems/test_gem.rb +161 -130
  216. data/test/rubygems/test_gem_command.rb +0 -1
  217. data/test/rubygems/test_gem_command_manager.rb +8 -3
  218. data/test/rubygems/test_gem_commands_build_command.rb +219 -15
  219. data/test/rubygems/test_gem_commands_cert_command.rb +69 -8
  220. data/test/rubygems/test_gem_commands_check_command.rb +1 -1
  221. data/test/rubygems/test_gem_commands_cleanup_command.rb +27 -1
  222. data/test/rubygems/test_gem_commands_contents_command.rb +1 -2
  223. data/test/rubygems/test_gem_commands_dependency_command.rb +33 -34
  224. data/test/rubygems/test_gem_commands_environment_command.rb +1 -0
  225. data/test/rubygems/test_gem_commands_fetch_command.rb +0 -1
  226. data/test/rubygems/test_gem_commands_generate_index_command.rb +0 -1
  227. data/test/rubygems/test_gem_commands_help_command.rb +7 -4
  228. data/test/rubygems/test_gem_commands_info_command.rb +44 -0
  229. data/test/rubygems/test_gem_commands_install_command.rb +79 -12
  230. data/test/rubygems/test_gem_commands_lock_command.rb +0 -1
  231. data/test/rubygems/test_gem_commands_open_command.rb +29 -0
  232. data/test/rubygems/test_gem_commands_outdated_command.rb +0 -1
  233. data/test/rubygems/test_gem_commands_owner_command.rb +93 -57
  234. data/test/rubygems/test_gem_commands_pristine_command.rb +65 -30
  235. data/test/rubygems/test_gem_commands_push_command.rb +39 -0
  236. data/test/rubygems/test_gem_commands_query_command.rb +102 -100
  237. data/test/rubygems/test_gem_commands_search_command.rb +0 -1
  238. data/test/rubygems/test_gem_commands_server_command.rb +0 -1
  239. data/test/rubygems/test_gem_commands_setup_command.rb +39 -8
  240. data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
  241. data/test/rubygems/test_gem_commands_sources_command.rb +0 -1
  242. data/test/rubygems/test_gem_commands_specification_command.rb +2 -3
  243. data/test/rubygems/test_gem_commands_stale_command.rb +3 -2
  244. data/test/rubygems/test_gem_commands_uninstall_command.rb +81 -7
  245. data/test/rubygems/test_gem_commands_unpack_command.rb +17 -1
  246. data/test/rubygems/test_gem_commands_update_command.rb +19 -2
  247. data/test/rubygems/test_gem_commands_which_command.rb +0 -1
  248. data/test/rubygems/test_gem_commands_yank_command.rb +0 -1
  249. data/test/rubygems/test_gem_config_file.rb +4 -2
  250. data/test/rubygems/test_gem_dependency.rb +0 -1
  251. data/test/rubygems/test_gem_dependency_installer.rb +8 -5
  252. data/test/rubygems/test_gem_dependency_list.rb +6 -7
  253. data/test/rubygems/test_gem_dependency_resolution_error.rb +0 -1
  254. data/test/rubygems/test_gem_doctor.rb +1 -2
  255. data/test/rubygems/test_gem_ext_builder.rb +10 -23
  256. data/test/rubygems/test_gem_ext_cmake_builder.rb +5 -4
  257. data/test/rubygems/test_gem_ext_configure_builder.rb +3 -3
  258. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +8 -9
  259. data/test/rubygems/test_gem_ext_rake_builder.rb +20 -5
  260. data/test/rubygems/test_gem_gem_runner.rb +0 -1
  261. data/test/rubygems/test_gem_gemcutter_utilities.rb +32 -6
  262. data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -1
  263. data/test/rubygems/test_gem_indexer.rb +1 -2
  264. data/test/rubygems/test_gem_install_update_options.rb +1 -20
  265. data/test/rubygems/test_gem_installer.rb +69 -203
  266. data/test/rubygems/test_gem_local_remote_options.rb +3 -3
  267. data/test/rubygems/test_gem_name_tuple.rb +0 -1
  268. data/test/rubygems/test_gem_package.rb +59 -50
  269. data/test/rubygems/test_gem_package_old.rb +0 -1
  270. data/test/rubygems/test_gem_package_tar_header.rb +1 -2
  271. data/test/rubygems/test_gem_package_tar_reader.rb +0 -1
  272. data/test/rubygems/test_gem_package_tar_reader_entry.rb +11 -0
  273. data/test/rubygems/test_gem_package_tar_writer.rb +40 -7
  274. data/test/rubygems/test_gem_package_task.rb +2 -2
  275. data/test/rubygems/test_gem_path_support.rb +28 -11
  276. data/test/rubygems/test_gem_platform.rb +4 -5
  277. data/test/rubygems/test_gem_rdoc.rb +1 -2
  278. data/test/rubygems/test_gem_remote_fetcher.rb +111 -130
  279. data/test/rubygems/test_gem_request.rb +5 -5
  280. data/test/rubygems/test_gem_request_connection_pools.rb +24 -3
  281. data/test/rubygems/test_gem_request_set.rb +5 -5
  282. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +2 -7
  283. data/test/rubygems/test_gem_request_set_lockfile.rb +1 -2
  284. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +4 -9
  285. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
  286. data/test/rubygems/test_gem_requirement.rb +18 -4
  287. data/test/rubygems/test_gem_resolver.rb +13 -17
  288. data/test/rubygems/test_gem_resolver_activation_request.rb +0 -1
  289. data/test/rubygems/test_gem_resolver_api_set.rb +0 -1
  290. data/test/rubygems/test_gem_resolver_api_specification.rb +0 -1
  291. data/test/rubygems/test_gem_resolver_best_set.rb +0 -1
  292. data/test/rubygems/test_gem_resolver_composed_set.rb +0 -1
  293. data/test/rubygems/test_gem_resolver_conflict.rb +0 -1
  294. data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -1
  295. data/test/rubygems/test_gem_resolver_git_set.rb +0 -1
  296. data/test/rubygems/test_gem_resolver_git_specification.rb +0 -1
  297. data/test/rubygems/test_gem_resolver_index_set.rb +0 -1
  298. data/test/rubygems/test_gem_resolver_index_specification.rb +0 -1
  299. data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -1
  300. data/test/rubygems/test_gem_resolver_installer_set.rb +2 -3
  301. data/test/rubygems/test_gem_resolver_local_specification.rb +0 -1
  302. data/test/rubygems/test_gem_resolver_lock_set.rb +0 -1
  303. data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -1
  304. data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -1
  305. data/test/rubygems/test_gem_resolver_specification.rb +1 -2
  306. data/test/rubygems/test_gem_resolver_vendor_set.rb +0 -1
  307. data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -1
  308. data/test/rubygems/test_gem_security.rb +1 -3
  309. data/test/rubygems/test_gem_security_policy.rb +4 -5
  310. data/test/rubygems/test_gem_security_signer.rb +4 -3
  311. data/test/rubygems/test_gem_security_trust_dir.rb +1 -2
  312. data/test/rubygems/test_gem_server.rb +4 -4
  313. data/test/rubygems/test_gem_source.rb +0 -13
  314. data/test/rubygems/test_gem_source_fetch_problem.rb +0 -1
  315. data/test/rubygems/test_gem_source_git.rb +0 -1
  316. data/test/rubygems/test_gem_source_installed.rb +0 -1
  317. data/test/rubygems/test_gem_source_lock.rb +0 -1
  318. data/test/rubygems/test_gem_source_vendor.rb +0 -1
  319. data/test/rubygems/test_gem_spec_fetcher.rb +0 -1
  320. data/test/rubygems/test_gem_specification.rb +334 -198
  321. data/test/rubygems/test_gem_stream_ui.rb +13 -30
  322. data/test/rubygems/test_gem_stub_specification.rb +0 -2
  323. data/test/rubygems/test_gem_text.rb +4 -5
  324. data/test/rubygems/test_gem_uninstaller.rb +21 -1
  325. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -1
  326. data/test/rubygems/test_gem_uri_formatter.rb +0 -1
  327. data/test/rubygems/test_gem_util.rb +6 -11
  328. data/test/rubygems/test_gem_validator.rb +0 -1
  329. data/test/rubygems/test_gem_version.rb +11 -11
  330. data/test/rubygems/test_gem_version_option.rb +0 -1
  331. data/test/rubygems/test_remote_fetch_error.rb +0 -1
  332. data/test/rubygems/test_require.rb +67 -52
  333. data/util/CL2notes +1 -2
  334. data/util/ci +15 -12
  335. data/util/create_certs.rb +6 -7
  336. data/util/create_encrypted_key.rb +0 -1
  337. data/util/patch_with_prs.rb +1 -1
  338. data/util/rubocop +8 -0
  339. data/util/update_bundled_ca_certificates.rb +15 -14
  340. data/util/update_changelog.rb +1 -1
  341. metadata +67 -59
  342. data/.autotest +0 -71
  343. data/.document +0 -5
  344. data/CONTRIBUTING.rdoc +0 -130
  345. data/CVE-2013-4287.txt +0 -35
  346. data/CVE-2013-4363.txt +0 -45
  347. data/CVE-2015-3900.txt +0 -40
  348. data/POLICIES.rdoc +0 -74
  349. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +0 -21
  350. data/test/rubygems/fix_openssl_warnings.rb +0 -13
@@ -4,6 +4,7 @@ require 'rubygems/user_interaction'
4
4
  require 'timeout'
5
5
 
6
6
  class TestGemStreamUI < Gem::TestCase
7
+ SHORT_TIMEOUT = (defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?) ? 1.0 : 0.1 # increase timeout with MJIT for --jit-wait testing
7
8
 
8
9
  module IsTty
9
10
  attr_accessor :tty
@@ -36,9 +37,6 @@ class TestGemStreamUI < Gem::TestCase
36
37
  end
37
38
 
38
39
  def test_ask
39
- skip 'TTY detection broken on windows' if
40
- Gem.win_platform? && RUBY_VERSION <= '1.9.2'
41
-
42
40
  Timeout.timeout(1) do
43
41
  expected_answer = "Arthur, King of the Britons"
44
42
  @in.string = "#{expected_answer}\n"
@@ -48,21 +46,15 @@ class TestGemStreamUI < Gem::TestCase
48
46
  end
49
47
 
50
48
  def test_ask_no_tty
51
- skip 'TTY detection broken on windows' if
52
- Gem.win_platform? && RUBY_VERSION <= '1.9.2'
53
-
54
49
  @in.tty = false
55
50
 
56
- Timeout.timeout(0.1) do
51
+ Timeout.timeout(SHORT_TIMEOUT) do
57
52
  answer = @sui.ask("what is your favorite color?")
58
53
  assert_nil answer
59
54
  end
60
55
  end
61
56
 
62
57
  def test_ask_for_password
63
- skip 'Always uses $stdin on windows' if
64
- Gem.win_platform? && RUBY_VERSION <= '1.9.2'
65
-
66
58
  Timeout.timeout(1) do
67
59
  expected_answer = "Arthur, King of the Britons"
68
60
  @in.string = "#{expected_answer}\n"
@@ -72,24 +64,18 @@ class TestGemStreamUI < Gem::TestCase
72
64
  end
73
65
 
74
66
  def test_ask_for_password_no_tty
75
- skip 'TTY handling is broken on windows' if
76
- Gem.win_platform? && RUBY_VERSION <= '1.9.2'
77
-
78
67
  @in.tty = false
79
68
 
80
- Timeout.timeout(0.1) do
69
+ Timeout.timeout(SHORT_TIMEOUT) do
81
70
  answer = @sui.ask_for_password("what is the airspeed velocity of an unladen swallow?")
82
71
  assert_nil answer
83
72
  end
84
73
  end
85
74
 
86
75
  def test_ask_yes_no_no_tty_with_default
87
- skip 'TTY handling is broken on windows' if
88
- Gem.win_platform? && RUBY_VERSION <= '1.9.2'
89
-
90
76
  @in.tty = false
91
77
 
92
- Timeout.timeout(0.1) do
78
+ Timeout.timeout(SHORT_TIMEOUT) do
93
79
  answer = @sui.ask_yes_no("do coconuts migrate?", false)
94
80
  assert_equal false, answer
95
81
 
@@ -99,12 +85,9 @@ class TestGemStreamUI < Gem::TestCase
99
85
  end
100
86
 
101
87
  def test_ask_yes_no_no_tty_without_default
102
- skip 'TTY handling is broken on windows' if
103
- Gem.win_platform? && RUBY_VERSION <= '1.9.2'
104
-
105
88
  @in.tty = false
106
89
 
107
- Timeout.timeout(0.1) do
90
+ Timeout.timeout(SHORT_TIMEOUT) do
108
91
  assert_raises(Gem::OperationNotSupportedError) do
109
92
  @sui.ask_yes_no("do coconuts migrate?")
110
93
  end
@@ -174,14 +157,14 @@ class TestGemStreamUI < Gem::TestCase
174
157
  def test_download_reporter_anything
175
158
  @cfg.verbose = 0
176
159
  reporter = @sui.download_reporter
177
- assert_kind_of Gem::StreamUI::VerboseDownloadReporter, reporter
160
+ assert_kind_of Gem::StreamUI::ThreadedDownloadReporter, reporter
178
161
  end
179
162
 
180
- def test_verbose_download_reporter
163
+ def test_threaded_download_reporter
181
164
  @cfg.verbose = true
182
165
  reporter = @sui.download_reporter
183
166
  reporter.fetch 'a.gem', 1024
184
- assert_equal "Fetching: a.gem", @out.string
167
+ assert_equal "Fetching a.gem\n", @out.string
185
168
  end
186
169
 
187
170
  def test_verbose_download_reporter_progress
@@ -189,7 +172,7 @@ class TestGemStreamUI < Gem::TestCase
189
172
  reporter = @sui.download_reporter
190
173
  reporter.fetch 'a.gem', 1024
191
174
  reporter.update 512
192
- assert_equal "Fetching: a.gem\rFetching: a.gem ( 50%)", @out.string
175
+ assert_equal "Fetching a.gem\n", @out.string
193
176
  end
194
177
 
195
178
  def test_verbose_download_reporter_progress_once
@@ -198,7 +181,7 @@ class TestGemStreamUI < Gem::TestCase
198
181
  reporter.fetch 'a.gem', 1024
199
182
  reporter.update 510
200
183
  reporter.update 512
201
- assert_equal "Fetching: a.gem\rFetching: a.gem ( 50%)", @out.string
184
+ assert_equal "Fetching a.gem\n", @out.string
202
185
  end
203
186
 
204
187
  def test_verbose_download_reporter_progress_complete
@@ -207,7 +190,7 @@ class TestGemStreamUI < Gem::TestCase
207
190
  reporter.fetch 'a.gem', 1024
208
191
  reporter.update 510
209
192
  reporter.done
210
- assert_equal "Fetching: a.gem\rFetching: a.gem ( 50%)\rFetching: a.gem (100%)\n", @out.string
193
+ assert_equal "Fetching a.gem\n", @out.string
211
194
  end
212
195
 
213
196
  def test_verbose_download_reporter_progress_nil_length
@@ -216,7 +199,7 @@ class TestGemStreamUI < Gem::TestCase
216
199
  reporter.fetch 'a.gem', nil
217
200
  reporter.update 1024
218
201
  reporter.done
219
- assert_equal "Fetching: a.gem\rFetching: a.gem (1024B)\rFetching: a.gem (1024B)\n", @out.string
202
+ assert_equal "Fetching a.gem\n", @out.string
220
203
  end
221
204
 
222
205
  def test_verbose_download_reporter_progress_zero_length
@@ -225,7 +208,7 @@ class TestGemStreamUI < Gem::TestCase
225
208
  reporter.fetch 'a.gem', 0
226
209
  reporter.update 1024
227
210
  reporter.done
228
- assert_equal "Fetching: a.gem\rFetching: a.gem (1024B)\rFetching: a.gem (1024B)\n", @out.string
211
+ assert_equal "Fetching a.gem\n", @out.string
229
212
  end
230
213
 
231
214
  def test_verbose_download_reporter_no_tty
@@ -240,7 +240,6 @@ end
240
240
 
241
241
  return stub
242
242
  end
243
-
244
243
  end
245
244
 
246
245
  def stub_with_extension
@@ -293,4 +292,3 @@ end
293
292
  end
294
293
 
295
294
  end
296
-
@@ -21,6 +21,10 @@ class TestGemText < Gem::TestCase
21
21
  assert_equal " text to wrap", format_text("text to wrap", 40, 2)
22
22
  end
23
23
 
24
+ def test_format_text_no_space
25
+ assert_equal "texttowr\nap", format_text("texttowrap", 8)
26
+ end
27
+
24
28
  def test_format_text_trailing # for two spaces after .
25
29
  text = <<-TEXT
26
30
  This line is really, really long. So long, in fact, that it is more than eighty characters long! The purpose of this line is for testing wrapping behavior because sometimes people don't wrap their text to eighty characters. Without the wrapping, the text might not look good in the RSS feed.
@@ -85,9 +89,4 @@ Without the wrapping, the text might not look good in the RSS feed.
85
89
  s = "ab" * 500_001
86
90
  assert_equal "Truncating desc to 1,000,000 characters:\n#{s[0, 1_000_000]}", truncate_text(s, "desc", 1_000_000)
87
91
  end
88
-
89
- def test_clean_text
90
- assert_equal ".]2;nyan.", clean_text("\e]2;nyan\a")
91
- end
92
-
93
92
  end
@@ -177,10 +177,12 @@ class TestGemUninstaller < Gem::InstallerTestCase
177
177
  gem_dir = File.join @gemhome, 'gems', @spec.full_name
178
178
 
179
179
  Gem.pre_uninstall do
180
+ sleep(0.1) if win_platform?
180
181
  assert File.exist?(gem_dir), 'gem_dir should exist'
181
182
  end
182
183
 
183
184
  Gem.post_uninstall do
185
+ sleep(0.1) if win_platform?
184
186
  refute File.exist?(gem_dir), 'gem_dir should not exist'
185
187
  end
186
188
 
@@ -212,7 +214,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
212
214
  default_spec = new_default_spec 'default', '2'
213
215
  install_default_gems default_spec
214
216
 
215
- spec = new_spec 'default', '2'
217
+ spec = util_spec 'default', '2'
216
218
  install_gem spec
217
219
 
218
220
  Gem::Specification.reset
@@ -482,4 +484,22 @@ create_makefile '#{@spec.name}'
482
484
  assert_match %r!r-1 depends on q \(= 1, development\)!, lines.shift
483
485
  assert_match %r!Successfully uninstalled q-1!, lines.last
484
486
  end
487
+
488
+ def test_uninstall_no_permission
489
+ uninstaller = Gem::Uninstaller.new @spec.name, :executables => true
490
+
491
+ stub_rm_r = lambda do |*args|
492
+ _path = args.shift
493
+ options = args.shift || Hash.new
494
+ # Uninstaller calls a method in RDoc which also calls FileUtils.rm_rf which
495
+ # is an alias for FileUtils#rm_r, so skip if we're using the force option
496
+ raise Errno::EPERM unless options[:force]
497
+ end
498
+
499
+ FileUtils.stub :rm_r, stub_rm_r do
500
+ assert_raises Gem::UninstallError do
501
+ uninstaller.uninstall
502
+ end
503
+ end
504
+ end
485
505
  end
@@ -30,4 +30,3 @@ class TestGemUnsatisfiableDependencyError < Gem::TestCase
30
30
  end
31
31
 
32
32
  end
33
-
@@ -26,4 +26,3 @@ class TestGemUriFormatter < Gem::TestCase
26
26
  end
27
27
 
28
28
  end
29
-
@@ -5,8 +5,7 @@ require 'rubygems/util'
5
5
  class TestGemUtil < Gem::TestCase
6
6
 
7
7
  def test_class_popen
8
- skip "MJIT executes process and it's caught by Process.wait(-1)" if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
9
- assert_equal "0\n", Gem::Util.popen(Gem.ruby, '-e', 'p 0')
8
+ assert_equal "0\n", Gem::Util.popen(Gem.ruby, '-I', File.expand_path('../../../lib', __FILE__), '-e', 'p 0')
10
9
 
11
10
  assert_raises Errno::ECHILD do
12
11
  Process.wait(-1)
@@ -15,7 +14,7 @@ class TestGemUtil < Gem::TestCase
15
14
 
16
15
  def test_silent_system
17
16
  assert_silent do
18
- Gem::Util.silent_system Gem.ruby, '-e', 'puts "hello"; warn "hello"'
17
+ Gem::Util.silent_system Gem.ruby, '-I', File.expand_path('../../../lib', __FILE__), '-e', 'puts "hello"; warn "hello"'
19
18
  end
20
19
  end
21
20
 
@@ -38,17 +37,14 @@ class TestGemUtil < Gem::TestCase
38
37
  # impossible to cd into it and its children
39
38
  FileUtils.chmod(0666, 'd/e')
40
39
 
40
+ skip 'skipped in root privilege' if Process.uid.zero?
41
+
41
42
  paths = Gem::Util.traverse_parents('d/e/f').to_a
42
43
 
43
44
  assert_equal File.join(@tempdir, 'd'), paths[0]
44
45
  assert_equal @tempdir, paths[1]
45
- if File.respond_to?(:realpath)
46
- assert_equal File.realpath(Dir.tmpdir), paths[2]
47
- assert_equal File.realpath("..", Dir.tmpdir), paths[3]
48
- elsif RUBY_PLATFORM !~ /darwin/
49
- assert_equal Dir.tmpdir, paths[2]
50
- assert_equal '/', paths[3]
51
- end
46
+ assert_equal File.realpath(Dir.tmpdir), paths[2]
47
+ assert_equal File.realpath("..", Dir.tmpdir), paths[3]
52
48
  ensure
53
49
  # restore default permissions, allow the directory to be removed
54
50
  FileUtils.chmod(0775, 'd/e') unless win_platform?
@@ -63,4 +59,3 @@ class TestGemUtil < Gem::TestCase
63
59
  end
64
60
 
65
61
  end
66
-
@@ -43,4 +43,3 @@ class TestGemValidator < Gem::TestCase
43
43
  end
44
44
 
45
45
  end
46
-
@@ -212,19 +212,19 @@ class TestGemVersion < Gem::TestCase
212
212
 
213
213
  # Asserts that +version+ is a prerelease.
214
214
 
215
- def assert_prerelease version
215
+ def assert_prerelease(version)
216
216
  assert v(version).prerelease?, "#{version} is a prerelease"
217
217
  end
218
218
 
219
219
  # Assert that +expected+ is the "approximate" recommendation for +version+.
220
220
 
221
- def assert_approximate_equal expected, version
221
+ def assert_approximate_equal(expected, version)
222
222
  assert_equal expected, v(version).approximate_recommendation
223
223
  end
224
224
 
225
225
  # Assert that the "approximate" recommendation for +version+ satifies +version+.
226
226
 
227
- def assert_approximate_satisfies_itself version
227
+ def assert_approximate_satisfies_itself(version)
228
228
  gem_version = v(version)
229
229
 
230
230
  assert Gem::Requirement.new(gem_version.approximate_recommendation).satisfied_by?(gem_version)
@@ -232,33 +232,33 @@ class TestGemVersion < Gem::TestCase
232
232
 
233
233
  # Assert that bumping the +unbumped+ version yields the +expected+.
234
234
 
235
- def assert_bumped_version_equal expected, unbumped
235
+ def assert_bumped_version_equal(expected, unbumped)
236
236
  assert_version_equal expected, v(unbumped).bump
237
237
  end
238
238
 
239
239
  # Assert that +release+ is the correct non-prerelease +version+.
240
240
 
241
- def assert_release_equal release, version
241
+ def assert_release_equal(release, version)
242
242
  assert_version_equal release, v(version).release
243
243
  end
244
244
 
245
245
  # Assert that two versions are equal. Handles strings or
246
246
  # Gem::Version instances.
247
247
 
248
- def assert_version_equal expected, actual
248
+ def assert_version_equal(expected, actual)
249
249
  assert_equal v(expected), v(actual)
250
250
  assert_equal v(expected).hash, v(actual).hash, "since #{actual} == #{expected}, they must have the same hash"
251
251
  end
252
252
 
253
253
  # Assert that two versions are eql?. Checks both directions.
254
254
 
255
- def assert_version_eql first, second
255
+ def assert_version_eql(first, second)
256
256
  first, second = v(first), v(second)
257
257
  assert first.eql?(second), "#{first} is eql? #{second}"
258
258
  assert second.eql?(first), "#{second} is eql? #{first}"
259
259
  end
260
260
 
261
- def assert_less_than left, right
261
+ def assert_less_than(left, right)
262
262
  l = v(left)
263
263
  r = v(right)
264
264
  assert l < r, "#{left} not less than #{right}"
@@ -266,14 +266,14 @@ class TestGemVersion < Gem::TestCase
266
266
 
267
267
  # Refute the assumption that +version+ is a prerelease.
268
268
 
269
- def refute_prerelease version
269
+ def refute_prerelease(version)
270
270
  refute v(version).prerelease?, "#{version} is NOT a prerelease"
271
271
  end
272
272
 
273
273
  # Refute the assumption that two versions are eql?. Checks both
274
274
  # directions.
275
275
 
276
- def refute_version_eql first, second
276
+ def refute_version_eql(first, second)
277
277
  first, second = v(first), v(second)
278
278
  refute first.eql?(second), "#{first} is NOT eql? #{second}"
279
279
  refute second.eql?(first), "#{second} is NOT eql? #{first}"
@@ -281,7 +281,7 @@ class TestGemVersion < Gem::TestCase
281
281
 
282
282
  # Refute the assumption that the two versions are equal?.
283
283
 
284
- def refute_version_equal unexpected, actual
284
+ def refute_version_equal(unexpected, actual)
285
285
  refute_equal v(unexpected), v(actual)
286
286
  end
287
287
  end
@@ -164,4 +164,3 @@ class TestGemVersionOption < Gem::TestCase
164
164
  end
165
165
 
166
166
  end
167
-
@@ -18,4 +18,3 @@ class TestRemoteFetchError < Gem::TestCase
18
18
  assert_equal error.to_s, 'There was an error fetching (https://gemsource.org)'
19
19
  end
20
20
  end
21
-
@@ -4,7 +4,7 @@ require 'rubygems'
4
4
 
5
5
  class TestGemRequire < Gem::TestCase
6
6
  class Latch
7
- def initialize count = 1
7
+ def initialize(count = 1)
8
8
  @count = count
9
9
  @lock = Monitor.new
10
10
  @cv = @lock.new_cond
@@ -40,10 +40,10 @@ class TestGemRequire < Gem::TestCase
40
40
 
41
41
  # Providing -I on the commandline should always beat gems
42
42
  def test_dash_i_beats_gems
43
- a1 = new_spec "a", "1", {"b" => "= 1"}, "lib/test_gem_require_a.rb"
44
- b1 = new_spec "b", "1", {"c" => "> 0"}, "lib/b/c.rb"
45
- c1 = new_spec "c", "1", nil, "lib/c/c.rb"
46
- c2 = new_spec "c", "2", nil, "lib/c/c.rb"
43
+ a1 = util_spec "a", "1", {"b" => "= 1"}, "lib/test_gem_require_a.rb"
44
+ b1 = util_spec "b", "1", {"c" => "> 0"}, "lib/b/c.rb"
45
+ c1 = util_spec "c", "1", nil, "lib/c/c.rb"
46
+ c2 = util_spec "c", "2", nil, "lib/c/c.rb"
47
47
 
48
48
  install_specs c1, c2, b1, a1
49
49
 
@@ -80,13 +80,11 @@ class TestGemRequire < Gem::TestCase
80
80
  end
81
81
 
82
82
  def test_concurrent_require
83
- skip 'deadlock' if /^1\.8\./ =~ RUBY_VERSION
84
-
85
83
  Object.const_set :FILE_ENTERED_LATCH, Latch.new(2)
86
84
  Object.const_set :FILE_EXIT_LATCH, Latch.new(1)
87
85
 
88
- a1 = new_spec "a", "1", nil, "lib/a.rb"
89
- b1 = new_spec "b", "1", nil, "lib/b.rb"
86
+ a1 = util_spec "a", "1", nil, "lib/a.rb"
87
+ b1 = util_spec "b", "1", nil, "lib/b.rb"
90
88
 
91
89
  install_specs a1, b1
92
90
 
@@ -107,9 +105,9 @@ class TestGemRequire < Gem::TestCase
107
105
  end
108
106
 
109
107
  def test_require_is_not_lazy_with_exact_req
110
- a1 = new_spec "a", "1", {"b" => "= 1"}, "lib/test_gem_require_a.rb"
111
- b1 = new_spec "b", "1", nil, "lib/b/c.rb"
112
- b2 = new_spec "b", "2", nil, "lib/b/c.rb"
108
+ a1 = util_spec "a", "1", {"b" => "= 1"}, "lib/test_gem_require_a.rb"
109
+ b1 = util_spec "b", "1", nil, "lib/b/c.rb"
110
+ b2 = util_spec "b", "2", nil, "lib/b/c.rb"
113
111
 
114
112
  install_specs b1, b2, a1
115
113
 
@@ -122,9 +120,9 @@ class TestGemRequire < Gem::TestCase
122
120
  end
123
121
 
124
122
  def test_require_is_lazy_with_inexact_req
125
- a1 = new_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
126
- b1 = new_spec "b", "1", nil, "lib/b/c.rb"
127
- b2 = new_spec "b", "2", nil, "lib/b/c.rb"
123
+ a1 = util_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
124
+ b1 = util_spec "b", "1", nil, "lib/b/c.rb"
125
+ b2 = util_spec "b", "2", nil, "lib/b/c.rb"
128
126
 
129
127
  install_specs b1, b2, a1
130
128
 
@@ -137,8 +135,8 @@ class TestGemRequire < Gem::TestCase
137
135
  end
138
136
 
139
137
  def test_require_is_not_lazy_with_one_possible
140
- a1 = new_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
141
- b1 = new_spec "b", "1", nil, "lib/b/c.rb"
138
+ a1 = util_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
139
+ b1 = util_spec "b", "1", nil, "lib/b/c.rb"
142
140
 
143
141
  install_specs b1, a1
144
142
 
@@ -151,7 +149,7 @@ class TestGemRequire < Gem::TestCase
151
149
  end
152
150
 
153
151
  def test_require_can_use_a_pathname_object
154
- a1 = new_spec "a", "1", nil, "lib/test_gem_require_a.rb"
152
+ a1 = util_spec "a", "1", nil, "lib/test_gem_require_a.rb"
155
153
 
156
154
  install_specs a1
157
155
 
@@ -161,9 +159,9 @@ class TestGemRequire < Gem::TestCase
161
159
  end
162
160
 
163
161
  def test_activate_via_require_respects_loaded_files
164
- a1 = new_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
165
- b1 = new_spec "b", "1", nil, "lib/benchmark.rb"
166
- b2 = new_spec "b", "2", nil, "lib/benchmark.rb"
162
+ a1 = util_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
163
+ b1 = util_spec "b", "1", nil, "lib/benchmark.rb"
164
+ b2 = util_spec "b", "2", nil, "lib/benchmark.rb"
167
165
 
168
166
  install_specs b1, b2, a1
169
167
 
@@ -181,11 +179,11 @@ class TestGemRequire < Gem::TestCase
181
179
  end
182
180
 
183
181
  def test_already_activated_direct_conflict
184
- a1 = new_spec "a", "1", { "b" => "> 0" }
185
- b1 = new_spec "b", "1", { "c" => ">= 1" }, "lib/ib.rb"
186
- b2 = new_spec "b", "2", { "c" => ">= 2" }, "lib/ib.rb"
187
- c1 = new_spec "c", "1", nil, "lib/d.rb"
188
- c2 = new_spec("c", "2", nil, "lib/d.rb")
182
+ a1 = util_spec "a", "1", { "b" => "> 0" }
183
+ b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/ib.rb"
184
+ b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/ib.rb"
185
+ c1 = util_spec "c", "1", nil, "lib/d.rb"
186
+ c2 = util_spec("c", "2", nil, "lib/d.rb")
189
187
 
190
188
  install_specs c1, c2, b1, b2, a1
191
189
 
@@ -201,13 +199,13 @@ class TestGemRequire < Gem::TestCase
201
199
  end
202
200
 
203
201
  def test_multiple_gems_with_the_same_path
204
- a1 = new_spec "a", "1", { "b" => "> 0", "x" => "> 0" }
205
- b1 = new_spec "b", "1", { "c" => ">= 1" }, "lib/ib.rb"
206
- b2 = new_spec "b", "2", { "c" => ">= 2" }, "lib/ib.rb"
207
- x1 = new_spec "x", "1", nil, "lib/ib.rb"
208
- x2 = new_spec "x", "2", nil, "lib/ib.rb"
209
- c1 = new_spec "c", "1", nil, "lib/d.rb"
210
- c2 = new_spec("c", "2", nil, "lib/d.rb")
202
+ a1 = util_spec "a", "1", { "b" => "> 0", "x" => "> 0" }
203
+ b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/ib.rb"
204
+ b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/ib.rb"
205
+ x1 = util_spec "x", "1", nil, "lib/ib.rb"
206
+ x2 = util_spec "x", "2", nil, "lib/ib.rb"
207
+ c1 = util_spec "c", "1", nil, "lib/d.rb"
208
+ c2 = util_spec("c", "2", nil, "lib/d.rb")
211
209
 
212
210
  install_specs c1, c2, x1, x2, b1, b2, a1
213
211
 
@@ -224,13 +222,13 @@ class TestGemRequire < Gem::TestCase
224
222
  end
225
223
 
226
224
  def test_unable_to_find_good_unresolved_version
227
- a1 = new_spec "a", "1", { "b" => "> 0" }
228
- b1 = new_spec "b", "1", { "c" => ">= 2" }, "lib/ib.rb"
229
- b2 = new_spec "b", "2", { "c" => ">= 3" }, "lib/ib.rb"
225
+ a1 = util_spec "a", "1", { "b" => "> 0" }
226
+ b1 = util_spec "b", "1", { "c" => ">= 2" }, "lib/ib.rb"
227
+ b2 = util_spec "b", "2", { "c" => ">= 3" }, "lib/ib.rb"
230
228
 
231
- c1 = new_spec "c", "1", nil, "lib/d.rb"
232
- c2 = new_spec "c", "2", nil, "lib/d.rb"
233
- c3 = new_spec "c", "3", nil, "lib/d.rb"
229
+ c1 = util_spec "c", "1", nil, "lib/d.rb"
230
+ c2 = util_spec "c", "2", nil, "lib/d.rb"
231
+ c3 = util_spec "c", "3", nil, "lib/d.rb"
234
232
 
235
233
  install_specs c1, c2, c3, b1, b2, a1
236
234
 
@@ -273,10 +271,10 @@ class TestGemRequire < Gem::TestCase
273
271
  end
274
272
 
275
273
  def test_require_doesnt_traverse_development_dependencies
276
- a = new_spec("a", "1", nil, "lib/a.rb")
277
- z = new_spec("z", "1", "w" => "> 0")
278
- w1 = new_spec("w", "1") { |s| s.add_development_dependency "non-existent" }
279
- w2 = new_spec("w", "2") { |s| s.add_development_dependency "non-existent" }
274
+ a = util_spec("a", "1", nil, "lib/a.rb")
275
+ z = util_spec("z", "1", "w" => "> 0")
276
+ w1 = util_spec("w", "1") { |s| s.add_development_dependency "non-existent" }
277
+ w2 = util_spec("w", "2") { |s| s.add_development_dependency "non-existent" }
280
278
 
281
279
  install_specs a, w1, w2, z
282
280
 
@@ -296,7 +294,6 @@ class TestGemRequire < Gem::TestCase
296
294
  end
297
295
 
298
296
  def test_realworld_default_gem
299
- skip "no default gems on ruby < 2.0" unless RUBY_VERSION >= "2"
300
297
  begin
301
298
  gem 'json'
302
299
  rescue Gem::MissingSpecError
@@ -316,7 +313,7 @@ class TestGemRequire < Gem::TestCase
316
313
  default_gem_spec = new_default_spec("default", "2.0.0.0",
317
314
  nil, "default/gem.rb")
318
315
  install_default_specs(default_gem_spec)
319
- normal_gem_spec = new_spec("default", "3.0", nil,
316
+ normal_gem_spec = util_spec("default", "3.0", nil,
320
317
  "lib/default/gem.rb")
321
318
  install_specs(normal_gem_spec)
322
319
  assert_require "default/gem"
@@ -366,7 +363,7 @@ class TestGemRequire < Gem::TestCase
366
363
  end
367
364
 
368
365
  def test_require_default_when_gem_defined
369
- a = new_spec("a", "1", nil, "lib/a.rb")
366
+ a = util_spec("a", "1", nil, "lib/a.rb")
370
367
  install_specs a
371
368
  c = Class.new do
372
369
  def self.gem(*args)
@@ -379,8 +376,8 @@ class TestGemRequire < Gem::TestCase
379
376
 
380
377
 
381
378
  def test_require_bundler
382
- b1 = new_spec('bundler', '1', nil, "lib/bundler/setup.rb")
383
- b2a = new_spec('bundler', '2.a', nil, "lib/bundler/setup.rb")
379
+ b1 = util_spec('bundler', '1', nil, "lib/bundler/setup.rb")
380
+ b2a = util_spec('bundler', '2.a', nil, "lib/bundler/setup.rb")
384
381
  install_specs b1, b2a
385
382
 
386
383
  require "rubygems/bundler_version_finder"
@@ -392,8 +389,8 @@ class TestGemRequire < Gem::TestCase
392
389
 
393
390
  def test_require_bundler_missing_bundler_version
394
391
  Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["55", "reason"]) do
395
- b1 = new_spec('bundler', '1.999999999', nil, "lib/bundler/setup.rb")
396
- b2a = new_spec('bundler', '2.a', nil, "lib/bundler/setup.rb")
392
+ b1 = util_spec('bundler', '1.999999999', nil, "lib/bundler/setup.rb")
393
+ b2a = util_spec('bundler', '2.a', nil, "lib/bundler/setup.rb")
397
394
  install_specs b1, b2a
398
395
 
399
396
  e = assert_raises Gem::MissingSpecVersionError do
@@ -405,8 +402,8 @@ class TestGemRequire < Gem::TestCase
405
402
 
406
403
  def test_require_bundler_with_bundler_version
407
404
  Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["1", "reason"]) do
408
- b1 = new_spec('bundler', '1.999999999', nil, "lib/bundler/setup.rb")
409
- b2 = new_spec('bundler', '2', nil, "lib/bundler/setup.rb")
405
+ b1 = util_spec('bundler', '1.999999999', nil, "lib/bundler/setup.rb")
406
+ b2 = util_spec('bundler', '2', nil, "lib/bundler/setup.rb")
410
407
  install_specs b1, b2
411
408
 
412
409
  $:.clear
@@ -415,6 +412,24 @@ class TestGemRequire < Gem::TestCase
415
412
  end
416
413
  end
417
414
 
415
+ if RUBY_VERSION >= "2.5"
416
+ def test_no_kernel_require_in_warn_with_uplevel
417
+ lib = File.realpath("../../../lib", __FILE__)
418
+ Dir.mktmpdir("warn_test") do |dir|
419
+ File.write(dir + "/sub.rb", "warn 'uplevel', 'test', uplevel: 1\n")
420
+ File.write(dir + "/main.rb", "require 'sub'\n")
421
+ _, err = capture_subprocess_io do
422
+ system(@@ruby, "-w", "-rpp", "--disable=gems", "-I", lib, "-C", dir, "-I.", "main.rb")
423
+ end
424
+ assert_equal "main.rb:1: warning: uplevel\ntest\n", err
425
+ _, err = capture_subprocess_io do
426
+ system(@@ruby, "-w", "-rpp", "--enable=gems", "-I", lib, "-C", dir, "-I.", "main.rb")
427
+ end
428
+ assert_equal "main.rb:1: warning: uplevel\ntest\n", err
429
+ end
430
+ end
431
+ end
432
+
418
433
  def silence_warnings
419
434
  old_verbose, $VERBOSE = $VERBOSE, false
420
435
  yield