rubygems-update 3.2.30 → 3.4.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (641) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1666 -994
  3. data/CONTRIBUTING.md +71 -15
  4. data/Manifest.txt +93 -37
  5. data/POLICIES.md +65 -16
  6. data/README.md +28 -13
  7. data/UPGRADING.md +5 -81
  8. data/bin/gem +2 -10
  9. data/bin/update_rubygems +5 -5
  10. data/bundler/CHANGELOG.md +647 -1
  11. data/bundler/README.md +3 -6
  12. data/bundler/UPGRADING.md +11 -4
  13. data/bundler/bundler.gemspec +8 -10
  14. data/bundler/exe/bundle +7 -11
  15. data/bundler/exe/bundler +1 -1
  16. data/bundler/lib/bundler/.document +1 -0
  17. data/bundler/lib/bundler/build_metadata.rb +3 -3
  18. data/bundler/lib/bundler/cli/add.rb +1 -1
  19. data/bundler/lib/bundler/cli/binstubs.rb +5 -1
  20. data/bundler/lib/bundler/cli/check.rb +1 -1
  21. data/bundler/lib/bundler/cli/common.rb +4 -2
  22. data/bundler/lib/bundler/cli/config.rb +10 -1
  23. data/bundler/lib/bundler/cli/console.rb +2 -2
  24. data/bundler/lib/bundler/cli/doctor.rb +10 -3
  25. data/bundler/lib/bundler/cli/gem.rb +136 -42
  26. data/bundler/lib/bundler/cli/info.rb +17 -3
  27. data/bundler/lib/bundler/cli/init.rb +6 -2
  28. data/bundler/lib/bundler/cli/install.rb +15 -33
  29. data/bundler/lib/bundler/cli/lock.rb +8 -5
  30. data/bundler/lib/bundler/cli/open.rb +6 -4
  31. data/bundler/lib/bundler/cli/outdated.rb +13 -6
  32. data/bundler/lib/bundler/cli/platform.rb +2 -2
  33. data/bundler/lib/bundler/cli/show.rb +1 -1
  34. data/bundler/lib/bundler/cli/update.rb +8 -4
  35. data/bundler/lib/bundler/cli/viz.rb +1 -1
  36. data/bundler/lib/bundler/cli.rb +67 -21
  37. data/bundler/lib/bundler/compact_index_client/cache.rb +1 -10
  38. data/bundler/lib/bundler/compact_index_client/updater.rb +53 -44
  39. data/bundler/lib/bundler/compact_index_client.rb +0 -6
  40. data/bundler/lib/bundler/constants.rb +1 -1
  41. data/bundler/lib/bundler/current_ruby.rb +18 -6
  42. data/bundler/lib/bundler/definition.rb +259 -242
  43. data/bundler/lib/bundler/dependency.rb +24 -71
  44. data/bundler/lib/bundler/digest.rb +1 -1
  45. data/bundler/lib/bundler/dsl.rb +29 -46
  46. data/bundler/lib/bundler/endpoint_specification.rb +15 -13
  47. data/bundler/lib/bundler/env.rb +2 -2
  48. data/bundler/lib/bundler/environment_preserver.rb +7 -3
  49. data/bundler/lib/bundler/errors.rb +15 -15
  50. data/bundler/lib/bundler/feature_flag.rb +0 -1
  51. data/bundler/lib/bundler/fetcher/base.rb +6 -8
  52. data/bundler/lib/bundler/fetcher/compact_index.rb +18 -25
  53. data/bundler/lib/bundler/fetcher/dependency.rb +2 -6
  54. data/bundler/lib/bundler/fetcher/downloader.rb +2 -5
  55. data/bundler/lib/bundler/fetcher/index.rb +0 -26
  56. data/bundler/lib/bundler/fetcher.rb +22 -29
  57. data/bundler/lib/bundler/force_platform.rb +18 -0
  58. data/bundler/lib/bundler/friendly_errors.rb +21 -7
  59. data/bundler/lib/bundler/gem_helper.rb +4 -4
  60. data/bundler/lib/bundler/gem_helpers.rb +9 -2
  61. data/bundler/lib/bundler/gem_version_promoter.rb +53 -98
  62. data/bundler/lib/bundler/graph.rb +3 -3
  63. data/bundler/lib/bundler/index.rb +13 -51
  64. data/bundler/lib/bundler/injector.rb +18 -4
  65. data/bundler/lib/bundler/inline.rb +9 -21
  66. data/bundler/lib/bundler/installer/gem_installer.rb +13 -5
  67. data/bundler/lib/bundler/installer/parallel_installer.rb +3 -33
  68. data/bundler/lib/bundler/installer/standalone.rb +42 -11
  69. data/bundler/lib/bundler/installer.rb +20 -44
  70. data/bundler/lib/bundler/lazy_specification.rb +72 -55
  71. data/bundler/lib/bundler/lockfile_generator.rb +3 -3
  72. data/bundler/lib/bundler/lockfile_parser.rb +28 -26
  73. data/bundler/lib/bundler/man/bundle-add.1 +21 -5
  74. data/bundler/lib/bundler/man/bundle-add.1.ronn +16 -4
  75. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  76. data/bundler/lib/bundler/man/bundle-cache.1 +7 -1
  77. data/bundler/lib/bundler/man/bundle-cache.1.ronn +7 -0
  78. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  79. data/bundler/lib/bundler/man/bundle-clean.1 +2 -2
  80. data/bundler/lib/bundler/man/bundle-clean.1.ronn +1 -1
  81. data/bundler/lib/bundler/man/bundle-config.1 +34 -15
  82. data/bundler/lib/bundler/man/bundle-config.1.ronn +31 -19
  83. data/bundler/lib/bundler/man/bundle-console.1 +53 -0
  84. data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
  85. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  86. data/bundler/lib/bundler/man/bundle-exec.1 +6 -6
  87. data/bundler/lib/bundler/man/bundle-exec.1.ronn +6 -6
  88. data/bundler/lib/bundler/man/bundle-gem.1 +37 -34
  89. data/bundler/lib/bundler/man/bundle-gem.1.ronn +21 -5
  90. data/bundler/lib/bundler/man/bundle-help.1 +13 -0
  91. data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
  92. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  93. data/bundler/lib/bundler/man/bundle-init.1 +5 -1
  94. data/bundler/lib/bundler/man/bundle-init.1.ronn +2 -0
  95. data/bundler/lib/bundler/man/bundle-inject.1 +5 -2
  96. data/bundler/lib/bundler/man/bundle-inject.1.ronn +3 -1
  97. data/bundler/lib/bundler/man/bundle-install.1 +6 -31
  98. data/bundler/lib/bundler/man/bundle-install.1.ronn +8 -31
  99. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  100. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  101. data/bundler/lib/bundler/man/bundle-open.1 +22 -2
  102. data/bundler/lib/bundler/man/bundle-open.1.ronn +9 -1
  103. data/bundler/lib/bundler/man/bundle-outdated.1 +3 -10
  104. data/bundler/lib/bundler/man/bundle-outdated.1.ronn +1 -10
  105. data/bundler/lib/bundler/man/bundle-platform.1 +16 -6
  106. data/bundler/lib/bundler/man/bundle-platform.1.ronn +14 -7
  107. data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
  108. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  109. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  110. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  111. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  112. data/bundler/lib/bundler/man/bundle-update.1 +2 -2
  113. data/bundler/lib/bundler/man/bundle-update.1.ronn +2 -1
  114. data/bundler/lib/bundler/man/bundle-version.1 +35 -0
  115. data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
  116. data/bundler/lib/bundler/man/bundle-viz.1 +4 -1
  117. data/bundler/lib/bundler/man/bundle-viz.1.ronn +2 -0
  118. data/bundler/lib/bundler/man/bundle.1 +15 -10
  119. data/bundler/lib/bundler/man/bundle.1.ronn +12 -7
  120. data/bundler/lib/bundler/man/gemfile.5 +117 -80
  121. data/bundler/lib/bundler/man/gemfile.5.ronn +105 -84
  122. data/bundler/lib/bundler/man/index.txt +4 -0
  123. data/bundler/lib/bundler/match_metadata.rb +13 -0
  124. data/bundler/lib/bundler/match_platform.rb +0 -1
  125. data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
  126. data/bundler/lib/bundler/mirror.rb +5 -7
  127. data/bundler/lib/bundler/plugin/api/source.rb +4 -9
  128. data/bundler/lib/bundler/plugin/index.rb +4 -4
  129. data/bundler/lib/bundler/plugin/installer/git.rb +0 -4
  130. data/bundler/lib/bundler/plugin/installer/rubygems.rb +0 -8
  131. data/bundler/lib/bundler/plugin/installer.rb +6 -3
  132. data/bundler/lib/bundler/plugin.rb +3 -1
  133. data/bundler/lib/bundler/process_lock.rb +1 -1
  134. data/bundler/lib/bundler/remote_specification.rb +7 -5
  135. data/bundler/lib/bundler/resolver/base.rb +109 -0
  136. data/bundler/lib/bundler/resolver/candidate.rb +94 -0
  137. data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
  138. data/bundler/lib/bundler/resolver/package.rb +72 -0
  139. data/bundler/lib/bundler/resolver/root.rb +25 -0
  140. data/bundler/lib/bundler/resolver/spec_group.rb +43 -71
  141. data/bundler/lib/bundler/resolver.rb +332 -308
  142. data/bundler/lib/bundler/ruby_dsl.rb +1 -1
  143. data/bundler/lib/bundler/ruby_version.rb +5 -18
  144. data/bundler/lib/bundler/rubygems_ext.rb +144 -25
  145. data/bundler/lib/bundler/rubygems_gem_installer.rb +32 -20
  146. data/bundler/lib/bundler/rubygems_integration.rb +24 -95
  147. data/bundler/lib/bundler/runtime.rb +2 -7
  148. data/bundler/lib/bundler/self_manager.rb +168 -0
  149. data/bundler/lib/bundler/settings.rb +5 -10
  150. data/bundler/lib/bundler/setup.rb +4 -1
  151. data/bundler/lib/bundler/shared_helpers.rb +17 -25
  152. data/bundler/lib/bundler/source/git/git_proxy.rb +219 -71
  153. data/bundler/lib/bundler/source/git.rb +23 -26
  154. data/bundler/lib/bundler/source/metadata.rb +3 -4
  155. data/bundler/lib/bundler/source/path/installer.rb +1 -22
  156. data/bundler/lib/bundler/source/path.rb +7 -7
  157. data/bundler/lib/bundler/source/rubygems.rb +91 -130
  158. data/bundler/lib/bundler/source/rubygems_aggregate.rb +1 -1
  159. data/bundler/lib/bundler/source.rb +4 -5
  160. data/bundler/lib/bundler/source_list.rb +19 -31
  161. data/bundler/lib/bundler/source_map.rb +15 -2
  162. data/bundler/lib/bundler/spec_set.rb +63 -35
  163. data/bundler/lib/bundler/stub_specification.rb +5 -3
  164. data/bundler/lib/bundler/templates/Executable +3 -5
  165. data/bundler/lib/bundler/templates/Executable.bundler +6 -11
  166. data/bundler/lib/bundler/templates/Executable.standalone +4 -4
  167. data/bundler/lib/bundler/templates/Gemfile +0 -2
  168. data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  169. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +8 -2
  170. data/bundler/lib/bundler/templates/newgem/README.md.tt +7 -11
  171. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +27 -3
  172. data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  173. data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  174. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  175. data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  176. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +13 -3
  177. data/bundler/lib/bundler/templates/newgem/gitignore.tt +3 -0
  178. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
  179. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +22 -16
  180. data/bundler/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  181. data/bundler/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  182. data/bundler/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  183. data/bundler/lib/bundler/ui/shell.rb +36 -13
  184. data/bundler/lib/bundler/ui/silent.rb +21 -5
  185. data/bundler/lib/bundler/uri_normalizer.rb +23 -0
  186. data/bundler/lib/bundler/vendor/.document +1 -0
  187. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +3 -3
  188. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +0 -1
  189. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -1
  190. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
  191. data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  192. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
  193. data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  194. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  195. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  196. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  197. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
  198. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  199. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  200. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  201. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  202. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
  203. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  204. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  205. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
  206. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
  207. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +243 -0
  208. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  209. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  210. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
  211. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  212. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
  213. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  214. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
  215. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
  216. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +23 -5
  217. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  218. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  219. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  220. data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  221. data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
  222. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +76 -91
  223. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
  224. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
  225. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +32 -13
  226. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
  227. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
  228. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
  229. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
  230. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
  231. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +14 -21
  232. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +11 -17
  233. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  234. data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
  235. data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
  236. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +3 -3
  237. data/bundler/lib/bundler/vendored_persistent.rb +1 -33
  238. data/bundler/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
  239. data/bundler/lib/bundler/{vendored_tmpdir.rb → vendored_tsort.rb} +1 -1
  240. data/bundler/lib/bundler/version.rb +5 -1
  241. data/bundler/lib/bundler/worker.rb +5 -7
  242. data/bundler/lib/bundler.rb +50 -77
  243. data/hide_lib_for_update/note.txt +0 -4
  244. data/lib/rubygems/available_set.rb +3 -3
  245. data/lib/rubygems/basic_specification.rb +12 -12
  246. data/lib/rubygems/bundler_version_finder.rb +14 -46
  247. data/lib/rubygems/command.rb +47 -39
  248. data/lib/rubygems/command_manager.rb +34 -13
  249. data/lib/rubygems/commands/build_command.rb +11 -8
  250. data/lib/rubygems/commands/cert_command.rb +39 -39
  251. data/lib/rubygems/commands/check_command.rb +20 -20
  252. data/lib/rubygems/commands/cleanup_command.rb +23 -23
  253. data/lib/rubygems/commands/contents_command.rb +13 -13
  254. data/lib/rubygems/commands/dependency_command.rb +35 -45
  255. data/lib/rubygems/commands/environment_command.rb +10 -7
  256. data/lib/rubygems/commands/exec_command.rb +248 -0
  257. data/lib/rubygems/commands/fetch_command.rb +32 -13
  258. data/lib/rubygems/commands/generate_index_command.rb +17 -17
  259. data/lib/rubygems/commands/help_command.rb +6 -6
  260. data/lib/rubygems/commands/info_command.rb +3 -3
  261. data/lib/rubygems/commands/install_command.rb +31 -24
  262. data/lib/rubygems/commands/list_command.rb +4 -4
  263. data/lib/rubygems/commands/lock_command.rb +4 -4
  264. data/lib/rubygems/commands/mirror_command.rb +3 -3
  265. data/lib/rubygems/commands/open_command.rb +9 -9
  266. data/lib/rubygems/commands/outdated_command.rb +5 -5
  267. data/lib/rubygems/commands/owner_command.rb +17 -12
  268. data/lib/rubygems/commands/pristine_command.rb +64 -49
  269. data/lib/rubygems/commands/push_command.rb +16 -16
  270. data/lib/rubygems/commands/query_command.rb +9 -9
  271. data/lib/rubygems/commands/rdoc_command.rb +26 -25
  272. data/lib/rubygems/commands/search_command.rb +4 -4
  273. data/lib/rubygems/commands/server_command.rb +16 -79
  274. data/lib/rubygems/commands/setup_command.rb +172 -173
  275. data/lib/rubygems/commands/signin_command.rb +9 -9
  276. data/lib/rubygems/commands/signout_command.rb +7 -7
  277. data/lib/rubygems/commands/sources_command.rb +22 -22
  278. data/lib/rubygems/commands/specification_command.rb +18 -18
  279. data/lib/rubygems/commands/stale_command.rb +2 -2
  280. data/lib/rubygems/commands/uninstall_command.rb +43 -40
  281. data/lib/rubygems/commands/unpack_command.rb +13 -13
  282. data/lib/rubygems/commands/update_command.rb +61 -72
  283. data/lib/rubygems/commands/which_command.rb +7 -7
  284. data/lib/rubygems/commands/yank_command.rb +11 -11
  285. data/lib/rubygems/compatibility.rb +4 -2
  286. data/lib/rubygems/config_file.rb +58 -25
  287. data/lib/rubygems/core_ext/kernel_gem.rb +1 -6
  288. data/lib/rubygems/core_ext/kernel_require.rb +108 -115
  289. data/lib/rubygems/core_ext/kernel_warn.rb +33 -37
  290. data/lib/rubygems/core_ext/tcpsocket_init.rb +1 -1
  291. data/lib/rubygems/defaults.rb +32 -36
  292. data/lib/rubygems/dependency.rb +20 -17
  293. data/lib/rubygems/dependency_installer.rb +37 -37
  294. data/lib/rubygems/dependency_list.rb +7 -7
  295. data/lib/rubygems/deprecate.rb +55 -8
  296. data/lib/rubygems/doctor.rb +21 -21
  297. data/lib/rubygems/errors.rb +3 -6
  298. data/lib/rubygems/exceptions.rb +35 -7
  299. data/lib/rubygems/ext/build_error.rb +1 -1
  300. data/lib/rubygems/ext/builder.rb +51 -22
  301. data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +27 -0
  302. data/lib/rubygems/ext/cargo_builder.rb +360 -0
  303. data/lib/rubygems/ext/cmake_builder.rb +2 -2
  304. data/lib/rubygems/ext/configure_builder.rb +1 -1
  305. data/lib/rubygems/ext/ext_conf_builder.rb +35 -59
  306. data/lib/rubygems/ext/rake_builder.rb +3 -3
  307. data/lib/rubygems/ext.rb +7 -6
  308. data/lib/rubygems/gem_runner.rb +12 -16
  309. data/lib/rubygems/gemcutter_utilities.rb +60 -21
  310. data/lib/rubygems/indexer.rb +30 -28
  311. data/lib/rubygems/install_default_message.rb +2 -2
  312. data/lib/rubygems/install_message.rb +2 -2
  313. data/lib/rubygems/install_update_options.rb +70 -61
  314. data/lib/rubygems/installer.rb +135 -87
  315. data/lib/rubygems/installer_uninstaller_utils.rb +2 -2
  316. data/lib/rubygems/local_remote_options.rb +22 -24
  317. data/lib/rubygems/mock_gem_ui.rb +2 -2
  318. data/lib/rubygems/name_tuple.rb +6 -7
  319. data/lib/rubygems/optparse/.document +1 -0
  320. data/lib/rubygems/optparse/COPYING +56 -0
  321. data/lib/rubygems/optparse/lib/optionparser.rb +2 -0
  322. data/lib/rubygems/optparse/lib/optparse/ac.rb +54 -0
  323. data/lib/rubygems/optparse/lib/optparse/date.rb +18 -0
  324. data/lib/rubygems/optparse/lib/optparse/kwargs.rb +22 -0
  325. data/lib/rubygems/optparse/lib/optparse/shellwords.rb +7 -0
  326. data/lib/rubygems/optparse/lib/optparse/time.rb +11 -0
  327. data/lib/rubygems/optparse/lib/optparse/uri.rb +7 -0
  328. data/lib/rubygems/optparse/lib/optparse/version.rb +71 -0
  329. data/lib/rubygems/optparse/lib/optparse.rb +2308 -0
  330. data/lib/rubygems/optparse.rb +3 -0
  331. data/lib/rubygems/package/file_source.rb +2 -2
  332. data/lib/rubygems/package/old.rb +9 -9
  333. data/lib/rubygems/package/tar_header.rb +62 -62
  334. data/lib/rubygems/package/tar_reader/entry.rb +90 -9
  335. data/lib/rubygems/package/tar_reader.rb +1 -29
  336. data/lib/rubygems/package/tar_writer.rb +7 -7
  337. data/lib/rubygems/package.rb +77 -60
  338. data/lib/rubygems/package_task.rb +4 -4
  339. data/lib/rubygems/path_support.rb +1 -6
  340. data/lib/rubygems/platform.rb +94 -61
  341. data/lib/rubygems/psych_tree.rb +1 -1
  342. data/lib/rubygems/query_utils.rb +49 -51
  343. data/lib/rubygems/rdoc.rb +2 -2
  344. data/lib/rubygems/remote_fetcher.rb +27 -27
  345. data/lib/rubygems/request/connection_pools.rb +4 -4
  346. data/lib/rubygems/request/http_pool.rb +1 -1
  347. data/lib/rubygems/request.rb +24 -24
  348. data/lib/rubygems/request_set/gem_dependency_api.rb +122 -123
  349. data/lib/rubygems/request_set/lockfile/parser.rb +26 -26
  350. data/lib/rubygems/request_set/lockfile/tokenizer.rb +4 -4
  351. data/lib/rubygems/request_set/lockfile.rb +9 -9
  352. data/lib/rubygems/request_set.rb +18 -18
  353. data/lib/rubygems/requirement.rb +15 -15
  354. data/lib/rubygems/resolver/activation_request.rb +3 -3
  355. data/lib/rubygems/resolver/api_set.rb +4 -4
  356. data/lib/rubygems/resolver/api_specification.rb +6 -6
  357. data/lib/rubygems/resolver/best_set.rb +5 -5
  358. data/lib/rubygems/resolver/conflict.rb +10 -10
  359. data/lib/rubygems/resolver/dependency_request.rb +2 -2
  360. data/lib/rubygems/resolver/git_set.rb +2 -2
  361. data/lib/rubygems/resolver/git_specification.rb +6 -6
  362. data/lib/rubygems/resolver/index_set.rb +3 -3
  363. data/lib/rubygems/resolver/index_specification.rb +6 -5
  364. data/lib/rubygems/resolver/installed_specification.rb +4 -4
  365. data/lib/rubygems/resolver/installer_set.rb +21 -26
  366. data/lib/rubygems/resolver/local_specification.rb +2 -2
  367. data/lib/rubygems/resolver/lock_set.rb +4 -4
  368. data/lib/rubygems/resolver/lock_specification.rb +4 -4
  369. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +3 -3
  370. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +32 -26
  371. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  372. data/lib/rubygems/resolver/molinillo.rb +1 -1
  373. data/lib/rubygems/resolver/specification.rb +1 -1
  374. data/lib/rubygems/resolver/stats.rb +1 -1
  375. data/lib/rubygems/resolver/vendor_set.rb +1 -1
  376. data/lib/rubygems/resolver/vendor_specification.rb +3 -3
  377. data/lib/rubygems/resolver.rb +40 -40
  378. data/lib/rubygems/s3_uri_signer.rb +6 -6
  379. data/lib/rubygems/safe_yaml.rb +10 -10
  380. data/lib/rubygems/security/policies.rb +47 -47
  381. data/lib/rubygems/security/policy.rb +19 -21
  382. data/lib/rubygems/security/signer.rb +5 -5
  383. data/lib/rubygems/security/trust_dir.rb +4 -4
  384. data/lib/rubygems/security.rb +37 -43
  385. data/lib/rubygems/security_option.rb +7 -7
  386. data/lib/rubygems/source/git.rb +25 -24
  387. data/lib/rubygems/source/installed.rb +1 -1
  388. data/lib/rubygems/source/local.rb +2 -2
  389. data/lib/rubygems/source/specific_file.rb +1 -1
  390. data/lib/rubygems/source.rb +27 -32
  391. data/lib/rubygems/source_list.rb +5 -9
  392. data/lib/rubygems/spec_fetcher.rb +37 -37
  393. data/lib/rubygems/specification.rb +265 -211
  394. data/lib/rubygems/specification_policy.rb +49 -30
  395. data/lib/rubygems/stub_specification.rb +24 -27
  396. data/lib/rubygems/text.rb +22 -21
  397. data/lib/rubygems/tsort/.document +1 -0
  398. data/lib/rubygems/tsort/LICENSE.txt +22 -0
  399. data/lib/rubygems/tsort/lib/tsort.rb +452 -0
  400. data/lib/rubygems/tsort.rb +3 -0
  401. data/lib/rubygems/uninstaller.rb +29 -26
  402. data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
  403. data/lib/rubygems/update_suggestion.rb +69 -0
  404. data/lib/rubygems/uri.rb +45 -30
  405. data/lib/rubygems/uri_formatter.rb +1 -1
  406. data/lib/rubygems/user_interaction.rb +42 -28
  407. data/lib/rubygems/util/licenses.rb +4 -2
  408. data/lib/rubygems/util.rb +12 -16
  409. data/lib/rubygems/validator.rb +6 -6
  410. data/lib/rubygems/version.rb +28 -17
  411. data/lib/rubygems/version_option.rb +5 -5
  412. data/lib/rubygems.rb +129 -117
  413. data/rubygems-update.gemspec +3 -3
  414. data/setup.rb +11 -16
  415. data/test/rubygems/alternate_cert.pem +14 -14
  416. data/test/rubygems/alternate_cert_32.pem +15 -15
  417. data/test/rubygems/alternate_key.pem +25 -25
  418. data/test/rubygems/bundler_test_gem.rb +419 -0
  419. data/test/rubygems/child_cert.pem +15 -16
  420. data/test/rubygems/child_cert_32.pem +15 -16
  421. data/test/rubygems/child_key.pem +25 -25
  422. data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
  423. data/test/rubygems/data/pry-0.4.7.gemspec.rz +0 -0
  424. data/test/rubygems/encrypted_private_key.pem +26 -26
  425. data/test/rubygems/expired_cert.pem +15 -15
  426. data/test/rubygems/future_cert.pem +15 -15
  427. data/test/rubygems/future_cert_32.pem +15 -15
  428. data/test/rubygems/grandchild_cert.pem +15 -16
  429. data/test/rubygems/grandchild_cert_32.pem +15 -16
  430. data/test/rubygems/grandchild_key.pem +25 -25
  431. data/test/rubygems/helper.rb +237 -207
  432. data/test/rubygems/installer_test_case.rb +13 -13
  433. data/test/rubygems/invalid_issuer_cert.pem +16 -16
  434. data/test/rubygems/invalid_issuer_cert_32.pem +16 -16
  435. data/test/rubygems/invalid_key.pem +25 -25
  436. data/test/rubygems/invalid_signer_cert.pem +15 -15
  437. data/test/rubygems/invalid_signer_cert_32.pem +15 -15
  438. data/test/rubygems/invalidchild_cert.pem +15 -16
  439. data/test/rubygems/invalidchild_cert_32.pem +15 -16
  440. data/test/rubygems/invalidchild_key.pem +25 -25
  441. data/test/rubygems/package/tar_test_case.rb +52 -17
  442. data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
  443. data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
  444. data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
  445. data/test/rubygems/private_key.pem +25 -25
  446. data/test/rubygems/public_cert.pem +16 -16
  447. data/test/rubygems/public_cert_32.pem +15 -15
  448. data/test/rubygems/public_key.pem +7 -7
  449. data/test/rubygems/rubygems_plugin.rb +2 -2
  450. data/test/rubygems/simple_gem.rb +1 -1
  451. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +4 -4
  452. data/test/rubygems/test_bundled_ca.rb +11 -11
  453. data/test/rubygems/test_config.rb +5 -5
  454. data/test/rubygems/test_deprecate.rb +3 -3
  455. data/test/rubygems/test_exit.rb +17 -0
  456. data/test/rubygems/test_gem.rb +367 -757
  457. data/test/rubygems/test_gem_available_set.rb +21 -21
  458. data/test/rubygems/test_gem_bundler_version_finder.rb +27 -47
  459. data/test/rubygems/test_gem_command.rb +45 -45
  460. data/test/rubygems/test_gem_command_manager.rb +124 -27
  461. data/test/rubygems/test_gem_commands_build_command.rb +73 -63
  462. data/test/rubygems/test_gem_commands_cert_command.rb +105 -107
  463. data/test/rubygems/test_gem_commands_check_command.rb +4 -4
  464. data/test/rubygems/test_gem_commands_cleanup_command.rb +40 -40
  465. data/test/rubygems/test_gem_commands_contents_command.rb +28 -28
  466. data/test/rubygems/test_gem_commands_dependency_command.rb +36 -36
  467. data/test/rubygems/test_gem_commands_environment_command.rb +38 -14
  468. data/test/rubygems/test_gem_commands_exec_command.rb +851 -0
  469. data/test/rubygems/test_gem_commands_fetch_command.rb +159 -26
  470. data/test/rubygems/test_gem_commands_generate_index_command.rb +7 -7
  471. data/test/rubygems/test_gem_commands_help_command.rb +13 -13
  472. data/test/rubygems/test_gem_commands_info_command.rb +28 -2
  473. data/test/rubygems/test_gem_commands_install_command.rb +200 -132
  474. data/test/rubygems/test_gem_commands_list_command.rb +4 -4
  475. data/test/rubygems/test_gem_commands_lock_command.rb +10 -10
  476. data/test/rubygems/test_gem_commands_mirror.rb +2 -2
  477. data/test/rubygems/test_gem_commands_open_command.rb +5 -5
  478. data/test/rubygems/test_gem_commands_outdated_command.rb +9 -9
  479. data/test/rubygems/test_gem_commands_owner_command.rb +126 -45
  480. data/test/rubygems/test_gem_commands_pristine_command.rb +141 -92
  481. data/test/rubygems/test_gem_commands_push_command.rb +85 -59
  482. data/test/rubygems/test_gem_commands_query_command.rb +73 -73
  483. data/test/rubygems/test_gem_commands_search_command.rb +2 -2
  484. data/test/rubygems/test_gem_commands_server_command.rb +6 -48
  485. data/test/rubygems/test_gem_commands_setup_command.rb +169 -92
  486. data/test/rubygems/test_gem_commands_signin_command.rb +154 -26
  487. data/test/rubygems/test_gem_commands_signout_command.rb +3 -3
  488. data/test/rubygems/test_gem_commands_sources_command.rb +74 -25
  489. data/test/rubygems/test_gem_commands_specification_command.rb +32 -32
  490. data/test/rubygems/test_gem_commands_stale_command.rb +4 -4
  491. data/test/rubygems/test_gem_commands_uninstall_command.rb +99 -82
  492. data/test/rubygems/test_gem_commands_unpack_command.rb +31 -31
  493. data/test/rubygems/test_gem_commands_update_command.rb +202 -91
  494. data/test/rubygems/test_gem_commands_which_command.rb +6 -6
  495. data/test/rubygems/test_gem_commands_yank_command.rb +43 -43
  496. data/test/rubygems/test_gem_config_file.rb +93 -81
  497. data/test/rubygems/test_gem_dependency.rb +78 -80
  498. data/test/rubygems/test_gem_dependency_installer.rb +165 -165
  499. data/test/rubygems/test_gem_dependency_list.rb +47 -47
  500. data/test/rubygems/test_gem_dependency_resolution_error.rb +4 -4
  501. data/test/rubygems/test_gem_doctor.rb +26 -26
  502. data/test/rubygems/test_gem_ext_builder.rb +60 -62
  503. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
  504. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +8 -0
  505. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +233 -0
  506. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml +10 -0
  507. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/src/lib.rs +27 -0
  508. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +1 -0
  509. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore +1 -0
  510. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +247 -0
  511. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +10 -0
  512. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec +8 -0
  513. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +51 -0
  514. data/test/rubygems/test_gem_ext_cargo_builder.rb +166 -0
  515. data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +33 -0
  516. data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +60 -0
  517. data/test/rubygems/test_gem_ext_cmake_builder.rb +17 -15
  518. data/test/rubygems/test_gem_ext_configure_builder.rb +13 -13
  519. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +53 -50
  520. data/test/rubygems/test_gem_ext_rake_builder.rb +15 -15
  521. data/test/rubygems/test_gem_gem_runner.rb +13 -8
  522. data/test/rubygems/test_gem_gemcutter_utilities.rb +71 -65
  523. data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -4
  524. data/test/rubygems/test_gem_indexer.rb +90 -67
  525. data/test/rubygems/test_gem_install_update_options.rb +18 -18
  526. data/test/rubygems/test_gem_installer.rb +511 -327
  527. data/test/rubygems/test_gem_local_remote_options.rb +10 -10
  528. data/test/rubygems/test_gem_name_tuple.rb +4 -4
  529. data/test/rubygems/test_gem_package.rb +246 -236
  530. data/test/rubygems/test_gem_package_old.rb +13 -13
  531. data/test/rubygems/test_gem_package_tar_header.rb +47 -47
  532. data/test/rubygems/test_gem_package_tar_reader.rb +55 -8
  533. data/test/rubygems/test_gem_package_tar_reader_entry.rb +161 -16
  534. data/test/rubygems/test_gem_package_tar_writer.rb +76 -76
  535. data/test/rubygems/test_gem_package_task.rb +18 -18
  536. data/test/rubygems/test_gem_path_support.rb +15 -19
  537. data/test/rubygems/test_gem_platform.rb +335 -214
  538. data/test/rubygems/test_gem_rdoc.rb +14 -14
  539. data/test/rubygems/test_gem_remote_fetcher.rb +169 -154
  540. data/test/rubygems/test_gem_request.rb +65 -59
  541. data/test/rubygems/test_gem_request_connection_pools.rb +29 -29
  542. data/test/rubygems/test_gem_request_set.rb +100 -100
  543. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +209 -211
  544. data/test/rubygems/test_gem_request_set_lockfile.rb +86 -86
  545. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +58 -58
  546. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +62 -62
  547. data/test/rubygems/test_gem_requirement.rb +47 -42
  548. data/test/rubygems/test_gem_resolver.rb +173 -106
  549. data/test/rubygems/test_gem_resolver_activation_request.rb +6 -6
  550. data/test/rubygems/test_gem_resolver_api_set.rb +33 -33
  551. data/test/rubygems/test_gem_resolver_api_specification.rb +47 -47
  552. data/test/rubygems/test_gem_resolver_best_set.rb +22 -22
  553. data/test/rubygems/test_gem_resolver_composed_set.rb +1 -1
  554. data/test/rubygems/test_gem_resolver_conflict.rb +12 -12
  555. data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -15
  556. data/test/rubygems/test_gem_resolver_git_set.rb +21 -21
  557. data/test/rubygems/test_gem_resolver_git_specification.rb +21 -21
  558. data/test/rubygems/test_gem_resolver_index_set.rb +12 -12
  559. data/test/rubygems/test_gem_resolver_index_specification.rb +16 -16
  560. data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -5
  561. data/test/rubygems/test_gem_resolver_installer_set.rb +79 -35
  562. data/test/rubygems/test_gem_resolver_local_specification.rb +7 -7
  563. data/test/rubygems/test_gem_resolver_lock_set.rb +12 -12
  564. data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -17
  565. data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -1
  566. data/test/rubygems/test_gem_resolver_specification.rb +8 -8
  567. data/test/rubygems/test_gem_resolver_vendor_set.rb +6 -6
  568. data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -10
  569. data/test/rubygems/test_gem_security.rb +69 -69
  570. data/test/rubygems/test_gem_security_policy.rb +72 -72
  571. data/test/rubygems/test_gem_security_signer.rb +34 -34
  572. data/test/rubygems/test_gem_security_trust_dir.rb +6 -6
  573. data/test/rubygems/test_gem_silent_ui.rb +38 -32
  574. data/test/rubygems/test_gem_source.rb +44 -44
  575. data/test/rubygems/test_gem_source_fetch_problem.rb +9 -9
  576. data/test/rubygems/test_gem_source_git.rb +69 -62
  577. data/test/rubygems/test_gem_source_installed.rb +16 -16
  578. data/test/rubygems/test_gem_source_list.rb +5 -5
  579. data/test/rubygems/test_gem_source_local.rb +14 -14
  580. data/test/rubygems/test_gem_source_lock.rb +31 -31
  581. data/test/rubygems/test_gem_source_specific_file.rb +17 -17
  582. data/test/rubygems/test_gem_source_subpath_problem.rb +7 -7
  583. data/test/rubygems/test_gem_source_vendor.rb +13 -13
  584. data/test/rubygems/test_gem_spec_fetcher.rb +72 -72
  585. data/test/rubygems/test_gem_specification.rb +560 -493
  586. data/test/rubygems/test_gem_stream_ui.rb +20 -20
  587. data/test/rubygems/test_gem_stub_specification.rb +32 -48
  588. data/test/rubygems/test_gem_text.rb +7 -1
  589. data/test/rubygems/test_gem_uninstaller.rb +113 -113
  590. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -3
  591. data/test/rubygems/test_gem_update_suggestion.rb +208 -0
  592. data/test/rubygems/test_gem_uri.rb +4 -4
  593. data/test/rubygems/test_gem_uri_formatter.rb +14 -14
  594. data/test/rubygems/test_gem_util.rb +23 -23
  595. data/test/rubygems/test_gem_validator.rb +8 -8
  596. data/test/rubygems/test_gem_version.rb +27 -16
  597. data/test/rubygems/test_gem_version_option.rb +15 -15
  598. data/test/rubygems/test_kernel.rb +42 -60
  599. data/test/rubygems/test_project_sanity.rb +2 -2
  600. data/test/rubygems/test_remote_fetch_error.rb +6 -6
  601. data/test/rubygems/test_require.rb +132 -174
  602. data/test/rubygems/test_rubygems.rb +42 -12
  603. data/test/rubygems/utilities.rb +59 -37
  604. data/test/rubygems/wrong_key_cert.pem +15 -15
  605. data/test/rubygems/wrong_key_cert_32.pem +15 -15
  606. data/test/test_changelog_generator.rb +1 -0
  607. metadata +97 -41
  608. data/bundler/lib/bundler/dep_proxy.rb +0 -55
  609. data/bundler/lib/bundler/gemdeps.rb +0 -29
  610. data/bundler/lib/bundler/psyched_yaml.rb +0 -22
  611. data/bundler/lib/bundler/templates/gems.rb +0 -8
  612. data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -6
  613. data/bundler/lib/bundler/vendor/molinillo/LICENSE +0 -9
  614. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  615. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
  616. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  617. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  618. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  619. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  620. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  621. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  622. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  623. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  624. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
  625. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
  626. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
  627. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  628. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
  629. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  630. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
  631. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  632. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  633. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
  634. data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
  635. data/bundler/lib/bundler/version_ranges.rb +0 -122
  636. data/lib/rubygems/psych_additions.rb +0 -10
  637. data/lib/rubygems/server.rb +0 -882
  638. data/test/rubygems/bogussources.rb +0 -9
  639. data/test/rubygems/data/null-type.gemspec.rz +0 -0
  640. data/test/rubygems/test_gem_server.rb +0 -608
  641. /data/bundler/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +0 -0
@@ -1,16 +1,16 @@
1
1
  # coding: US-ASCII
2
- require_relative 'helper'
3
- require 'rubygems'
4
- require 'rubygems/command'
5
- require 'rubygems/installer'
6
- require 'pathname'
7
- require 'tmpdir'
8
- require 'rbconfig'
2
+ require_relative "helper"
3
+ require "rubygems"
4
+ require "rubygems/command"
5
+ require "rubygems/installer"
6
+ require "pathname"
7
+ require "tmpdir"
8
+ require "rbconfig"
9
9
 
10
10
  class TestGem < Gem::TestCase
11
11
  PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
12
12
 
13
- PROJECT_DIR = File.expand_path('../../..', __FILE__).tap(&Gem::UNTAINT)
13
+ PROJECT_DIR = File.expand_path("../..", __dir__).tap(&Gem::UNTAINT)
14
14
 
15
15
  def setup
16
16
  super
@@ -89,32 +89,32 @@ class TestGem < Gem::TestCase
89
89
 
90
90
  def test_self_install
91
91
  spec_fetcher do |f|
92
- f.gem 'a', 1
93
- f.spec 'a', 2
92
+ f.gem "a", 1
93
+ f.spec "a", 2
94
94
  end
95
95
 
96
96
  gemhome2 = "#{@gemhome}2"
97
97
 
98
- installed = Gem.install 'a', '= 1', :install_dir => gemhome2
98
+ installed = Gem.install "a", "= 1", :install_dir => gemhome2
99
99
 
100
100
  assert_equal %w[a-1], installed.map {|spec| spec.full_name }
101
101
 
102
- assert_path_exist File.join(gemhome2, 'gems', 'a-1')
102
+ assert_path_exist File.join(gemhome2, "gems", "a-1")
103
103
  end
104
104
 
105
105
  def test_self_install_in_rescue
106
106
  spec_fetcher do |f|
107
- f.gem 'a', 1
108
- f.spec 'a', 2
107
+ f.gem "a", 1
108
+ f.spec "a", 2
109
109
  end
110
110
 
111
111
  gemhome2 = "#{@gemhome}2"
112
112
 
113
113
  installed =
114
114
  begin
115
- raise 'Error'
115
+ raise "Error"
116
116
  rescue StandardError
117
- Gem.install 'a', '= 1', :install_dir => gemhome2
117
+ Gem.install "a", "= 1", :install_dir => gemhome2
118
118
  end
119
119
  assert_equal %w[a-1], installed.map {|spec| spec.full_name }
120
120
  end
@@ -143,7 +143,7 @@ class TestGem < Gem::TestCase
143
143
 
144
144
  def test_self_install_permissions_with_format_executable_and_non_standard_ruby_install_name
145
145
  Gem::Installer.exec_format = nil
146
- ruby_install_name 'ruby27' do
146
+ ruby_install_name "ruby27" do
147
147
  assert_self_install_permissions(format_executable: true)
148
148
  end
149
149
  ensure
@@ -160,35 +160,35 @@ class TestGem < Gem::TestCase
160
160
  :format_executable => format_executable,
161
161
  }
162
162
  Dir.chdir @tempdir do
163
- Dir.mkdir 'bin'
164
- Dir.mkdir 'data'
163
+ Dir.mkdir "bin"
164
+ Dir.mkdir "data"
165
165
 
166
- File.write 'bin/foo', "#!/usr/bin/env ruby\n"
167
- File.chmod 0755, 'bin/foo'
166
+ File.write "bin/foo", "#!/usr/bin/env ruby\n"
167
+ File.chmod 0755, "bin/foo"
168
168
 
169
- File.write 'data/foo.txt', "blah\n"
169
+ File.write "data/foo.txt", "blah\n"
170
170
 
171
171
  spec_fetcher do |f|
172
- f.gem 'foo', 1 do |s|
173
- s.executables = ['foo']
172
+ f.gem "foo", 1 do |s|
173
+ s.executables = ["foo"]
174
174
  s.files = %w[bin/foo data/foo.txt]
175
175
  end
176
176
  end
177
- Gem.install 'foo', Gem::Requirement.default, options
177
+ Gem.install "foo", Gem::Requirement.default, options
178
178
  end
179
179
 
180
180
  prog_mode = (options[:prog_mode] & mask).to_s(8)
181
181
  dir_mode = (options[:dir_mode] & mask).to_s(8)
182
182
  data_mode = (options[:data_mode] & mask).to_s(8)
183
- prog_name = 'foo'
184
- prog_name = RbConfig::CONFIG['ruby_install_name'].sub('ruby', 'foo') if options[:format_executable]
183
+ prog_name = "foo"
184
+ prog_name = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "foo") if options[:format_executable]
185
185
  expected = {
186
186
  "bin/#{prog_name}" => 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' => prog_mode,
191
- 'gems/foo-1/data/foo.txt' => data_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" => prog_mode,
191
+ "gems/foo-1/data/foo.txt" => data_mode,
192
192
  }
193
193
  # add Windows script
194
194
  expected["bin/#{prog_name}.bat"] = mask.to_s(8) if win_platform?
@@ -200,7 +200,7 @@ class TestGem < Gem::TestCase
200
200
  end
201
201
  assert_equal(expected, result)
202
202
  ensure
203
- File.chmod(0755, *Dir.glob(@gemhome + '/gems/**/').map {|path| path.tap(&Gem::UNTAINT) })
203
+ File.chmod(0755, *Dir.glob(@gemhome + "/gems/**/").map {|path| path.tap(&Gem::UNTAINT) })
204
204
  end
205
205
 
206
206
  def test_require_missing
@@ -222,57 +222,57 @@ class TestGem < Gem::TestCase
222
222
  end
223
223
 
224
224
  def test_self_bin_path_active
225
- a1 = util_spec 'a', '1' do |s|
226
- s.executables = ['exec']
225
+ a1 = util_spec "a", "1" do |s|
226
+ s.executables = ["exec"]
227
227
  end
228
228
 
229
- util_spec 'a', '2' do |s|
230
- s.executables = ['exec']
229
+ util_spec "a", "2" do |s|
230
+ s.executables = ["exec"]
231
231
  end
232
232
 
233
233
  a1.activate
234
234
 
235
- assert_match 'a-1/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
235
+ assert_match "a-1/bin/exec", Gem.bin_path("a", "exec", ">= 0")
236
236
  end
237
237
 
238
238
  def test_self_bin_path_picking_newest
239
- a1 = util_spec 'a', '1' do |s|
240
- s.executables = ['exec']
239
+ a1 = util_spec "a", "1" do |s|
240
+ s.executables = ["exec"]
241
241
  end
242
242
 
243
- a2 = util_spec 'a', '2' do |s|
244
- s.executables = ['exec']
243
+ a2 = util_spec "a", "2" do |s|
244
+ s.executables = ["exec"]
245
245
  end
246
246
 
247
247
  install_specs a1, a2
248
248
 
249
- assert_match 'a-2/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
249
+ assert_match "a-2/bin/exec", Gem.bin_path("a", "exec", ">= 0")
250
250
  end
251
251
 
252
252
  def test_self_activate_bin_path_no_exec_name
253
253
  e = assert_raise ArgumentError do
254
- Gem.activate_bin_path 'a'
254
+ Gem.activate_bin_path "a"
255
255
  end
256
256
 
257
- assert_equal 'you must supply exec_name', e.message
257
+ assert_equal "you must supply exec_name", e.message
258
258
  end
259
259
 
260
260
  def test_activate_bin_path_resolves_eagerly
261
- a1 = util_spec 'a', '1' do |s|
262
- s.executables = ['exec']
263
- s.add_dependency 'b'
261
+ a1 = util_spec "a", "1" do |s|
262
+ s.executables = ["exec"]
263
+ s.add_dependency "b"
264
264
  end
265
265
 
266
- b1 = util_spec 'b', '1' do |s|
267
- s.add_dependency 'c', '2'
266
+ b1 = util_spec "b", "1" do |s|
267
+ s.add_dependency "c", "2"
268
268
  end
269
269
 
270
- b2 = util_spec 'b', '2' do |s|
271
- s.add_dependency 'c', '1'
270
+ b2 = util_spec "b", "2" do |s|
271
+ s.add_dependency "c", "1"
272
272
  end
273
273
 
274
- c1 = util_spec 'c', '1'
275
- c2 = util_spec 'c', '2'
274
+ c1 = util_spec "c", "1"
275
+ c2 = util_spec "c", "2"
276
276
 
277
277
  install_specs c1, c2, b1, b2, a1
278
278
 
@@ -280,27 +280,27 @@ class TestGem < Gem::TestCase
280
280
 
281
281
  # If we didn't eagerly resolve, this would activate c-2 and then the
282
282
  # finish_resolve would cause a conflict
283
- gem 'c'
283
+ gem "c"
284
284
  Gem.finish_resolve
285
285
 
286
286
  assert_equal %w[a-1 b-2 c-1], loaded_spec_names
287
287
  end
288
288
 
289
289
  def test_activate_bin_path_does_not_error_if_a_gem_thats_not_finally_activated_has_orphaned_dependencies
290
- a1 = util_spec 'a', '1' do |s|
291
- s.executables = ['exec']
292
- s.add_dependency 'b'
290
+ a1 = util_spec "a", "1" do |s|
291
+ s.executables = ["exec"]
292
+ s.add_dependency "b"
293
293
  end
294
294
 
295
- b1 = util_spec 'b', '1' do |s|
296
- s.add_dependency 'c', '1'
295
+ b1 = util_spec "b", "1" do |s|
296
+ s.add_dependency "c", "1"
297
297
  end
298
298
 
299
- b2 = util_spec 'b', '2' do |s|
300
- s.add_dependency 'c', '2'
299
+ b2 = util_spec "b", "2" do |s|
300
+ s.add_dependency "c", "2"
301
301
  end
302
302
 
303
- c2 = util_spec 'c', '2'
303
+ c2 = util_spec "c", "2"
304
304
 
305
305
  install_specs c2, b1, b2, a1
306
306
 
@@ -312,20 +312,20 @@ class TestGem < Gem::TestCase
312
312
  end
313
313
 
314
314
  def test_activate_bin_path_raises_a_meaningful_error_if_a_gem_thats_finally_activated_has_orphaned_dependencies
315
- a1 = util_spec 'a', '1' do |s|
316
- s.executables = ['exec']
317
- s.add_dependency 'b'
315
+ a1 = util_spec "a", "1" do |s|
316
+ s.executables = ["exec"]
317
+ s.add_dependency "b"
318
318
  end
319
319
 
320
- b1 = util_spec 'b', '1' do |s|
321
- s.add_dependency 'c', '1'
320
+ b1 = util_spec "b", "1" do |s|
321
+ s.add_dependency "c", "1"
322
322
  end
323
323
 
324
- b2 = util_spec 'b', '2' do |s|
325
- s.add_dependency 'c', '2'
324
+ b2 = util_spec "b", "2" do |s|
325
+ s.add_dependency "c", "2"
326
326
  end
327
327
 
328
- c1 = util_spec 'c', '1'
328
+ c1 = util_spec "c", "1"
329
329
 
330
330
  install_specs c1, b1, b2, a1
331
331
 
@@ -339,8 +339,8 @@ class TestGem < Gem::TestCase
339
339
  end
340
340
 
341
341
  def test_activate_bin_path_in_debug_mode
342
- a1 = util_spec 'a', '1' do |s|
343
- s.executables = ['exec']
342
+ a1 = util_spec "a", "1" do |s|
343
+ s.executables = ["exec"]
344
344
  end
345
345
 
346
346
  install_specs a1
@@ -354,48 +354,13 @@ class TestGem < Gem::TestCase
354
354
  assert status.success?, output
355
355
  end
356
356
 
357
- def test_activate_bin_path_gives_proper_error_for_bundler
358
- bundler = util_spec 'bundler', '2' do |s|
359
- s.executables = ['bundle']
360
- end
361
-
362
- install_specs bundler
363
-
364
- File.open("Gemfile.lock", "w") do |f|
365
- f.write <<-L.gsub(/ {8}/, "")
366
- GEM
367
- remote: https://rubygems.org/
368
- specs:
369
-
370
- PLATFORMS
371
- ruby
372
-
373
- DEPENDENCIES
374
-
375
- BUNDLED WITH
376
- 9999
377
- L
378
- end
379
-
380
- File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
381
-
382
- e = assert_raise Gem::GemNotFoundException do
383
- load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
384
- end
385
-
386
- assert_includes e.message, "Could not find 'bundler' (9999) required by your #{File.expand_path("Gemfile.lock")}."
387
- assert_includes e.message, "To update to the latest version installed on your system, run `bundle update --bundler`."
388
- assert_includes e.message, "To install the missing version, run `gem install bundler:9999`"
389
- refute_includes e.message, "can't find gem bundler (>= 0.a) with executable bundle"
390
- end
391
-
392
357
  def test_activate_bin_path_selects_exact_bundler_version_if_present
393
- bundler_latest = util_spec 'bundler', '2.0.1' do |s|
394
- s.executables = ['bundle']
358
+ bundler_latest = util_spec "bundler", "2.0.1" do |s|
359
+ s.executables = ["bundle"]
395
360
  end
396
361
 
397
- bundler_previous = util_spec 'bundler', '2.0.0' do |s|
398
- s.executables = ['bundle']
362
+ bundler_previous = util_spec "bundler", "2.0.0" do |s|
363
+ s.executables = ["bundle"]
399
364
  end
400
365
 
401
366
  install_specs bundler_latest, bundler_previous
@@ -424,12 +389,12 @@ class TestGem < Gem::TestCase
424
389
  end
425
390
 
426
391
  def test_activate_bin_path_respects_underscore_selection_if_given
427
- bundler_latest = util_spec 'bundler', '2.0.1' do |s|
428
- s.executables = ['bundle']
392
+ bundler_latest = util_spec "bundler", "2.0.1" do |s|
393
+ s.executables = ["bundle"]
429
394
  end
430
395
 
431
- bundler_previous = util_spec 'bundler', '1.17.3' do |s|
432
- s.executables = ['bundle']
396
+ bundler_previous = util_spec "bundler", "1.17.3" do |s|
397
+ s.executables = ["bundle"]
433
398
  end
434
399
 
435
400
  install_specs bundler_latest, bundler_previous
@@ -485,57 +450,57 @@ class TestGem < Gem::TestCase
485
450
 
486
451
  def test_self_bin_path_no_exec_name
487
452
  e = assert_raise ArgumentError do
488
- Gem.bin_path 'a'
453
+ Gem.bin_path "a"
489
454
  end
490
455
 
491
- assert_equal 'you must supply exec_name', e.message
456
+ assert_equal "you must supply exec_name", e.message
492
457
  end
493
458
 
494
459
  def test_self_bin_path_bin_name
495
460
  install_specs util_exec_gem
496
- assert_equal @abin_path, Gem.bin_path('a', 'abin')
461
+ assert_equal @abin_path, Gem.bin_path("a", "abin")
497
462
  end
498
463
 
499
464
  def test_self_bin_path_bin_name_version
500
465
  install_specs util_exec_gem
501
- assert_equal @abin_path, Gem.bin_path('a', 'abin', '4')
466
+ assert_equal @abin_path, Gem.bin_path("a", "abin", "4")
502
467
  end
503
468
 
504
469
  def test_self_bin_path_nonexistent_binfile
505
- util_spec 'a', '2' do |s|
506
- s.executables = ['exec']
470
+ util_spec "a", "2" do |s|
471
+ s.executables = ["exec"]
507
472
  end
508
473
  assert_raise(Gem::GemNotFoundException) do
509
- Gem.bin_path('a', 'other', '2')
474
+ Gem.bin_path("a", "other", "2")
510
475
  end
511
476
  end
512
477
 
513
478
  def test_self_bin_path_no_bin_file
514
- util_spec 'a', '1'
479
+ util_spec "a", "1"
515
480
  assert_raise(ArgumentError) do
516
- Gem.bin_path('a', nil, '1')
481
+ Gem.bin_path("a", nil, "1")
517
482
  end
518
483
  end
519
484
 
520
485
  def test_self_bin_path_not_found
521
486
  assert_raise(Gem::GemNotFoundException) do
522
- Gem.bin_path('non-existent', 'blah')
487
+ Gem.bin_path("non-existent", "blah")
523
488
  end
524
489
  end
525
490
 
526
491
  def test_self_bin_path_bin_file_gone_in_latest
527
492
  install_specs util_exec_gem
528
- spec = util_spec 'a', '10' do |s|
493
+ spec = util_spec "a", "10" do |s|
529
494
  s.executables = []
530
495
  end
531
496
  install_specs spec
532
- assert_equal @abin_path, Gem.bin_path('a', 'abin')
497
+ assert_equal @abin_path, Gem.bin_path("a", "abin")
533
498
  end
534
499
 
535
500
  def test_self_bindir
536
- assert_equal File.join(@gemhome, 'bin'), Gem.bindir
537
- assert_equal File.join(@gemhome, 'bin'), Gem.bindir(Gem.dir)
538
- assert_equal File.join(@gemhome, 'bin'), Gem.bindir(Pathname.new(Gem.dir))
501
+ assert_equal File.join(@gemhome, "bin"), Gem.bindir
502
+ assert_equal File.join(@gemhome, "bin"), Gem.bindir(Gem.dir)
503
+ assert_equal File.join(@gemhome, "bin"), Gem.bindir(Pathname.new(Gem.dir))
539
504
  end
540
505
 
541
506
  def test_self_bindir_default_dir
@@ -564,21 +529,21 @@ class TestGem < Gem::TestCase
564
529
  foo = nil
565
530
 
566
531
  Dir.chdir @tempdir do
567
- FileUtils.mkdir_p 'data'
568
- File.open File.join('data', 'foo.txt'), 'w' do |fp|
569
- fp.puts 'blah'
532
+ FileUtils.mkdir_p "data"
533
+ File.open File.join("data", "foo.txt"), "w" do |fp|
534
+ fp.puts "blah"
570
535
  end
571
536
 
572
- foo = util_spec 'foo' do |s|
537
+ foo = util_spec "foo" do |s|
573
538
  s.files = %w[data/foo.txt]
574
539
  end
575
540
 
576
541
  install_gem foo
577
542
  end
578
543
 
579
- gem 'foo'
544
+ gem "foo"
580
545
 
581
- expected = File.join @gemhome, 'gems', foo.full_name, 'data', 'foo'
546
+ expected = File.join @gemhome, "gems", foo.full_name, "data", "foo"
582
547
 
583
548
  assert_equal expected, Gem::Specification.find_by_name("foo").datadir
584
549
  end
@@ -590,25 +555,25 @@ class TestGem < Gem::TestCase
590
555
  end
591
556
 
592
557
  def test_self_default_exec_format
593
- ruby_install_name 'ruby' do
594
- assert_equal '%s', Gem.default_exec_format
558
+ ruby_install_name "ruby" do
559
+ assert_equal "%s", Gem.default_exec_format
595
560
  end
596
561
  end
597
562
 
598
563
  def test_self_default_exec_format_18
599
- ruby_install_name 'ruby18' do
600
- assert_equal '%s18', Gem.default_exec_format
564
+ ruby_install_name "ruby18" do
565
+ assert_equal "%s18", Gem.default_exec_format
601
566
  end
602
567
  end
603
568
 
604
569
  def test_self_default_exec_format_jruby
605
- ruby_install_name 'jruby' do
606
- assert_equal 'j%s', Gem.default_exec_format
570
+ ruby_install_name "jruby" do
571
+ assert_equal "j%s", Gem.default_exec_format
607
572
  end
608
573
  end
609
574
 
610
575
  def test_default_path
611
- vendordir(File.join(@tempdir, 'vendor')) do
576
+ vendordir(File.join(@tempdir, "vendor")) do
612
577
  FileUtils.rm_rf Gem.user_home
613
578
 
614
579
  expected = [Gem.default_dir]
@@ -628,7 +593,7 @@ class TestGem < Gem::TestCase
628
593
  end
629
594
 
630
595
  def test_default_path_user_home
631
- vendordir(File.join(@tempdir, 'vendor')) do
596
+ vendordir(File.join(@tempdir, "vendor")) do
632
597
  expected = [Gem.user_dir, Gem.default_dir]
633
598
 
634
599
  assert_equal expected, Gem.default_path
@@ -636,7 +601,7 @@ class TestGem < Gem::TestCase
636
601
  end
637
602
 
638
603
  def test_default_path_vendor_dir
639
- vendordir(File.join(@tempdir, 'vendor')) do
604
+ vendordir(File.join(@tempdir, "vendor")) do
640
605
  FileUtils.mkdir_p Gem.vendor_dir
641
606
 
642
607
  FileUtils.rm_rf Gem.user_home
@@ -651,25 +616,6 @@ class TestGem < Gem::TestCase
651
616
  assert_equal %w[https://rubygems.org/], Gem.default_sources
652
617
  end
653
618
 
654
- def test_self_use_gemdeps
655
- with_rubygems_gemdeps('-') do
656
- FileUtils.mkdir_p 'detect/a/b'
657
- FileUtils.mkdir_p 'detect/a/Isolate'
658
-
659
- FileUtils.touch 'detect/Isolate'
660
-
661
- begin
662
- Dir.chdir 'detect/a/b'
663
-
664
- Gem.use_gemdeps
665
-
666
- assert_equal add_bundler_full_name([]), loaded_spec_names
667
- ensure
668
- Dir.chdir @tempdir
669
- end
670
- end
671
- end
672
-
673
619
  def test_self_dir
674
620
  assert_equal @gemhome, Gem.dir
675
621
  end
@@ -680,12 +626,12 @@ class TestGem < Gem::TestCase
680
626
 
681
627
  Gem.ensure_gem_subdirectories @gemhome
682
628
 
683
- assert_path_exist File.join @gemhome, 'build_info'
684
- assert_path_exist File.join @gemhome, 'cache'
685
- assert_path_exist File.join @gemhome, 'doc'
686
- assert_path_exist File.join @gemhome, 'extensions'
687
- assert_path_exist File.join @gemhome, 'gems'
688
- assert_path_exist File.join @gemhome, 'specifications'
629
+ assert_path_exist File.join @gemhome, "build_info"
630
+ assert_path_exist File.join @gemhome, "cache"
631
+ assert_path_exist File.join @gemhome, "doc"
632
+ assert_path_exist File.join @gemhome, "extensions"
633
+ assert_path_exist File.join @gemhome, "gems"
634
+ assert_path_exist File.join @gemhome, "specifications"
689
635
  end
690
636
 
691
637
  def test_self_ensure_gem_directories_permissions
@@ -715,9 +661,9 @@ class TestGem < Gem::TestCase
715
661
  end unless win_platform?
716
662
 
717
663
  def test_self_ensure_gem_directories_missing_parents
718
- gemdir = File.join @tempdir, 'a/b/c/gemdir'
719
- FileUtils.rm_rf File.join(@tempdir, 'a') rescue nil
720
- refute File.exist?(File.join(@tempdir, 'a')),
664
+ gemdir = File.join @tempdir, "a/b/c/gemdir"
665
+ FileUtils.rm_rf File.join(@tempdir, "a") rescue nil
666
+ refute File.exist?(File.join(@tempdir, "a")),
721
667
  "manually remove #{File.join @tempdir, 'a'}, tests are broken"
722
668
  Gem.use_paths gemdir
723
669
 
@@ -760,19 +706,19 @@ class TestGem < Gem::TestCase
760
706
  end
761
707
 
762
708
  def test_self_ensure_gem_directories_non_existent_paths
763
- Gem.ensure_gem_subdirectories '/proc/0123456789/bogus' # should not raise
764
- Gem.ensure_gem_subdirectories 'classpath:/bogus/x' # JRuby embed scenario
709
+ Gem.ensure_gem_subdirectories "/proc/0123456789/bogus" # should not raise
710
+ Gem.ensure_gem_subdirectories "classpath:/bogus/x" # JRuby embed scenario
765
711
  end
766
712
  end
767
713
 
768
714
  def test_self_extension_dir_shared
769
- enable_shared 'yes' do
715
+ enable_shared "yes" do
770
716
  assert_equal Gem.ruby_api_version, Gem.extension_api_version
771
717
  end
772
718
  end
773
719
 
774
720
  def test_self_extension_dir_static
775
- enable_shared 'no' do
721
+ enable_shared "no" do
776
722
  assert_equal "#{Gem.ruby_api_version}-static", Gem.extension_api_version
777
723
  end
778
724
  end
@@ -781,14 +727,14 @@ class TestGem < Gem::TestCase
781
727
  cwd = File.expand_path("test/rubygems", PROJECT_DIR)
782
728
  $LOAD_PATH.unshift cwd
783
729
 
784
- discover_path = File.join 'lib', 'sff', 'discover.rb'
730
+ discover_path = File.join "lib", "sff", "discover.rb"
785
731
 
786
732
  foo1, foo2 = %w[1 2].map do |version|
787
- spec = quick_gem 'sff', version do |s|
733
+ spec = quick_gem "sff", version do |s|
788
734
  s.files << discover_path
789
735
  end
790
736
 
791
- write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
737
+ write_file(File.join "gems", spec.full_name, discover_path) do |fp|
792
738
  fp.puts "# #{spec.full_name}"
793
739
  end
794
740
 
@@ -798,65 +744,29 @@ class TestGem < Gem::TestCase
798
744
  Gem.refresh
799
745
 
800
746
  expected = [
801
- File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
747
+ File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
802
748
  File.join(foo2.full_gem_path, discover_path),
803
749
  File.join(foo1.full_gem_path, discover_path),
804
750
  ]
805
751
 
806
- assert_equal expected, Gem.find_files('sff/discover')
807
- assert_equal expected, Gem.find_files('sff/**.rb'), '[ruby-core:31730]'
752
+ assert_equal expected, Gem.find_files("sff/discover")
753
+ assert_equal expected, Gem.find_files("sff/**.rb"), "[ruby-core:31730]"
808
754
  ensure
809
755
  assert_equal cwd, $LOAD_PATH.shift
810
756
  end
811
757
 
812
- def test_self_find_files_with_gemfile
813
- cwd = File.expand_path("test/rubygems", PROJECT_DIR)
814
- actual_load_path = $LOAD_PATH.unshift(cwd).dup
815
-
816
- discover_path = File.join 'lib', 'sff', 'discover.rb'
817
-
818
- foo1, _ = %w[1 2].map do |version|
819
- spec = quick_gem 'sff', version do |s|
820
- s.files << discover_path
821
- end
822
-
823
- write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
824
- fp.puts "# #{spec.full_name}"
825
- end
826
-
827
- spec
828
- end
829
- Gem.refresh
830
-
831
- write_file(File.join Dir.pwd, 'Gemfile') do |fp|
832
- fp.puts "source 'https://rubygems.org'"
833
- fp.puts "gem '#{foo1.name}', '#{foo1.version}'"
834
- end
835
- Gem.use_gemdeps(File.join Dir.pwd, 'Gemfile')
836
-
837
- expected = [
838
- File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
839
- File.join(foo1.full_gem_path, discover_path),
840
- ].sort
841
-
842
- assert_equal expected, Gem.find_files('sff/discover').sort
843
- assert_equal expected, Gem.find_files('sff/**.rb').sort, '[ruby-core:31730]'
844
- ensure
845
- assert_equal cwd, actual_load_path.shift unless Gem.java_platform?
846
- end
847
-
848
758
  def test_self_find_latest_files
849
759
  cwd = File.expand_path("test/rubygems", PROJECT_DIR)
850
760
  $LOAD_PATH.unshift cwd
851
761
 
852
- discover_path = File.join 'lib', 'sff', 'discover.rb'
762
+ discover_path = File.join "lib", "sff", "discover.rb"
853
763
 
854
764
  _, foo2 = %w[1 2].map do |version|
855
- spec = quick_gem 'sff', version do |s|
765
+ spec = quick_gem "sff", version do |s|
856
766
  s.files << discover_path
857
767
  end
858
768
 
859
- write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
769
+ write_file(File.join "gems", spec.full_name, discover_path) do |fp|
860
770
  fp.puts "# #{spec.full_name}"
861
771
  end
862
772
 
@@ -866,64 +776,103 @@ class TestGem < Gem::TestCase
866
776
  Gem.refresh
867
777
 
868
778
  expected = [
869
- File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
779
+ File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
870
780
  File.join(foo2.full_gem_path, discover_path),
871
781
  ]
872
782
 
873
- assert_equal expected, Gem.find_latest_files('sff/discover')
874
- assert_equal expected, Gem.find_latest_files('sff/**.rb'), '[ruby-core:31730]'
783
+ assert_equal expected, Gem.find_latest_files("sff/discover")
784
+ assert_equal expected, Gem.find_latest_files("sff/**.rb"), "[ruby-core:31730]"
875
785
  ensure
876
786
  assert_equal cwd, $LOAD_PATH.shift
877
787
  end
878
788
 
879
789
  def test_self_latest_spec_for
880
790
  gems = spec_fetcher do |fetcher|
881
- fetcher.spec 'a', 1
882
- fetcher.spec 'a', '3.a'
883
- fetcher.spec 'a', 2
791
+ fetcher.spec "a", 1
792
+ fetcher.spec "a", "3.a"
793
+ fetcher.spec "a", 2
884
794
  end
885
795
 
886
- spec = Gem.latest_spec_for 'a'
796
+ spec = Gem.latest_spec_for "a"
797
+
798
+ assert_equal gems["a-2"], spec
799
+ end
800
+
801
+ def test_self_latest_spec_for_multiple_sources
802
+ uri = "https://example.sample.com/"
803
+ source = Gem::Source.new(uri)
804
+ source_list = Gem::SourceList.new
805
+ source_list << Gem::Source.new(@uri)
806
+ source_list << source
807
+ Gem.sources.replace source_list
808
+
809
+ spec_fetcher(uri) do |fetcher|
810
+ fetcher.spec "a", 1.1
811
+ end
887
812
 
888
- assert_equal gems['a-2'], spec
813
+ gems = spec_fetcher do |fetcher|
814
+ fetcher.spec "a", 1
815
+ fetcher.spec "a", "3.a"
816
+ fetcher.spec "a", 2
817
+ end
818
+ spec = Gem.latest_spec_for "a"
819
+ assert_equal gems["a-2"], spec
889
820
  end
890
821
 
891
822
  def test_self_latest_rubygems_version
892
823
  spec_fetcher do |fetcher|
893
- fetcher.spec 'rubygems-update', '1.8.23'
894
- fetcher.spec 'rubygems-update', '1.8.24'
895
- fetcher.spec 'rubygems-update', '2.0.0.preview3'
824
+ fetcher.spec "rubygems-update", "1.8.23"
825
+ fetcher.spec "rubygems-update", "1.8.24"
826
+ fetcher.spec "rubygems-update", "2.0.0.preview3"
896
827
  end
897
828
 
898
829
  version = Gem.latest_rubygems_version
899
830
 
900
- assert_equal Gem::Version.new('1.8.24'), version
831
+ assert_equal Gem::Version.new("1.8.24"), version
901
832
  end
902
833
 
903
834
  def test_self_latest_version_for
904
835
  spec_fetcher do |fetcher|
905
- fetcher.spec 'a', 1
906
- fetcher.spec 'a', 2
907
- fetcher.spec 'a', '3.a'
836
+ fetcher.spec "a", 1
837
+ fetcher.spec "a", 2
838
+ fetcher.spec "a", "3.a"
908
839
  end
909
840
 
910
- version = Gem.latest_version_for 'a'
841
+ version = Gem.latest_version_for "a"
842
+
843
+ assert_equal Gem::Version.new(2), version
844
+ end
845
+
846
+ def test_self_latest_version_for_multiple_sources
847
+ uri = "https://example.sample.com/"
848
+ source = Gem::Source.new(uri)
849
+ source_list = Gem::SourceList.new
850
+ source_list << Gem::Source.new(@uri)
851
+ source_list << source
852
+ Gem.sources.replace source_list
853
+
854
+ spec_fetcher(uri) do |fetcher|
855
+ fetcher.spec "a", 1.1
856
+ end
857
+
858
+ spec_fetcher do |fetcher|
859
+ fetcher.spec "a", 1
860
+ fetcher.spec "a", 2
861
+ fetcher.spec "a", "3.a"
862
+ end
863
+
864
+ version = Gem.latest_version_for "a"
911
865
 
912
866
  assert_equal Gem::Version.new(2), version
913
867
  end
914
868
 
915
869
  def test_self_loaded_specs
916
- foo = util_spec 'foo'
870
+ foo = util_spec "foo"
917
871
  install_gem foo
918
872
 
919
873
  foo.activate
920
874
 
921
- assert_equal true, Gem.loaded_specs.keys.include?('foo')
922
- end
923
-
924
- def util_path
925
- ENV.delete "GEM_HOME"
926
- ENV.delete "GEM_PATH"
875
+ assert_equal true, Gem.loaded_specs.keys.include?("foo")
927
876
  end
928
877
 
929
878
  def test_self_path
@@ -931,53 +880,19 @@ class TestGem < Gem::TestCase
931
880
  end
932
881
 
933
882
  def test_self_path_default
934
- util_path
935
-
936
- if defined?(APPLE_GEM_HOME)
937
- orig_APPLE_GEM_HOME = APPLE_GEM_HOME
938
- Object.send :remove_const, :APPLE_GEM_HOME
939
- end
883
+ ENV.delete "GEM_HOME"
884
+ ENV.delete "GEM_PATH"
940
885
 
941
886
  Gem.instance_variable_set :@paths, nil
942
887
 
943
888
  assert_equal [Gem.default_path, Gem.dir].flatten.uniq, Gem.path
944
- ensure
945
- Object.const_set :APPLE_GEM_HOME, orig_APPLE_GEM_HOME if orig_APPLE_GEM_HOME
946
- end
947
-
948
- unless win_platform?
949
- def test_self_path_APPLE_GEM_HOME
950
- util_path
951
-
952
- Gem.clear_paths
953
- apple_gem_home = File.join @tempdir, 'apple_gem_home'
954
-
955
- old, $-w = $-w, nil
956
- Object.const_set :APPLE_GEM_HOME, apple_gem_home
957
- $-w = old
958
-
959
- assert_includes Gem.path, apple_gem_home
960
- ensure
961
- Object.send :remove_const, :APPLE_GEM_HOME
962
- end
963
-
964
- def test_self_path_APPLE_GEM_HOME_GEM_PATH
965
- Gem.clear_paths
966
- ENV['GEM_PATH'] = @gemhome
967
- apple_gem_home = File.join @tempdir, 'apple_gem_home'
968
- Gem.const_set :APPLE_GEM_HOME, apple_gem_home
969
-
970
- refute Gem.path.include?(apple_gem_home)
971
- ensure
972
- Gem.send :remove_const, :APPLE_GEM_HOME
973
- end
974
889
  end
975
890
 
976
891
  def test_self_path_ENV_PATH
977
892
  path_count = Gem.path.size
978
893
  Gem.clear_paths
979
894
 
980
- ENV['GEM_PATH'] = @additional.join(File::PATH_SEPARATOR)
895
+ ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
981
896
 
982
897
  assert_equal @additional, Gem.path[0,2]
983
898
 
@@ -989,10 +904,10 @@ class TestGem < Gem::TestCase
989
904
  def test_self_path_duplicate
990
905
  Gem.clear_paths
991
906
  util_ensure_gem_dirs
992
- dirs = @additional + [@gemhome] + [File.join(@tempdir, 'a')]
907
+ dirs = @additional + [@gemhome] + [File.join(@tempdir, "a")]
993
908
 
994
- ENV['GEM_HOME'] = @gemhome
995
- ENV['GEM_PATH'] = dirs.join File::PATH_SEPARATOR
909
+ ENV["GEM_HOME"] = @gemhome
910
+ ENV["GEM_PATH"] = dirs.join File::PATH_SEPARATOR
996
911
 
997
912
  assert_equal @gemhome, Gem.dir
998
913
 
@@ -1004,8 +919,8 @@ class TestGem < Gem::TestCase
1004
919
  Gem.clear_paths
1005
920
 
1006
921
  util_ensure_gem_dirs
1007
- ENV['GEM_HOME'] = @gemhome
1008
- ENV['GEM_PATH'] = @additional.join(File::PATH_SEPARATOR)
922
+ ENV["GEM_HOME"] = @gemhome
923
+ ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
1009
924
 
1010
925
  assert_equal @gemhome, Gem.dir
1011
926
 
@@ -1022,38 +937,38 @@ class TestGem < Gem::TestCase
1022
937
  end
1023
938
 
1024
939
  def test_self_prefix_libdir
1025
- orig_libdir = RbConfig::CONFIG['libdir']
1026
- RbConfig::CONFIG['libdir'] = PROJECT_DIR
940
+ orig_libdir = RbConfig::CONFIG["libdir"]
941
+ RbConfig::CONFIG["libdir"] = PROJECT_DIR
1027
942
 
1028
943
  assert_nil Gem.prefix
1029
944
  ensure
1030
- RbConfig::CONFIG['libdir'] = orig_libdir
945
+ RbConfig::CONFIG["libdir"] = orig_libdir
1031
946
  end
1032
947
 
1033
948
  def test_self_prefix_sitelibdir
1034
- orig_sitelibdir = RbConfig::CONFIG['sitelibdir']
1035
- RbConfig::CONFIG['sitelibdir'] = PROJECT_DIR
949
+ orig_sitelibdir = RbConfig::CONFIG["sitelibdir"]
950
+ RbConfig::CONFIG["sitelibdir"] = PROJECT_DIR
1036
951
 
1037
952
  assert_nil Gem.prefix
1038
953
  ensure
1039
- RbConfig::CONFIG['sitelibdir'] = orig_sitelibdir
954
+ RbConfig::CONFIG["sitelibdir"] = orig_sitelibdir
1040
955
  end
1041
956
 
1042
957
  def test_self_read_binary
1043
- File.open 'test', 'w' do |io|
958
+ File.open "test", "w" do |io|
1044
959
  io.write "\xCF\x80"
1045
960
  end
1046
961
 
1047
- assert_equal ["\xCF", "\x80"], Gem.read_binary('test').chars.to_a
962
+ assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
1048
963
 
1049
- pend 'chmod not supported' if Gem.win_platform?
964
+ pend "chmod not supported" if Gem.win_platform?
1050
965
 
1051
966
  begin
1052
- File.chmod 0444, 'test'
967
+ File.chmod 0444, "test"
1053
968
 
1054
- assert_equal ["\xCF", "\x80"], Gem.read_binary('test').chars.to_a
969
+ assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
1055
970
  ensure
1056
- File.chmod 0644, 'test'
971
+ File.chmod 0644, "test"
1057
972
  end
1058
973
  end
1059
974
 
@@ -1091,7 +1006,7 @@ class TestGem < Gem::TestCase
1091
1006
 
1092
1007
  Gem.refresh
1093
1008
 
1094
- Gem::Specification.each{|spec| assert spec.activated? if spec == s }
1009
+ Gem::Specification.each {|spec| assert spec.activated? if spec == s }
1095
1010
 
1096
1011
  Gem.loaded_specs.delete(s)
1097
1012
  Gem.refresh
@@ -1114,88 +1029,72 @@ class TestGem < Gem::TestCase
1114
1029
  end
1115
1030
 
1116
1031
  def test_self_ruby_api_version
1117
- orig_ruby_version, RbConfig::CONFIG['ruby_version'] = RbConfig::CONFIG['ruby_version'], '1.2.3'
1032
+ orig_ruby_version, RbConfig::CONFIG["ruby_version"] = RbConfig::CONFIG["ruby_version"], "1.2.3"
1118
1033
 
1119
1034
  Gem.instance_variable_set :@ruby_api_version, nil
1120
1035
 
1121
- assert_equal '1.2.3', Gem.ruby_api_version
1036
+ assert_equal "1.2.3", Gem.ruby_api_version
1122
1037
  ensure
1123
1038
  Gem.instance_variable_set :@ruby_api_version, nil
1124
1039
 
1125
- RbConfig::CONFIG['ruby_version'] = orig_ruby_version
1040
+ RbConfig::CONFIG["ruby_version"] = orig_ruby_version
1126
1041
  end
1127
1042
 
1128
1043
  def test_self_env_requirement
1129
- ENV["GEM_REQUIREMENT_FOO"] = '>= 1.2.3'
1130
- ENV["GEM_REQUIREMENT_BAR"] = '1.2.3'
1131
- ENV["GEM_REQUIREMENT_BAZ"] = 'abcd'
1044
+ ENV["GEM_REQUIREMENT_FOO"] = ">= 1.2.3"
1045
+ ENV["GEM_REQUIREMENT_BAR"] = "1.2.3"
1046
+ ENV["GEM_REQUIREMENT_BAZ"] = "abcd"
1132
1047
 
1133
- assert_equal Gem::Requirement.create('>= 1.2.3'), Gem.env_requirement('foo')
1134
- assert_equal Gem::Requirement.create('1.2.3'), Gem.env_requirement('bAr')
1135
- assert_raise(Gem::Requirement::BadRequirementError) { Gem.env_requirement('baz') }
1136
- assert_equal Gem::Requirement.default, Gem.env_requirement('qux')
1137
- end
1138
-
1139
- def test_self_ruby_version_with_patchlevel_less_ancient_rubies
1140
- util_set_RUBY_VERSION '1.8.5'
1141
-
1142
- assert_equal Gem::Version.new('1.8.5'), Gem.ruby_version
1143
- ensure
1144
- util_restore_RUBY_VERSION
1145
- end
1146
-
1147
- def test_self_ruby_version_with_release
1148
- util_set_RUBY_VERSION '1.8.6', 287
1149
-
1150
- assert_equal Gem::Version.new('1.8.6.287'), Gem.ruby_version
1151
- ensure
1152
- util_restore_RUBY_VERSION
1048
+ assert_equal Gem::Requirement.create(">= 1.2.3"), Gem.env_requirement("foo")
1049
+ assert_equal Gem::Requirement.create("1.2.3"), Gem.env_requirement("bAr")
1050
+ assert_raise(Gem::Requirement::BadRequirementError) { Gem.env_requirement("baz") }
1051
+ assert_equal Gem::Requirement.default, Gem.env_requirement("qux")
1153
1052
  end
1154
1053
 
1155
1054
  def test_self_ruby_version_with_non_mri_implementations
1156
- 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]'
1055
+ 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]"
1157
1056
 
1158
- assert_equal Gem::Version.new('2.5.0'), Gem.ruby_version
1057
+ assert_equal Gem::Version.new("2.5.0"), Gem.ruby_version
1159
1058
  ensure
1160
1059
  util_restore_RUBY_VERSION
1161
1060
  end
1162
1061
 
1163
1062
  def test_self_ruby_version_with_svn_prerelease
1164
- util_set_RUBY_VERSION '2.6.0', -1, 63539, 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
1063
+ util_set_RUBY_VERSION "2.6.0", -1, 63539, "ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]"
1165
1064
 
1166
- assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
1065
+ assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
1167
1066
  ensure
1168
1067
  util_restore_RUBY_VERSION
1169
1068
  end
1170
1069
 
1171
1070
  def test_self_ruby_version_with_git_prerelease
1172
- util_set_RUBY_VERSION '2.7.0', -1, 'b563439274a402e33541f5695b1bfd4ac1085638', 'ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]'
1071
+ util_set_RUBY_VERSION "2.7.0", -1, "b563439274a402e33541f5695b1bfd4ac1085638", "ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]"
1173
1072
 
1174
- assert_equal Gem::Version.new('2.7.0.preview3'), Gem.ruby_version
1073
+ assert_equal Gem::Version.new("2.7.0.preview3"), Gem.ruby_version
1175
1074
  ensure
1176
1075
  util_restore_RUBY_VERSION
1177
1076
  end
1178
1077
 
1179
1078
  def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
1180
- 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'
1079
+ 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"
1181
1080
 
1182
- assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
1081
+ assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
1183
1082
  ensure
1184
1083
  util_restore_RUBY_VERSION
1185
1084
  end
1186
1085
 
1187
1086
  def test_self_ruby_version_with_svn_trunk
1188
- util_set_RUBY_VERSION '1.9.2', -1, 23493, 'ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]'
1087
+ util_set_RUBY_VERSION "1.9.2", -1, 23493, "ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]"
1189
1088
 
1190
- assert_equal Gem::Version.new('1.9.2.dev'), Gem.ruby_version
1089
+ assert_equal Gem::Version.new("1.9.2.dev"), Gem.ruby_version
1191
1090
  ensure
1192
1091
  util_restore_RUBY_VERSION
1193
1092
  end
1194
1093
 
1195
1094
  def test_self_ruby_version_with_git_master
1196
- util_set_RUBY_VERSION '2.7.0', -1, '5de284ec78220e75643f89b454ce999da0c1c195', 'ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]'
1095
+ util_set_RUBY_VERSION "2.7.0", -1, "5de284ec78220e75643f89b454ce999da0c1c195", "ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]"
1197
1096
 
1198
- assert_equal Gem::Version.new('2.7.0.dev'), Gem.ruby_version
1097
+ assert_equal Gem::Version.new("2.7.0.dev"), Gem.ruby_version
1199
1098
  ensure
1200
1099
  util_restore_RUBY_VERSION
1201
1100
  end
@@ -1205,7 +1104,7 @@ class TestGem < Gem::TestCase
1205
1104
  end
1206
1105
 
1207
1106
  def test_self_paths_eq
1208
- other = File.join @tempdir, 'other'
1107
+ other = File.join @tempdir, "other"
1209
1108
  path = [@userhome, other].join File::PATH_SEPARATOR
1210
1109
 
1211
1110
  #
@@ -1218,12 +1117,12 @@ class TestGem < Gem::TestCase
1218
1117
  end
1219
1118
 
1220
1119
  def test_self_paths_eq_nonexistent_home
1221
- ENV['GEM_HOME'] = @gemhome
1120
+ ENV["GEM_HOME"] = @gemhome
1222
1121
  Gem.clear_paths
1223
1122
 
1224
- other = File.join @tempdir, 'other'
1123
+ other = File.join @tempdir, "other"
1225
1124
 
1226
- ENV['HOME'] = other
1125
+ ENV["HOME"] = other
1227
1126
 
1228
1127
  Gem.paths = { "GEM_PATH" => other }
1229
1128
 
@@ -1302,43 +1201,43 @@ class TestGem < Gem::TestCase
1302
1201
  end
1303
1202
 
1304
1203
  def test_try_activate_returns_true_for_activated_specs
1305
- b = util_spec 'b', '1.0' do |spec|
1306
- spec.files << 'lib/b.rb'
1204
+ b = util_spec "b", "1.0" do |spec|
1205
+ spec.files << "lib/b.rb"
1307
1206
  end
1308
1207
  install_specs b
1309
1208
 
1310
- assert Gem.try_activate('b'), 'try_activate should return true'
1311
- assert Gem.try_activate('b'), 'try_activate should still return true'
1209
+ assert Gem.try_activate("b"), "try_activate should return true"
1210
+ assert Gem.try_activate("b"), "try_activate should still return true"
1312
1211
  end
1313
1212
 
1314
1213
  def test_spec_order_is_consistent
1315
- b1 = util_spec 'b', '1.0'
1316
- b2 = util_spec 'b', '2.0'
1317
- b3 = util_spec 'b', '3.0'
1214
+ b1 = util_spec "b", "1.0"
1215
+ b2 = util_spec "b", "2.0"
1216
+ b3 = util_spec "b", "3.0"
1318
1217
 
1319
1218
  install_specs b1, b2, b3
1320
1219
 
1321
- specs1 = Gem::Specification.stubs.find_all {|s| s.name == 'b' }
1220
+ specs1 = Gem::Specification.stubs.find_all {|s| s.name == "b" }
1322
1221
  Gem::Specification.reset
1323
- specs2 = Gem::Specification.stubs_for('b')
1222
+ specs2 = Gem::Specification.stubs_for("b")
1324
1223
  assert_equal specs1.map(&:version), specs2.map(&:version)
1325
1224
  end
1326
1225
 
1327
1226
  def test_self_try_activate_missing_dep
1328
- b = util_spec 'b', '1.0'
1329
- a = util_spec 'a', '1.0', 'b' => '>= 1.0'
1227
+ b = util_spec "b", "1.0"
1228
+ a = util_spec "a", "1.0", "b" => ">= 1.0"
1330
1229
 
1331
1230
  install_specs b, a
1332
1231
  uninstall_gem b
1333
1232
 
1334
- a_file = File.join a.gem_dir, 'lib', 'a_file.rb'
1233
+ a_file = File.join a.gem_dir, "lib", "a_file.rb"
1335
1234
 
1336
1235
  write_file a_file do |io|
1337
- io.puts '# a_file.rb'
1236
+ io.puts "# a_file.rb"
1338
1237
  end
1339
1238
 
1340
1239
  e = assert_raise Gem::MissingSpecError do
1341
- Gem.try_activate 'a_file'
1240
+ Gem.try_activate "a_file"
1342
1241
  end
1343
1242
 
1344
1243
  assert_match %r{Could not find 'b' }, e.message
@@ -1346,30 +1245,30 @@ class TestGem < Gem::TestCase
1346
1245
  end
1347
1246
 
1348
1247
  def test_self_try_activate_missing_prerelease
1349
- b = util_spec 'b', '1.0rc1'
1350
- a = util_spec 'a', '1.0rc1', 'b' => '1.0rc1'
1248
+ b = util_spec "b", "1.0rc1"
1249
+ a = util_spec "a", "1.0rc1", "b" => "1.0rc1"
1351
1250
 
1352
1251
  install_specs b, a
1353
1252
  uninstall_gem b
1354
1253
 
1355
- a_file = File.join a.gem_dir, 'lib', 'a_file.rb'
1254
+ a_file = File.join a.gem_dir, "lib", "a_file.rb"
1356
1255
 
1357
1256
  write_file a_file do |io|
1358
- io.puts '# a_file.rb'
1257
+ io.puts "# a_file.rb"
1359
1258
  end
1360
1259
 
1361
1260
  e = assert_raise Gem::MissingSpecError do
1362
- Gem.try_activate 'a_file'
1261
+ Gem.try_activate "a_file"
1363
1262
  end
1364
1263
 
1365
1264
  assert_match %r{Could not find 'b' \(= 1.0rc1\)}, e.message
1366
1265
  end
1367
1266
 
1368
1267
  def test_self_try_activate_missing_extensions
1369
- spec = util_spec 'ext', '1' do |s|
1268
+ spec = util_spec "ext", "1" do |s|
1370
1269
  s.extensions = %w[ext/extconf.rb]
1371
1270
  s.mark_version
1372
- s.installed_by_version = v('2.2')
1271
+ s.installed_by_version = v("2.2")
1373
1272
  end
1374
1273
 
1375
1274
  # write the spec without install to simulate a failed install
@@ -1378,55 +1277,53 @@ class TestGem < Gem::TestCase
1378
1277
  end
1379
1278
 
1380
1279
  _, err = capture_output do
1381
- refute Gem.try_activate 'nonexistent'
1280
+ refute Gem.try_activate "nonexistent"
1382
1281
  end
1383
1282
 
1384
- unless Gem.java_platform?
1385
- expected = "Ignoring ext-1 because its extensions are not built. " +
1386
- "Try: gem pristine ext --version 1\n"
1283
+ expected = "Ignoring ext-1 because its extensions are not built. " +
1284
+ "Try: gem pristine ext --version 1\n"
1387
1285
 
1388
- assert_equal expected, err
1389
- end
1286
+ assert_equal expected, err
1390
1287
  end
1391
1288
 
1392
1289
  def test_self_use_paths_with_nils
1393
- orig_home = ENV.delete 'GEM_HOME'
1394
- orig_path = ENV.delete 'GEM_PATH'
1290
+ orig_home = ENV.delete "GEM_HOME"
1291
+ orig_path = ENV.delete "GEM_PATH"
1395
1292
  Gem.use_paths nil, nil
1396
1293
  assert_equal Gem.default_dir, Gem.paths.home
1397
1294
  path = (Gem.default_path + [Gem.paths.home]).uniq
1398
1295
  assert_equal path, Gem.paths.path
1399
1296
  ensure
1400
- ENV['GEM_HOME'] = orig_home
1401
- ENV['GEM_PATH'] = orig_path
1297
+ ENV["GEM_HOME"] = orig_home
1298
+ ENV["GEM_PATH"] = orig_path
1402
1299
  end
1403
1300
 
1404
1301
  def test_setting_paths_does_not_warn_about_unknown_keys
1405
1302
  stdout, stderr = capture_output do
1406
- Gem.paths = { 'foo' => [],
1407
- 'bar' => Object.new,
1408
- 'GEM_HOME' => Gem.paths.home,
1409
- 'GEM_PATH' => 'foo' }
1303
+ Gem.paths = { "foo" => [],
1304
+ "bar" => Object.new,
1305
+ "GEM_HOME" => Gem.paths.home,
1306
+ "GEM_PATH" => "foo" }
1410
1307
  end
1411
- assert_equal ['foo', Gem.paths.home], Gem.paths.path
1412
- assert_equal '', stderr
1413
- assert_equal '', stdout
1308
+ assert_equal ["foo", Gem.paths.home], Gem.paths.path
1309
+ assert_equal "", stderr
1310
+ assert_equal "", stdout
1414
1311
  end
1415
1312
 
1416
1313
  def test_setting_paths_does_not_mutate_parameter_object
1417
- Gem.paths = { 'GEM_HOME' => Gem.paths.home,
1418
- 'GEM_PATH' => 'foo' }.freeze
1419
- assert_equal ['foo', Gem.paths.home], Gem.paths.path
1314
+ Gem.paths = { "GEM_HOME" => Gem.paths.home,
1315
+ "GEM_PATH" => "foo" }.freeze
1316
+ assert_equal ["foo", Gem.paths.home], Gem.paths.path
1420
1317
  end
1421
1318
 
1422
1319
  def test_deprecated_paths=
1423
1320
  stdout, stderr = capture_output do
1424
- Gem.paths = { 'GEM_HOME' => Gem.paths.home,
1425
- 'GEM_PATH' => [Gem.paths.home, 'foo'] }
1321
+ Gem.paths = { "GEM_HOME" => Gem.paths.home,
1322
+ "GEM_PATH" => [Gem.paths.home, "foo"] }
1426
1323
  end
1427
- assert_equal [Gem.paths.home, 'foo'], Gem.paths.path
1324
+ assert_equal [Gem.paths.home, "foo"], Gem.paths.path
1428
1325
  assert_match(/Array values in the parameter to `Gem.paths=` are deprecated.\nPlease use a String or nil/m, stderr)
1429
- assert_equal '', stdout
1326
+ assert_equal "", stdout
1430
1327
  end
1431
1328
 
1432
1329
  def test_self_use_paths
@@ -1439,8 +1336,8 @@ class TestGem < Gem::TestCase
1439
1336
  end
1440
1337
 
1441
1338
  def test_self_user_dir
1442
- parts = [@userhome, '.gem', Gem.ruby_engine]
1443
- parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
1339
+ parts = [@userhome, ".gem", Gem.ruby_engine]
1340
+ parts << RbConfig::CONFIG["ruby_version"] unless RbConfig::CONFIG["ruby_version"].empty?
1444
1341
 
1445
1342
  FileUtils.mkdir_p File.join(parts)
1446
1343
 
@@ -1448,10 +1345,10 @@ class TestGem < Gem::TestCase
1448
1345
  end
1449
1346
 
1450
1347
  def test_self_user_home
1451
- if ENV['HOME']
1452
- assert_equal ENV['HOME'], Gem.user_home
1348
+ if ENV["HOME"]
1349
+ assert_equal ENV["HOME"], Gem.user_home
1453
1350
  else
1454
- assert true, 'count this test'
1351
+ assert true, "count this test"
1455
1352
  end
1456
1353
  end
1457
1354
 
@@ -1476,7 +1373,7 @@ class TestGem < Gem::TestCase
1476
1373
  a = util_spec "a", "1"
1477
1374
  b = util_spec "b", "1", "c" => nil
1478
1375
  c = util_spec "c", "2"
1479
- d = util_spec "d", "1", {'e' => '= 1'}, "lib/d#{$$}.rb"
1376
+ d = util_spec "d", "1", { "e" => "= 1" }, "lib/d#{$$}.rb"
1480
1377
  e = util_spec "e", "1"
1481
1378
 
1482
1379
  install_specs a, c, b, e, d
@@ -1497,35 +1394,35 @@ class TestGem < Gem::TestCase
1497
1394
 
1498
1395
  output = Gem::Util.gunzip input
1499
1396
 
1500
- assert_equal 'hello', output
1397
+ assert_equal "hello", output
1501
1398
  assert_equal Encoding::BINARY, output.encoding
1502
1399
  end
1503
1400
 
1504
1401
  def test_self_gzip
1505
- input = 'hello'
1402
+ input = "hello"
1506
1403
 
1507
1404
  output = Gem::Util.gzip input
1508
1405
 
1509
1406
  zipped = StringIO.new output
1510
1407
 
1511
- assert_equal 'hello', Zlib::GzipReader.new(zipped).read
1408
+ assert_equal "hello", Zlib::GzipReader.new(zipped).read
1512
1409
  assert_equal Encoding::BINARY, output.encoding
1513
1410
  end
1514
1411
 
1515
1412
  def test_self_vendor_dir
1516
- vendordir(File.join(@tempdir, 'vendor')) do
1413
+ vendordir(File.join(@tempdir, "vendor")) do
1517
1414
  expected =
1518
- File.join RbConfig::CONFIG['vendordir'], 'gems',
1519
- RbConfig::CONFIG['ruby_version']
1415
+ File.join RbConfig::CONFIG["vendordir"], "gems",
1416
+ RbConfig::CONFIG["ruby_version"]
1520
1417
 
1521
1418
  assert_equal expected, Gem.vendor_dir
1522
1419
  end
1523
1420
  end
1524
1421
 
1525
1422
  def test_self_vendor_dir_ENV_GEM_VENDOR
1526
- ENV['GEM_VENDOR'] = File.join @tempdir, 'vendor', 'gems'
1423
+ ENV["GEM_VENDOR"] = File.join @tempdir, "vendor", "gems"
1527
1424
 
1528
- assert_equal ENV['GEM_VENDOR'], Gem.vendor_dir
1425
+ assert_equal ENV["GEM_VENDOR"], Gem.vendor_dir
1529
1426
  refute Gem.vendor_dir.frozen?
1530
1427
  end
1531
1428
 
@@ -1539,18 +1436,18 @@ class TestGem < Gem::TestCase
1539
1436
  plugin_path = File.join "lib", "rubygems_plugin.rb"
1540
1437
 
1541
1438
  Dir.chdir @tempdir do
1542
- FileUtils.mkdir_p 'lib'
1439
+ FileUtils.mkdir_p "lib"
1543
1440
  File.open plugin_path, "w" do |fp|
1544
1441
  fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
1545
1442
  end
1546
1443
 
1547
- foo1 = util_spec 'foo', '1' do |s|
1444
+ foo1 = util_spec "foo", "1" do |s|
1548
1445
  s.files << plugin_path
1549
1446
  end
1550
1447
 
1551
1448
  install_gem foo1
1552
1449
 
1553
- foo2 = util_spec 'foo', '2' do |s|
1450
+ foo2 = util_spec "foo", "2" do |s|
1554
1451
  s.files << plugin_path
1555
1452
  end
1556
1453
 
@@ -1559,7 +1456,7 @@ class TestGem < Gem::TestCase
1559
1456
 
1560
1457
  Gem::Specification.reset
1561
1458
 
1562
- gem 'foo'
1459
+ gem "foo"
1563
1460
 
1564
1461
  Gem.load_plugins
1565
1462
 
@@ -1567,15 +1464,18 @@ class TestGem < Gem::TestCase
1567
1464
  end
1568
1465
 
1569
1466
  def test_load_user_installed_plugins
1467
+ @orig_gem_home = ENV["GEM_HOME"]
1468
+ ENV["GEM_HOME"] = @gemhome
1469
+
1570
1470
  plugin_path = File.join "lib", "rubygems_plugin.rb"
1571
1471
 
1572
1472
  Dir.chdir @tempdir do
1573
- FileUtils.mkdir_p 'lib'
1473
+ FileUtils.mkdir_p "lib"
1574
1474
  File.open plugin_path, "w" do |fp|
1575
1475
  fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
1576
1476
  end
1577
1477
 
1578
- foo = util_spec 'foo', '1' do |s|
1478
+ foo = util_spec "foo", "1" do |s|
1579
1479
  s.files << plugin_path
1580
1480
  end
1581
1481
 
@@ -1584,38 +1484,40 @@ class TestGem < Gem::TestCase
1584
1484
 
1585
1485
  Gem.paths = { "GEM_PATH" => [Gem.dir, Gem.user_dir].join(File::PATH_SEPARATOR) }
1586
1486
 
1587
- gem 'foo'
1487
+ gem "foo"
1588
1488
 
1589
1489
  Gem.load_plugins
1590
1490
 
1591
1491
  assert_equal %w[plugin], PLUGINS_LOADED
1492
+ ensure
1493
+ ENV["GEM_HOME"] = @orig_gem_home
1592
1494
  end
1593
1495
 
1594
1496
  def test_load_env_plugins
1595
- with_plugin('load') { Gem.load_env_plugins }
1497
+ with_plugin("load") { Gem.load_env_plugins }
1596
1498
  assert_equal :loaded, TEST_PLUGIN_LOAD rescue nil
1597
1499
 
1598
1500
  util_remove_interrupt_command
1599
1501
 
1600
1502
  # Should attempt to cause a StandardError
1601
- with_plugin('standarderror') { Gem.load_env_plugins }
1503
+ with_plugin("standarderror") { Gem.load_env_plugins }
1602
1504
  assert_equal :loaded, TEST_PLUGIN_STANDARDERROR rescue nil
1603
1505
 
1604
1506
  util_remove_interrupt_command
1605
1507
 
1606
1508
  # Should attempt to cause an Exception
1607
- with_plugin('exception') { Gem.load_env_plugins }
1509
+ with_plugin("exception") { Gem.load_env_plugins }
1608
1510
  assert_equal :loaded, TEST_PLUGIN_EXCEPTION rescue nil
1609
1511
  end
1610
1512
 
1611
1513
  def test_gem_path_ordering
1612
1514
  refute_equal Gem.dir, Gem.user_dir
1613
1515
 
1614
- write_file File.join(@tempdir, 'lib', "g.rb") {|fp| fp.puts "" }
1615
- write_file File.join(@tempdir, 'lib', 'm.rb') {|fp| fp.puts "" }
1516
+ write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
1517
+ write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
1616
1518
 
1617
- g = util_spec 'g', '1', nil, "lib/g.rb"
1618
- m = util_spec 'm', '1', nil, "lib/m.rb"
1519
+ g = util_spec "g", "1", nil, "lib/g.rb"
1520
+ m = util_spec "m", "1", nil, "lib/m.rb"
1619
1521
 
1620
1522
  install_gem g, :install_dir => Gem.dir
1621
1523
  m0 = install_gem m, :install_dir => Gem.dir
@@ -1634,15 +1536,15 @@ class TestGem < Gem::TestCase
1634
1536
  Gem::Specification.reset
1635
1537
  Gem.searcher = nil
1636
1538
 
1637
- assert_equal Gem::Dependency.new('m','1').to_specs,
1638
- Gem::Dependency.new('m','1').to_specs.sort
1539
+ assert_equal Gem::Dependency.new("m","1").to_specs,
1540
+ Gem::Dependency.new("m","1").to_specs.sort
1639
1541
 
1640
1542
  assert_equal \
1641
1543
  [expected.gem_dir],
1642
- Gem::Dependency.new('m','1').to_specs.map(&:gem_dir).sort,
1544
+ Gem::Dependency.new("m","1").to_specs.map(&:gem_dir).sort,
1643
1545
  "Wrong specs for #{_name}"
1644
1546
 
1645
- spec = Gem::Dependency.new('m','1').to_spec
1547
+ spec = Gem::Dependency.new("m","1").to_spec
1646
1548
 
1647
1549
  assert_equal \
1648
1550
  File.join(_paths.first, "gems", "m-1"),
@@ -1652,7 +1554,7 @@ class TestGem < Gem::TestCase
1652
1554
 
1653
1555
  gem "m"
1654
1556
 
1655
- spec = Gem::Dependency.new('m','1').to_spec
1557
+ spec = Gem::Dependency.new("m","1").to_spec
1656
1558
  assert spec.activated?, "dependency not activated for #{_name}"
1657
1559
 
1658
1560
  assert_equal \
@@ -1667,11 +1569,11 @@ class TestGem < Gem::TestCase
1667
1569
  end
1668
1570
 
1669
1571
  def test_gem_path_ordering_short
1670
- write_file File.join(@tempdir, 'lib', "g.rb") {|fp| fp.puts "" }
1671
- write_file File.join(@tempdir, 'lib', 'm.rb') {|fp| fp.puts "" }
1572
+ write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
1573
+ write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
1672
1574
 
1673
- g = util_spec 'g', '1', nil, "lib/g.rb"
1674
- m = util_spec 'm', '1', nil, "lib/m.rb"
1575
+ g = util_spec "g", "1", nil, "lib/g.rb"
1576
+ m = util_spec "m", "1", nil, "lib/m.rb"
1675
1577
 
1676
1578
  install_gem g, :install_dir => Gem.dir
1677
1579
  install_gem m, :install_dir => Gem.dir
@@ -1681,167 +1583,10 @@ class TestGem < Gem::TestCase
1681
1583
 
1682
1584
  assert_equal \
1683
1585
  File.join(Gem.dir, "gems", "m-1"),
1684
- Gem::Dependency.new('m','1').to_spec.gem_dir,
1586
+ Gem::Dependency.new("m","1").to_spec.gem_dir,
1685
1587
  "Wrong spec selected"
1686
1588
  end
1687
1589
 
1688
- def test_auto_activation_of_specific_gemdeps_file
1689
- a = util_spec "a", "1", nil, "lib/a.rb"
1690
- b = util_spec "b", "1", nil, "lib/b.rb"
1691
- c = util_spec "c", "1", nil, "lib/c.rb"
1692
-
1693
- install_specs a, b, c
1694
-
1695
- path = File.join @tempdir, "gem.deps.rb"
1696
-
1697
- File.open path, "w" do |f|
1698
- f.puts "gem 'a'"
1699
- f.puts "gem 'b'"
1700
- f.puts "gem 'c'"
1701
- end
1702
-
1703
- with_rubygems_gemdeps(path) do
1704
- Gem.use_gemdeps
1705
-
1706
- assert_equal add_bundler_full_name(%W[a-1 b-1 c-1]), loaded_spec_names
1707
- end
1708
- end
1709
-
1710
- def test_auto_activation_of_used_gemdeps_file
1711
- a = util_spec "a", "1", nil, "lib/a.rb"
1712
- b = util_spec "b", "1", nil, "lib/b.rb"
1713
- c = util_spec "c", "1", nil, "lib/c.rb"
1714
-
1715
- install_specs a, b, c
1716
-
1717
- path = File.join @tempdir, "gem.deps.rb"
1718
-
1719
- File.open path, "w" do |f|
1720
- f.puts "gem 'a'"
1721
- f.puts "gem 'b'"
1722
- f.puts "gem 'c'"
1723
- end
1724
-
1725
- with_rubygems_gemdeps("-") do
1726
- expected_specs = [a, b, util_spec("bundler", Bundler::VERSION), c].compact.map(&:full_name)
1727
-
1728
- Gem.use_gemdeps
1729
-
1730
- assert_equal expected_specs, loaded_spec_names
1731
- end
1732
- end
1733
-
1734
- BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }
1735
- BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}".freeze
1736
-
1737
- def add_bundler_full_name(names)
1738
- names << BUNDLER_FULL_NAME
1739
- names.sort!
1740
- names
1741
- end
1742
-
1743
- def test_looks_for_gemdeps_files_automatically_from_binstubs
1744
- pend "Requiring bundler messes things up" if Gem.java_platform?
1745
-
1746
- a = util_spec "a", "1" do |s|
1747
- s.executables = %w[foo]
1748
- s.bindir = "exe"
1749
- end
1750
-
1751
- write_file File.join(@tempdir, 'exe', 'foo') do |fp|
1752
- fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
1753
- end
1754
-
1755
- b = util_spec "b", "1", nil, "lib/b.rb"
1756
- c = util_spec "c", "1", nil, "lib/c.rb"
1757
-
1758
- install_specs a, b, c
1759
-
1760
- path = File.join(@tempdir, "gd-tmp")
1761
- install_gem a, :install_dir => path
1762
- install_gem b, :install_dir => path
1763
- install_gem c, :install_dir => path
1764
-
1765
- ENV['GEM_PATH'] = path
1766
-
1767
- with_rubygems_gemdeps("-") do
1768
- new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
1769
- new_RUBYOPT = "-I#{rubygems_path} -I#{BUNDLER_LIB_PATH}"
1770
-
1771
- path = File.join @tempdir, "gem.deps.rb"
1772
-
1773
- File.open path, "w" do |f|
1774
- f.puts "gem 'a'"
1775
- end
1776
- out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
1777
- IO.popen("foo", &:read).split(/\n/)
1778
- end
1779
-
1780
- File.open path, "a" do |f|
1781
- f.puts "gem 'b'"
1782
- f.puts "gem 'c'"
1783
- end
1784
- out = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
1785
- IO.popen("foo", &:read).split(/\n/)
1786
- end
1787
-
1788
- assert_equal ["b-1", "c-1"], out - out0
1789
- end
1790
- end
1791
-
1792
- def test_looks_for_gemdeps_files_automatically_from_binstubs_in_parent_dir
1793
- pend "Requiring bundler messes things up" if Gem.java_platform?
1794
-
1795
- a = util_spec "a", "1" do |s|
1796
- s.executables = %w[foo]
1797
- s.bindir = "exe"
1798
- end
1799
-
1800
- write_file File.join(@tempdir, 'exe', 'foo') do |fp|
1801
- fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
1802
- end
1803
-
1804
- b = util_spec "b", "1", nil, "lib/b.rb"
1805
- c = util_spec "c", "1", nil, "lib/c.rb"
1806
-
1807
- install_specs a, b, c
1808
-
1809
- path = File.join(@tempdir, "gd-tmp")
1810
- install_gem a, :install_dir => path
1811
- install_gem b, :install_dir => path
1812
- install_gem c, :install_dir => path
1813
-
1814
- ENV['GEM_PATH'] = path
1815
-
1816
- with_rubygems_gemdeps("-") do
1817
- Dir.mkdir "sub1"
1818
-
1819
- new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
1820
- new_RUBYOPT = "-I#{rubygems_path} -I#{BUNDLER_LIB_PATH}"
1821
-
1822
- path = File.join @tempdir, "gem.deps.rb"
1823
-
1824
- File.open path, "w" do |f|
1825
- f.puts "gem 'a'"
1826
- end
1827
- out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
1828
- IO.popen("foo", :chdir => "sub1", &:read).split(/\n/)
1829
- end
1830
-
1831
- File.open path, "a" do |f|
1832
- f.puts "gem 'b'"
1833
- f.puts "gem 'c'"
1834
- end
1835
- out = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
1836
- IO.popen("foo", :chdir => "sub1", &:read).split(/\n/)
1837
- end
1838
-
1839
- Dir.rmdir "sub1"
1840
-
1841
- assert_equal ["b-1", "c-1"], out - out0
1842
- end
1843
- end
1844
-
1845
1590
  def test_register_default_spec
1846
1591
  Gem.clear_default_specs
1847
1592
 
@@ -1882,144 +1627,6 @@ class TestGem < Gem::TestCase
1882
1627
  assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
1883
1628
  end
1884
1629
 
1885
- def test_use_gemdeps
1886
- gem_deps_file = 'gem.deps.rb'.tap(&Gem::UNTAINT)
1887
- spec = util_spec 'a', 1
1888
- install_specs spec
1889
-
1890
- spec = Gem::Specification.find {|s| s == spec }
1891
- refute spec.activated?
1892
-
1893
- File.open gem_deps_file, 'w' do |io|
1894
- io.write 'gem "a"'
1895
- end
1896
-
1897
- assert_nil Gem.gemdeps
1898
-
1899
- Gem.use_gemdeps gem_deps_file
1900
-
1901
- assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
1902
- refute_nil Gem.gemdeps
1903
- end
1904
-
1905
- def test_use_gemdeps_ENV
1906
- with_rubygems_gemdeps(nil) do
1907
- spec = util_spec 'a', 1
1908
-
1909
- refute spec.activated?
1910
-
1911
- File.open 'gem.deps.rb', 'w' do |io|
1912
- io.write 'gem "a"'
1913
- end
1914
-
1915
- Gem.use_gemdeps
1916
-
1917
- refute spec.activated?
1918
- end
1919
- end
1920
-
1921
- def test_use_gemdeps_argument_missing
1922
- e = assert_raise ArgumentError do
1923
- Gem.use_gemdeps 'gem.deps.rb'
1924
- end
1925
-
1926
- assert_equal 'Unable to find gem dependencies file at gem.deps.rb',
1927
- e.message
1928
- end
1929
-
1930
- def test_use_gemdeps_argument_missing_match_ENV
1931
- with_rubygems_gemdeps('gem.deps.rb') do
1932
- e = assert_raise ArgumentError do
1933
- Gem.use_gemdeps 'gem.deps.rb'
1934
- end
1935
-
1936
- assert_equal 'Unable to find gem dependencies file at gem.deps.rb',
1937
- e.message
1938
- end
1939
- end
1940
-
1941
- def test_use_gemdeps_automatic
1942
- with_rubygems_gemdeps('-') do
1943
- spec = util_spec 'a', 1
1944
- install_specs spec
1945
- spec = Gem::Specification.find {|s| s == spec }
1946
-
1947
- refute spec.activated?
1948
-
1949
- File.open 'Gemfile', 'w' do |io|
1950
- io.write 'gem "a"'
1951
- end
1952
-
1953
- Gem.use_gemdeps
1954
-
1955
- assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
1956
- end
1957
- end
1958
-
1959
- def test_use_gemdeps_automatic_missing
1960
- with_rubygems_gemdeps('-') do
1961
- Gem.use_gemdeps
1962
-
1963
- assert true # count
1964
- end
1965
- end
1966
-
1967
- def test_use_gemdeps_disabled
1968
- with_rubygems_gemdeps('') do
1969
- spec = util_spec 'a', 1
1970
-
1971
- refute spec.activated?
1972
-
1973
- File.open 'gem.deps.rb', 'w' do |io|
1974
- io.write 'gem "a"'
1975
- end
1976
-
1977
- Gem.use_gemdeps
1978
-
1979
- refute spec.activated?
1980
- end
1981
- end
1982
-
1983
- def test_use_gemdeps_missing_gem
1984
- with_rubygems_gemdeps('x') do
1985
- File.open 'x', 'w' do |io|
1986
- io.write 'gem "a"'
1987
- end
1988
-
1989
- expected = <<-EXPECTED
1990
- Could not find gem 'a' in locally installed gems.
1991
- You may need to `bundle install` to install missing gems
1992
-
1993
- EXPECTED
1994
-
1995
- Gem::Deprecate.skip_during do
1996
- actual_stdout, actual_stderr = capture_output do
1997
- Gem.use_gemdeps
1998
- end
1999
- assert_empty actual_stdout
2000
- assert_equal(expected, actual_stderr)
2001
- end
2002
- end
2003
- end
2004
-
2005
- def test_use_gemdeps_specific
2006
- with_rubygems_gemdeps('x') do
2007
- spec = util_spec 'a', 1
2008
- install_specs spec
2009
-
2010
- spec = Gem::Specification.find {|s| s == spec }
2011
- refute spec.activated?
2012
-
2013
- File.open 'x', 'w' do |io|
2014
- io.write 'gem "a"'
2015
- end
2016
-
2017
- Gem.use_gemdeps
2018
-
2019
- assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
2020
- end
2021
- end
2022
-
2023
1630
  def test_operating_system_defaults
2024
1631
  operating_system_defaults = Gem.operating_system_defaults
2025
1632
 
@@ -2037,8 +1644,8 @@ You may need to `bundle install` to install missing gems
2037
1644
  # Ensure that `Gem.source_date_epoch` is consistent even if
2038
1645
  # $SOURCE_DATE_EPOCH has not been set.
2039
1646
  def test_default_source_date_epoch_doesnt_change
2040
- old_epoch = ENV['SOURCE_DATE_EPOCH']
2041
- ENV['SOURCE_DATE_EPOCH'] = nil
1647
+ old_epoch = ENV["SOURCE_DATE_EPOCH"]
1648
+ ENV["SOURCE_DATE_EPOCH"] = nil
2042
1649
 
2043
1650
  # Unfortunately, there is no real way to test this aside from waiting
2044
1651
  # enough for `Time.now.to_i` to change -- which is a whole second.
@@ -2049,21 +1656,47 @@ You may need to `bundle install` to install missing gems
2049
1656
  b = Gem.source_date_epoch
2050
1657
  assert_equal a, b
2051
1658
  ensure
2052
- ENV['SOURCE_DATE_EPOCH'] = old_epoch
1659
+ ENV["SOURCE_DATE_EPOCH"] = old_epoch
1660
+ end
1661
+
1662
+ def test_data_home_default
1663
+ expected = File.join(@userhome, ".local", "share")
1664
+ assert_equal expected, Gem.data_home
1665
+ end
1666
+
1667
+ def test_data_home_from_env
1668
+ ENV["XDG_DATA_HOME"] = expected = "/test/data/home"
1669
+ assert_equal expected, Gem.data_home
1670
+ end
1671
+
1672
+ def test_state_home_default
1673
+ Gem.instance_variable_set :@state_home, nil
1674
+ Gem.data_home # memoize @data_home, to demonstrate GH-6418
1675
+ expected = File.join(@userhome, ".local", "state")
1676
+ assert_equal expected, Gem.state_home
1677
+ end
1678
+
1679
+ def test_state_home_from_env
1680
+ Gem.instance_variable_set :@state_home, nil
1681
+ Gem.data_home # memoize @data_home, to demonstrate GH-6418
1682
+ ENV["XDG_STATE_HOME"] = expected = "/test/state/home"
1683
+ assert_equal expected, Gem.state_home
2053
1684
  end
2054
1685
 
1686
+ private
1687
+
2055
1688
  def ruby_install_name(name)
2056
1689
  with_clean_path_to_ruby do
2057
- orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
2058
- RbConfig::CONFIG['ruby_install_name'] = name
1690
+ orig_RUBY_INSTALL_NAME = RbConfig::CONFIG["ruby_install_name"]
1691
+ RbConfig::CONFIG["ruby_install_name"] = name
2059
1692
 
2060
1693
  begin
2061
1694
  yield
2062
1695
  ensure
2063
1696
  if orig_RUBY_INSTALL_NAME
2064
- RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
1697
+ RbConfig::CONFIG["ruby_install_name"] = orig_RUBY_INSTALL_NAME
2065
1698
  else
2066
- RbConfig::CONFIG.delete 'ruby_install_name'
1699
+ RbConfig::CONFIG.delete "ruby_install_name"
2067
1700
  end
2068
1701
  end
2069
1702
  end
@@ -2081,13 +1714,8 @@ You may need to `bundle install` to install missing gems
2081
1714
  end
2082
1715
 
2083
1716
  def redefine_method(base, method, new_result)
2084
- if RUBY_VERSION >= "2.5"
2085
- base.alias_method(method, method)
2086
- base.define_method(method) { new_result }
2087
- else
2088
- base.send(:alias_method, method, method)
2089
- base.send(:define_method, method) { new_result }
2090
- end
1717
+ base.alias_method(method, method)
1718
+ base.define_method(method) { new_result }
2091
1719
  end
2092
1720
 
2093
1721
  def with_plugin(path)
@@ -2118,12 +1746,12 @@ You may need to `bundle install` to install missing gems
2118
1746
  end
2119
1747
 
2120
1748
  def util_exec_gem
2121
- spec, _ = util_spec 'a', '4' do |s|
2122
- s.executables = ['exec', 'abin']
1749
+ spec, _ = util_spec "a", "4" do |s|
1750
+ s.executables = ["exec", "abin"]
2123
1751
  end
2124
1752
 
2125
- @exec_path = File.join spec.full_gem_path, spec.bindir, 'exec'
2126
- @abin_path = File.join spec.full_gem_path, spec.bindir, 'abin'
1753
+ @exec_path = File.join spec.full_gem_path, spec.bindir, "exec"
1754
+ @abin_path = File.join spec.full_gem_path, spec.bindir, "abin"
2127
1755
  spec
2128
1756
  end
2129
1757
 
@@ -2135,22 +1763,4 @@ You may need to `bundle install` to install missing gems
2135
1763
  def util_cache_dir
2136
1764
  File.join Gem.dir, "cache"
2137
1765
  end
2138
-
2139
- def with_path_and_rubyopt(path_value, rubyopt_value)
2140
- path, ENV['PATH'] = ENV['PATH'], path_value
2141
- rubyopt, ENV['RUBYOPT'] = ENV['RUBYOPT'], rubyopt_value
2142
-
2143
- yield
2144
- ensure
2145
- ENV['PATH'] = path
2146
- ENV['RUBYOPT'] = rubyopt
2147
- end
2148
-
2149
- def with_rubygems_gemdeps(value)
2150
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], value
2151
-
2152
- yield
2153
- ensure
2154
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
2155
- end
2156
1766
  end