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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- SIMPLE_GEM = <<-GEMDATA
2
+ SIMPLE_GEM = <<-GEMDATA.freeze
3
3
  MD5SUM = "989bf34a1cbecd52e0ea66b662b3a405"
4
4
  if $0 == __FILE__
5
5
  require 'optparse'
@@ -51,16 +51,13 @@ if ENV["CI"] || ENV["TEST_SSL"]
51
51
  assert_https('rubygems.org')
52
52
  end
53
53
 
54
- def test_accessing_www_rubygems
55
- assert_https('www.rubygems.org')
56
- end
57
-
58
- def test_accessing_staging
59
- assert_https('staging.rubygems.org')
54
+ def test_accessing_fastly
55
+ assert_https('rubygems.global.ssl.fastly.net')
60
56
  end
61
57
 
62
58
  def test_accessing_new_index
63
- assert_https('index.rubygems.org')
59
+ assert_https('fastly.rubygems.org')
64
60
  end
61
+
65
62
  end
66
63
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require 'rubygems/test_case'
3
3
  require 'rubygems'
4
+ require 'shellwords'
4
5
 
5
6
  class TestConfig < Gem::TestCase
6
7
 
@@ -13,12 +14,16 @@ class TestConfig < Gem::TestCase
13
14
 
14
15
  def test_good_rake_path_is_escaped
15
16
  path = Gem::TestCase.class_eval('@@good_rake')
16
- assert_match(/#{Gem.ruby} "[^"]*good_rake.rb"/, path)
17
+ ruby, rake = path.shellsplit
18
+ assert_equal(Gem.ruby, ruby)
19
+ assert_match(/\/good_rake.rb\z/, rake)
17
20
  end
18
21
 
19
22
  def test_bad_rake_path_is_escaped
20
23
  path = Gem::TestCase.class_eval('@@bad_rake')
21
- assert_match(/#{Gem.ruby} "[^"]*bad_rake.rb"/, path)
24
+ ruby, rake = path.shellsplit
25
+ assert_equal(Gem.ruby, ruby)
26
+ assert_match(/\/bad_rake.rb\z/, rake)
22
27
  end
23
28
 
24
29
  end
@@ -5,6 +5,7 @@ require 'rubygems/command'
5
5
  require 'rubygems/installer'
6
6
  require 'pathname'
7
7
  require 'tmpdir'
8
+ require 'rbconfig'
8
9
 
9
10
  # TODO: push this up to test_case.rb once battle tested
10
11
 
@@ -13,8 +14,9 @@ $LOAD_PATH.map! do |path|
13
14
  end
14
15
 
15
16
  class TestGem < Gem::TestCase
17
+ RUBY_INSTALL_NAME = RbConfig::CONFIG['RUBY_INSTALL_NAME']
16
18
 
17
- PLUGINS_LOADED = []
19
+ PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
18
20
 
19
21
  def setup
20
22
  super
@@ -31,11 +33,11 @@ class TestGem < Gem::TestCase
31
33
 
32
34
  def test_self_finish_resolve
33
35
  save_loaded_features do
34
- a1 = new_spec "a", "1", "b" => "> 0"
35
- b1 = new_spec "b", "1", "c" => ">= 1"
36
- b2 = new_spec "b", "2", "c" => ">= 2"
37
- c1 = new_spec "c", "1"
38
- c2 = new_spec "c", "2"
36
+ a1 = util_spec "a", "1", "b" => "> 0"
37
+ b1 = util_spec "b", "1", "c" => ">= 1"
38
+ b2 = util_spec "b", "2", "c" => ">= 2"
39
+ c1 = util_spec "c", "1"
40
+ c2 = util_spec "c", "2"
39
41
 
40
42
  install_specs c1, c2, b1, b2, a1
41
43
 
@@ -53,13 +55,13 @@ class TestGem < Gem::TestCase
53
55
 
54
56
  def test_self_finish_resolve_wtf
55
57
  save_loaded_features do
56
- a1 = new_spec "a", "1", "b" => "> 0", "d" => "> 0" # this
57
- b1 = new_spec "b", "1", { "c" => ">= 1" }, "lib/b.rb" # this
58
- b2 = new_spec "b", "2", { "c" => ">= 2" }, "lib/b.rb"
59
- c1 = new_spec "c", "1" # this
60
- c2 = new_spec "c", "2"
61
- d1 = new_spec "d", "1", { "c" => "< 2" }, "lib/d.rb"
62
- d2 = new_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
58
+ a1 = util_spec "a", "1", "b" => "> 0", "d" => "> 0" # this
59
+ b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/b.rb" # this
60
+ b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/b.rb"
61
+ c1 = util_spec "c", "1" # this
62
+ c2 = util_spec "c", "2"
63
+ d1 = util_spec "d", "1", { "c" => "< 2" }, "lib/d.rb"
64
+ d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
63
65
 
64
66
  install_specs c1, c2, b1, b2, d1, d2, a1
65
67
 
@@ -77,11 +79,11 @@ class TestGem < Gem::TestCase
77
79
 
78
80
  def test_self_finish_resolve_respects_loaded_specs
79
81
  save_loaded_features do
80
- a1 = new_spec "a", "1", "b" => "> 0"
81
- b1 = new_spec "b", "1", "c" => ">= 1"
82
- b2 = new_spec "b", "2", "c" => ">= 2"
83
- c1 = new_spec "c", "1"
84
- c2 = new_spec "c", "2"
82
+ a1 = util_spec "a", "1", "b" => "> 0"
83
+ b1 = util_spec "b", "1", "c" => ">= 1"
84
+ b2 = util_spec "b", "2", "c" => ">= 2"
85
+ c1 = util_spec "c", "1"
86
+ c2 = util_spec "c", "2"
85
87
 
86
88
  install_specs c1, c2, b1, b2, a1
87
89
 
@@ -130,6 +132,75 @@ class TestGem < Gem::TestCase
130
132
  assert_equal %w[a-1], installed.map { |spec| spec.full_name }
131
133
  end
132
134
 
135
+ def test_self_install_permissions
136
+ assert_self_install_permissions
137
+ end
138
+
139
+ def test_self_install_permissions_umask_0
140
+ umask = File.umask(0)
141
+ assert_self_install_permissions
142
+ ensure
143
+ File.umask(umask)
144
+ end
145
+
146
+ def test_self_install_permissions_umask_077
147
+ umask = File.umask(077)
148
+ assert_self_install_permissions
149
+ ensure
150
+ File.umask(umask)
151
+ end
152
+
153
+ def assert_self_install_permissions
154
+ mask = /mingw|mswin/ =~ RUBY_PLATFORM ? 0700 : 0777
155
+ options = {
156
+ :dir_mode => 0500,
157
+ :prog_mode => 0510,
158
+ :data_mode => 0640,
159
+ :wrappers => true,
160
+ }
161
+ Dir.chdir @tempdir do
162
+ Dir.mkdir 'bin'
163
+ File.open 'bin/foo.cmd', 'w' do |fp|
164
+ fp.chmod(0755)
165
+ fp.puts 'p'
166
+ end
167
+
168
+ Dir.mkdir 'data'
169
+ File.open 'data/foo.txt', 'w' do |fp|
170
+ fp.puts 'blah'
171
+ end
172
+
173
+ spec_fetcher do |f|
174
+ f.gem 'foo', 1 do |s|
175
+ s.executables = ['foo.cmd']
176
+ s.files = %w[bin/foo.cmd data/foo.txt]
177
+ end
178
+ end
179
+ Gem.install 'foo', Gem::Requirement.default, options
180
+ end
181
+
182
+ prog_mode = (options[:prog_mode] & mask).to_s(8)
183
+ dir_mode = (options[:dir_mode] & mask).to_s(8)
184
+ data_mode = (options[:data_mode] & mask).to_s(8)
185
+ expected = {
186
+ "bin/#{RUBY_INSTALL_NAME.sub('ruby', 'foo.cmd')}" => prog_mode,
187
+ 'gems/foo-1' => dir_mode,
188
+ 'gems/foo-1/bin' => dir_mode,
189
+ 'gems/foo-1/data' => dir_mode,
190
+ 'gems/foo-1/bin/foo.cmd' => prog_mode,
191
+ 'gems/foo-1/data/foo.txt' => data_mode,
192
+ }
193
+ result = {}
194
+ Dir.chdir @gemhome do
195
+ expected.each_key do |n|
196
+ result[n] = (File.stat(n).mode & mask).to_s(8)
197
+ end
198
+ end
199
+ assert_equal(expected, result)
200
+ ensure
201
+ File.chmod(0700, *Dir.glob(@gemhome+'/gems/**/').map {|path| path.untaint})
202
+ end
203
+
133
204
  def test_require_missing
134
205
  save_loaded_features do
135
206
  assert_raises ::LoadError do
@@ -140,7 +211,7 @@ class TestGem < Gem::TestCase
140
211
 
141
212
  def test_require_does_not_glob
142
213
  save_loaded_features do
143
- a1 = new_spec "a", "1", nil, "lib/a1.rb"
214
+ a1 = util_spec "a", "1", nil, "lib/a1.rb"
144
215
 
145
216
  install_specs a1
146
217
 
@@ -423,7 +494,6 @@ class TestGem < Gem::TestCase
423
494
  end
424
495
 
425
496
  def test_self_use_gemdeps
426
- skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
427
497
  rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
428
498
 
429
499
  FileUtils.mkdir_p 'detect/a/b'
@@ -498,7 +568,7 @@ class TestGem < Gem::TestCase
498
568
  assert File.directory?(util_cache_dir)
499
569
  end
500
570
 
501
- unless win_platform? || Process.uid.zero? then # only for FS that support write protection
571
+ unless win_platform? || Process.uid.zero? # only for FS that support write protection
502
572
  def test_self_ensure_gem_directories_write_protected
503
573
  gemdir = File.join @tempdir, "egd"
504
574
  FileUtils.rm_r gemdir rescue nil
@@ -577,9 +647,6 @@ class TestGem < Gem::TestCase
577
647
  end
578
648
 
579
649
  def test_self_find_files_with_gemfile
580
- # write_file(File.join Dir.pwd, 'Gemfile') fails on travis 1.8.7 with $SAFE=1
581
- skip if RUBY_VERSION <= "1.8.7"
582
-
583
650
  cwd = File.expand_path("test/rubygems", @@project_dir)
584
651
  actual_load_path = $LOAD_PATH.unshift(cwd).dup
585
652
 
@@ -612,7 +679,7 @@ class TestGem < Gem::TestCase
612
679
  assert_equal expected, Gem.find_files('sff/discover').sort
613
680
  assert_equal expected, Gem.find_files('sff/**.rb').sort, '[ruby-core:31730]'
614
681
  ensure
615
- assert_equal cwd, actual_load_path.shift unless RUBY_VERSION <= "1.8.7"
682
+ assert_equal cwd, actual_load_path.shift
616
683
  end
617
684
 
618
685
  def test_self_find_latest_files
@@ -828,7 +895,6 @@ class TestGem < Gem::TestCase
828
895
  end
829
896
 
830
897
  def test_self_refresh
831
- skip 'Insecure operation - mkdir' if RUBY_VERSION <= "1.8.7"
832
898
  util_make_gems
833
899
 
834
900
  a1_spec = @a1.spec_file
@@ -848,7 +914,6 @@ class TestGem < Gem::TestCase
848
914
  end
849
915
 
850
916
  def test_self_refresh_keeps_loaded_specs_activated
851
- skip 'Insecure operation - mkdir' if RUBY_VERSION <= "1.8.7"
852
917
  util_make_gems
853
918
 
854
919
  a1_spec = @a1.spec_file
@@ -930,7 +995,7 @@ class TestGem < Gem::TestCase
930
995
  assert_equal Gem::Requirement.default, Gem.env_requirement('qux')
931
996
  end
932
997
 
933
- def test_self_ruby_version_1_8_5
998
+ def test_self_ruby_version_with_patchlevel_less_ancient_rubies
934
999
  util_set_RUBY_VERSION '1.8.5'
935
1000
 
936
1001
  assert_equal Gem::Version.new('1.8.5'), Gem.ruby_version
@@ -938,7 +1003,7 @@ class TestGem < Gem::TestCase
938
1003
  util_restore_RUBY_VERSION
939
1004
  end
940
1005
 
941
- def test_self_ruby_version_1_8_6p287
1006
+ def test_self_ruby_version_with_release
942
1007
  util_set_RUBY_VERSION '1.8.6', 287
943
1008
 
944
1009
  assert_equal Gem::Version.new('1.8.6.287'), Gem.ruby_version
@@ -946,10 +1011,34 @@ class TestGem < Gem::TestCase
946
1011
  util_restore_RUBY_VERSION
947
1012
  end
948
1013
 
949
- def test_self_ruby_version_1_9_2dev_r23493
950
- util_set_RUBY_VERSION '1.9.2', -1, 23493
1014
+ def test_self_ruby_version_with_non_mri_implementations
1015
+ util_set_RUBY_VERSION '2.5.0', 0, 60928, 'jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]'
1016
+
1017
+ assert_equal Gem::Version.new('2.5.0'), Gem.ruby_version
1018
+ ensure
1019
+ util_restore_RUBY_VERSION
1020
+ end
1021
+
1022
+ def test_self_ruby_version_with_prerelease
1023
+ util_set_RUBY_VERSION '2.6.0', -1, 63539, 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
951
1024
 
952
- assert_equal Gem::Version.new('1.9.2.dev.23493'), Gem.ruby_version
1025
+ assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
1026
+ ensure
1027
+ util_restore_RUBY_VERSION
1028
+ end
1029
+
1030
+ def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
1031
+ util_set_RUBY_VERSION '2.6.0', -1, 63539, 'weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]', 'weirdjruby', '9.2.0.0'
1032
+
1033
+ assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
1034
+ ensure
1035
+ util_restore_RUBY_VERSION
1036
+ end
1037
+
1038
+ def test_self_ruby_version_with_trunk
1039
+ util_set_RUBY_VERSION '1.9.2', -1, 23493, 'ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]'
1040
+
1041
+ assert_equal Gem::Version.new('1.9.2.dev'), Gem.ruby_version
953
1042
  ensure
954
1043
  util_restore_RUBY_VERSION
955
1044
  end
@@ -1197,7 +1286,7 @@ class TestGem < Gem::TestCase
1197
1286
  end
1198
1287
 
1199
1288
  def test_self_user_home
1200
- if ENV['HOME'] then
1289
+ if ENV['HOME']
1201
1290
  assert_equal ENV['HOME'], Gem.user_home
1202
1291
  else
1203
1292
  assert true, 'count this test'
@@ -1223,13 +1312,12 @@ class TestGem < Gem::TestCase
1223
1312
  end
1224
1313
 
1225
1314
  def test_self_needs_picks_up_unresolved_deps
1226
- skip 'loading from unsafe file' if RUBY_VERSION <= "1.8.7"
1227
1315
  save_loaded_features do
1228
1316
  util_clear_gems
1229
1317
  a = util_spec "a", "1"
1230
1318
  b = util_spec "b", "1", "c" => nil
1231
1319
  c = util_spec "c", "2"
1232
- d = new_spec "d", "1", {'e' => '= 1'}, "lib/d.rb"
1320
+ d = util_spec "d", "1", {'e' => '= 1'}, "lib/d.rb"
1233
1321
  e = util_spec "e", "1"
1234
1322
 
1235
1323
  install_specs a, c, b, e, d
@@ -1252,9 +1340,6 @@ class TestGem < Gem::TestCase
1252
1340
  output = Gem::Util.gunzip input
1253
1341
 
1254
1342
  assert_equal 'hello', output
1255
-
1256
- return unless Object.const_defined? :Encoding
1257
-
1258
1343
  assert_equal Encoding::BINARY, output.encoding
1259
1344
  end
1260
1345
 
@@ -1266,55 +1351,9 @@ class TestGem < Gem::TestCase
1266
1351
  zipped = StringIO.new output
1267
1352
 
1268
1353
  assert_equal 'hello', Zlib::GzipReader.new(zipped).read
1269
-
1270
- return unless Object.const_defined? :Encoding
1271
-
1272
1354
  assert_equal Encoding::BINARY, output.encoding
1273
1355
  end
1274
1356
 
1275
- if Gem.win_platform? && '1.9' > RUBY_VERSION
1276
- # Ruby 1.9 properly handles ~ path expansion, so no need to run such tests.
1277
- def test_self_user_home_userprofile
1278
-
1279
- Gem.clear_paths
1280
-
1281
- # safe-keep env variables
1282
- orig_home, orig_user_profile = ENV['HOME'], ENV['USERPROFILE']
1283
-
1284
- # prepare for the test
1285
- ENV.delete('HOME')
1286
- ENV['USERPROFILE'] = "W:\\Users\\RubyUser"
1287
-
1288
- assert_equal 'W:/Users/RubyUser', Gem.user_home
1289
-
1290
- ensure
1291
- ENV['HOME'] = orig_home
1292
- ENV['USERPROFILE'] = orig_user_profile
1293
- end
1294
-
1295
- def test_self_user_home_user_drive_and_path
1296
- Gem.clear_paths
1297
-
1298
- # safe-keep env variables
1299
- orig_home, orig_user_profile = ENV['HOME'], ENV['USERPROFILE']
1300
- orig_home_drive, orig_home_path = ENV['HOMEDRIVE'], ENV['HOMEPATH']
1301
-
1302
- # prepare the environment
1303
- ENV.delete('HOME')
1304
- ENV.delete('USERPROFILE')
1305
- ENV['HOMEDRIVE'] = 'Z:'
1306
- ENV['HOMEPATH'] = "\\Users\\RubyUser"
1307
-
1308
- assert_equal 'Z:/Users/RubyUser', Gem.user_home
1309
-
1310
- ensure
1311
- ENV['HOME'] = orig_home
1312
- ENV['USERPROFILE'] = orig_user_profile
1313
- ENV['HOMEDRIVE'] = orig_home_drive
1314
- ENV['HOMEPATH'] = orig_home_path
1315
- end
1316
- end
1317
-
1318
1357
  def test_self_vendor_dir
1319
1358
  expected =
1320
1359
  File.join RbConfig::CONFIG['vendordir'], 'gems',
@@ -1340,7 +1379,6 @@ class TestGem < Gem::TestCase
1340
1379
  end
1341
1380
 
1342
1381
  def test_load_plugins
1343
- skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
1344
1382
  plugin_path = File.join "lib", "rubygems_plugin.rb"
1345
1383
 
1346
1384
  Dir.chdir @tempdir do
@@ -1395,8 +1433,8 @@ class TestGem < Gem::TestCase
1395
1433
  write_file File.join(@tempdir, 'lib', "g.rb") { |fp| fp.puts "" }
1396
1434
  write_file File.join(@tempdir, 'lib', 'm.rb') { |fp| fp.puts "" }
1397
1435
 
1398
- g = new_spec 'g', '1', nil, "lib/g.rb"
1399
- m = new_spec 'm', '1', nil, "lib/m.rb"
1436
+ g = util_spec 'g', '1', nil, "lib/g.rb"
1437
+ m = util_spec 'm', '1', nil, "lib/m.rb"
1400
1438
 
1401
1439
  install_gem g, :install_dir => Gem.dir
1402
1440
  m0 = install_gem m, :install_dir => Gem.dir
@@ -1451,8 +1489,8 @@ class TestGem < Gem::TestCase
1451
1489
  write_file File.join(@tempdir, 'lib', "g.rb") { |fp| fp.puts "" }
1452
1490
  write_file File.join(@tempdir, 'lib', 'm.rb') { |fp| fp.puts "" }
1453
1491
 
1454
- g = new_spec 'g', '1', nil, "lib/g.rb"
1455
- m = new_spec 'm', '1', nil, "lib/m.rb"
1492
+ g = util_spec 'g', '1', nil, "lib/g.rb"
1493
+ m = util_spec 'm', '1', nil, "lib/m.rb"
1456
1494
 
1457
1495
  install_gem g, :install_dir => Gem.dir
1458
1496
  install_gem m, :install_dir => Gem.dir
@@ -1469,9 +1507,9 @@ class TestGem < Gem::TestCase
1469
1507
  def test_auto_activation_of_specific_gemdeps_file
1470
1508
  util_clear_gems
1471
1509
 
1472
- a = new_spec "a", "1", nil, "lib/a.rb"
1473
- b = new_spec "b", "1", nil, "lib/b.rb"
1474
- c = new_spec "c", "1", nil, "lib/c.rb"
1510
+ a = util_spec "a", "1", nil, "lib/a.rb"
1511
+ b = util_spec "b", "1", nil, "lib/b.rb"
1512
+ c = util_spec "c", "1", nil, "lib/c.rb"
1475
1513
 
1476
1514
  install_specs a, b, c
1477
1515
 
@@ -1491,12 +1529,11 @@ class TestGem < Gem::TestCase
1491
1529
  end
1492
1530
 
1493
1531
  def test_auto_activation_of_used_gemdeps_file
1494
- skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
1495
1532
  util_clear_gems
1496
1533
 
1497
- a = new_spec "a", "1", nil, "lib/a.rb"
1498
- b = new_spec "b", "1", nil, "lib/b.rb"
1499
- c = new_spec "c", "1", nil, "lib/c.rb"
1534
+ a = util_spec "a", "1", nil, "lib/a.rb"
1535
+ b = util_spec "b", "1", nil, "lib/b.rb"
1536
+ c = util_spec "c", "1", nil, "lib/c.rb"
1500
1537
 
1501
1538
  install_specs a, b, c
1502
1539
 
@@ -1518,7 +1555,7 @@ class TestGem < Gem::TestCase
1518
1555
 
1519
1556
  if Gem::USE_BUNDLER_FOR_GEMDEPS
1520
1557
  BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.untaint
1521
- BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}"
1558
+ BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}".freeze
1522
1559
  end
1523
1560
 
1524
1561
  def add_bundler_full_name(names)
@@ -1531,9 +1568,9 @@ class TestGem < Gem::TestCase
1531
1568
  def test_looks_for_gemdeps_files_automatically_on_start
1532
1569
  util_clear_gems
1533
1570
 
1534
- a = new_spec "a", "1", nil, "lib/a.rb"
1535
- b = new_spec "b", "1", nil, "lib/b.rb"
1536
- c = new_spec "c", "1", nil, "lib/c.rb"
1571
+ a = util_spec "a", "1", nil, "lib/a.rb"
1572
+ b = util_spec "b", "1", nil, "lib/b.rb"
1573
+ c = util_spec "c", "1", nil, "lib/c.rb"
1537
1574
 
1538
1575
  install_specs a, b, c
1539
1576
 
@@ -1548,12 +1585,7 @@ class TestGem < Gem::TestCase
1548
1585
  path = File.join @tempdir, "gem.deps.rb"
1549
1586
  cmd = [Gem.ruby.dup.untaint, "-I#{LIB_PATH.untaint}",
1550
1587
  "-I#{BUNDLER_LIB_PATH.untaint}", "-rrubygems"]
1551
- if RUBY_VERSION < '1.9'
1552
- cmd << "-e 'puts Gem.loaded_specs.values.map(&:full_name).sort'"
1553
- cmd = cmd.join(' ')
1554
- else
1555
- cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
1556
- end
1588
+ cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
1557
1589
 
1558
1590
  File.open path, "w" do |f|
1559
1591
  f.puts "gem 'a'"
@@ -1572,9 +1604,9 @@ class TestGem < Gem::TestCase
1572
1604
  def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
1573
1605
  util_clear_gems
1574
1606
 
1575
- a = new_spec "a", "1", nil, "lib/a.rb"
1576
- b = new_spec "b", "1", nil, "lib/b.rb"
1577
- c = new_spec "c", "1", nil, "lib/c.rb"
1607
+ a = util_spec "a", "1", nil, "lib/a.rb"
1608
+ b = util_spec "b", "1", nil, "lib/b.rb"
1609
+ c = util_spec "c", "1", nil, "lib/c.rb"
1578
1610
 
1579
1611
  install_specs a, b, c
1580
1612
 
@@ -1591,12 +1623,7 @@ class TestGem < Gem::TestCase
1591
1623
  path = File.join @tempdir, "gem.deps.rb"
1592
1624
  cmd = [Gem.ruby.dup.untaint, "-Csub1", "-I#{LIB_PATH.untaint}",
1593
1625
  "-I#{BUNDLER_LIB_PATH.untaint}", "-rrubygems"]
1594
- if RUBY_VERSION < '1.9'
1595
- cmd << "-e 'puts Gem.loaded_specs.values.map(&:full_name).sort'"
1596
- cmd = cmd.join(' ')
1597
- else
1598
- cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
1599
- end
1626
+ cmd << "-eputs Gem.loaded_specs.values.map(&:full_name).sort"
1600
1627
 
1601
1628
  File.open path, "w" do |f|
1602
1629
  f.puts "gem 'a'"
@@ -1644,7 +1671,7 @@ class TestGem < Gem::TestCase
1644
1671
 
1645
1672
  def test_default_gems_use_full_paths
1646
1673
  begin
1647
- if defined?(RUBY_ENGINE) then
1674
+ if defined?(RUBY_ENGINE)
1648
1675
  engine = RUBY_ENGINE
1649
1676
  Object.send :remove_const, :RUBY_ENGINE
1650
1677
  end
@@ -1657,7 +1684,7 @@ class TestGem < Gem::TestCase
1657
1684
  end
1658
1685
 
1659
1686
  begin
1660
- if defined?(RUBY_ENGINE) then
1687
+ if defined?(RUBY_ENGINE)
1661
1688
  engine = RUBY_ENGINE
1662
1689
  Object.send :remove_const, :RUBY_ENGINE
1663
1690
  end
@@ -1731,7 +1758,6 @@ class TestGem < Gem::TestCase
1731
1758
  end
1732
1759
 
1733
1760
  def test_use_gemdeps_automatic
1734
- skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
1735
1761
  rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
1736
1762
 
1737
1763
  spec = util_spec 'a', 1
@@ -1752,7 +1778,6 @@ class TestGem < Gem::TestCase
1752
1778
  end
1753
1779
 
1754
1780
  def test_use_gemdeps_automatic_missing
1755
- skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
1756
1781
  rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
1757
1782
 
1758
1783
  Gem.use_gemdeps
@@ -1781,7 +1806,6 @@ class TestGem < Gem::TestCase
1781
1806
  end
1782
1807
 
1783
1808
  def test_use_gemdeps_missing_gem
1784
- skip 'Insecure operation - read' if RUBY_VERSION <= "1.8.7"
1785
1809
  rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
1786
1810
 
1787
1811
  File.open 'x', 'w' do |io|
@@ -1794,19 +1818,20 @@ class TestGem < Gem::TestCase
1794
1818
  else
1795
1819
  platform = " #{platform}"
1796
1820
  end
1797
- expected = if Gem::USE_BUNDLER_FOR_GEMDEPS
1798
- <<-EXPECTED
1821
+ expected =
1822
+ if Gem::USE_BUNDLER_FOR_GEMDEPS
1823
+ <<-EXPECTED
1799
1824
  Could not find gem 'a#{platform}' in any of the gem sources listed in your Gemfile.
1800
1825
  You may need to `gem install -g` to install missing gems
1801
1826
 
1802
- EXPECTED
1803
- else
1804
- <<-EXPECTED
1827
+ EXPECTED
1828
+ else
1829
+ <<-EXPECTED
1805
1830
  Unable to resolve dependency: user requested 'a (>= 0)'
1806
1831
  You may need to `gem install -g` to install missing gems
1807
1832
 
1808
- EXPECTED
1809
- end
1833
+ EXPECTED
1834
+ end
1810
1835
 
1811
1836
  assert_output nil, expected do
1812
1837
  Gem.use_gemdeps
@@ -1816,7 +1841,6 @@ You may need to `gem install -g` to install missing gems
1816
1841
  end if Gem::USE_BUNDLER_FOR_GEMDEPS
1817
1842
 
1818
1843
  def test_use_gemdeps_specific
1819
- skip 'Insecure operation - read' if RUBY_VERSION <= "1.8.7"
1820
1844
  rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
1821
1845
 
1822
1846
  spec = util_spec 'a', 1
@@ -1836,6 +1860,13 @@ You may need to `gem install -g` to install missing gems
1836
1860
  ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
1837
1861
  end
1838
1862
 
1863
+ def test_operating_system_defaults
1864
+ operating_system_defaults = Gem.operating_system_defaults
1865
+
1866
+ assert operating_system_defaults != nil
1867
+ assert operating_system_defaults.is_a? Hash
1868
+ end
1869
+
1839
1870
  def test_platform_defaults
1840
1871
  platform_defaults = Gem.platform_defaults
1841
1872
 
@@ -1843,13 +1874,13 @@ You may need to `gem install -g` to install missing gems
1843
1874
  assert platform_defaults.is_a? Hash
1844
1875
  end
1845
1876
 
1846
- def ruby_install_name name
1877
+ def ruby_install_name(name)
1847
1878
  orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
1848
1879
  RbConfig::CONFIG['ruby_install_name'] = name
1849
1880
 
1850
1881
  yield
1851
1882
  ensure
1852
- if orig_RUBY_INSTALL_NAME then
1883
+ if orig_RUBY_INSTALL_NAME
1853
1884
  RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
1854
1885
  else
1855
1886
  RbConfig::CONFIG.delete 'ruby_install_name'