rubygems-update 3.1.6 → 3.4.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (784) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5619 -0
  3. data/CODE_OF_CONDUCT.md +55 -19
  4. data/CONTRIBUTING.md +97 -27
  5. data/Manifest.txt +185 -143
  6. data/POLICIES.md +70 -27
  7. data/README.md +29 -14
  8. data/UPGRADING.md +5 -81
  9. data/bin/gem +2 -10
  10. data/bin/update_rubygems +5 -5
  11. data/bundler/CHANGELOG.md +2605 -1431
  12. data/bundler/README.md +9 -14
  13. data/bundler/UPGRADING.md +27 -34
  14. data/bundler/bundler.gemspec +10 -13
  15. data/bundler/exe/bundle +7 -8
  16. data/bundler/exe/bundler +1 -1
  17. data/bundler/lib/bundler/.document +1 -0
  18. data/bundler/lib/bundler/build_metadata.rb +4 -12
  19. data/bundler/lib/bundler/cli/add.rb +2 -2
  20. data/bundler/lib/bundler/cli/binstubs.rb +11 -3
  21. data/bundler/lib/bundler/cli/cache.rb +3 -8
  22. data/bundler/lib/bundler/cli/check.rb +5 -3
  23. data/bundler/lib/bundler/cli/clean.rb +1 -1
  24. data/bundler/lib/bundler/cli/common.rb +32 -3
  25. data/bundler/lib/bundler/cli/config.rb +10 -1
  26. data/bundler/lib/bundler/cli/console.rb +3 -3
  27. data/bundler/lib/bundler/cli/doctor.rb +23 -6
  28. data/bundler/lib/bundler/cli/exec.rb +5 -10
  29. data/bundler/lib/bundler/cli/fund.rb +36 -0
  30. data/bundler/lib/bundler/cli/gem.rb +258 -45
  31. data/bundler/lib/bundler/cli/info.rb +38 -6
  32. data/bundler/lib/bundler/cli/init.rb +7 -3
  33. data/bundler/lib/bundler/cli/inject.rb +1 -1
  34. data/bundler/lib/bundler/cli/install.rb +27 -57
  35. data/bundler/lib/bundler/cli/issue.rb +5 -4
  36. data/bundler/lib/bundler/cli/list.rb +19 -11
  37. data/bundler/lib/bundler/cli/lock.rb +11 -4
  38. data/bundler/lib/bundler/cli/open.rb +7 -6
  39. data/bundler/lib/bundler/cli/outdated.rb +106 -79
  40. data/bundler/lib/bundler/cli/platform.rb +2 -2
  41. data/bundler/lib/bundler/cli/plugin.rb +10 -0
  42. data/bundler/lib/bundler/cli/pristine.rb +5 -0
  43. data/bundler/lib/bundler/cli/remove.rb +1 -2
  44. data/bundler/lib/bundler/cli/show.rb +2 -2
  45. data/bundler/lib/bundler/cli/update.rb +20 -9
  46. data/bundler/lib/bundler/cli/viz.rb +1 -1
  47. data/bundler/lib/bundler/cli.rb +151 -85
  48. data/bundler/lib/bundler/compact_index_client/cache.rb +7 -24
  49. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  50. data/bundler/lib/bundler/compact_index_client/updater.rb +56 -51
  51. data/bundler/lib/bundler/compact_index_client.rb +3 -9
  52. data/bundler/lib/bundler/constants.rb +1 -1
  53. data/bundler/lib/bundler/current_ruby.rb +19 -6
  54. data/bundler/lib/bundler/definition.rb +353 -440
  55. data/bundler/lib/bundler/dependency.rb +23 -77
  56. data/bundler/lib/bundler/digest.rb +71 -0
  57. data/bundler/lib/bundler/dsl.rb +77 -85
  58. data/bundler/lib/bundler/endpoint_specification.rb +16 -14
  59. data/bundler/lib/bundler/env.rb +3 -3
  60. data/bundler/lib/bundler/environment_preserver.rb +32 -4
  61. data/bundler/lib/bundler/errors.rb +31 -14
  62. data/bundler/lib/bundler/feature_flag.rb +0 -9
  63. data/bundler/lib/bundler/fetcher/base.rb +7 -9
  64. data/bundler/lib/bundler/fetcher/compact_index.rb +20 -27
  65. data/bundler/lib/bundler/fetcher/dependency.rb +2 -6
  66. data/bundler/lib/bundler/fetcher/downloader.rb +11 -11
  67. data/bundler/lib/bundler/fetcher/index.rb +2 -30
  68. data/bundler/lib/bundler/fetcher.rb +26 -31
  69. data/bundler/lib/bundler/force_platform.rb +18 -0
  70. data/bundler/lib/bundler/friendly_errors.rb +45 -49
  71. data/bundler/lib/bundler/gem_helper.rb +53 -31
  72. data/bundler/lib/bundler/gem_helpers.rb +42 -24
  73. data/bundler/lib/bundler/gem_version_promoter.rb +54 -99
  74. data/bundler/lib/bundler/graph.rb +4 -4
  75. data/bundler/lib/bundler/index.rb +16 -54
  76. data/bundler/lib/bundler/injector.rb +41 -9
  77. data/bundler/lib/bundler/inline.rb +11 -22
  78. data/bundler/lib/bundler/installer/gem_installer.rb +19 -24
  79. data/bundler/lib/bundler/installer/parallel_installer.rb +34 -43
  80. data/bundler/lib/bundler/installer/standalone.rb +62 -11
  81. data/bundler/lib/bundler/installer.rb +43 -87
  82. data/bundler/lib/bundler/lazy_specification.rb +88 -51
  83. data/bundler/lib/bundler/lockfile_generator.rb +4 -4
  84. data/bundler/lib/bundler/lockfile_parser.rb +34 -59
  85. data/bundler/lib/bundler/man/.document +1 -0
  86. data/bundler/{man → lib/bundler/man}/bundle-add.1 +21 -5
  87. data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +16 -4
  88. data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +5 -3
  89. data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +2 -4
  90. data/bundler/{man → lib/bundler/man}/bundle-cache.1 +7 -1
  91. data/bundler/{man/bundle-cache.ronn → lib/bundler/man/bundle-cache.1.ronn} +7 -0
  92. data/bundler/{man → lib/bundler/man}/bundle-check.1 +1 -1
  93. data/bundler/{man → lib/bundler/man}/bundle-clean.1 +2 -2
  94. data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
  95. data/bundler/{man → lib/bundler/man}/bundle-config.1 +66 -48
  96. data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +75 -66
  97. data/bundler/lib/bundler/man/bundle-console.1 +53 -0
  98. data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
  99. data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  100. data/bundler/{man → lib/bundler/man}/bundle-exec.1 +6 -6
  101. data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +6 -6
  102. data/bundler/lib/bundler/man/bundle-gem.1 +105 -0
  103. data/bundler/lib/bundler/man/bundle-gem.1.ronn +117 -0
  104. data/bundler/lib/bundler/man/bundle-help.1 +13 -0
  105. data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
  106. data/bundler/{man → lib/bundler/man}/bundle-info.1 +1 -1
  107. data/bundler/{man → lib/bundler/man}/bundle-init.1 +5 -1
  108. data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +2 -0
  109. data/bundler/{man → lib/bundler/man}/bundle-inject.1 +5 -2
  110. data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
  111. data/bundler/{man → lib/bundler/man}/bundle-install.1 +35 -33
  112. data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +33 -34
  113. data/bundler/{man → lib/bundler/man}/bundle-list.1 +7 -7
  114. data/bundler/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
  115. data/bundler/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  116. data/bundler/{man → lib/bundler/man}/bundle-open.1 +22 -2
  117. data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +9 -1
  118. data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
  119. data/bundler/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
  120. data/bundler/{man → lib/bundler/man}/bundle-platform.1 +16 -6
  121. data/bundler/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
  122. data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
  123. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  124. data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  125. data/bundler/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  126. data/bundler/{man → lib/bundler/man}/bundle-show.1 +1 -1
  127. data/bundler/{man → lib/bundler/man}/bundle-update.1 +5 -5
  128. data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +5 -4
  129. data/bundler/lib/bundler/man/bundle-version.1 +35 -0
  130. data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
  131. data/bundler/{man → lib/bundler/man}/bundle-viz.1 +4 -1
  132. data/bundler/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
  133. data/bundler/{man → lib/bundler/man}/bundle.1 +15 -10
  134. data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +12 -7
  135. data/bundler/{man → lib/bundler/man}/gemfile.5 +120 -83
  136. data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +109 -88
  137. data/bundler/{man → lib/bundler/man}/index.txt +4 -0
  138. data/bundler/lib/bundler/match_metadata.rb +13 -0
  139. data/bundler/lib/bundler/match_platform.rb +0 -1
  140. data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
  141. data/bundler/lib/bundler/mirror.rb +7 -9
  142. data/bundler/lib/bundler/plugin/api/source.rb +25 -9
  143. data/bundler/lib/bundler/plugin/dsl.rb +1 -1
  144. data/bundler/lib/bundler/plugin/index.rb +17 -5
  145. data/bundler/lib/bundler/plugin/installer/git.rb +0 -4
  146. data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -9
  147. data/bundler/lib/bundler/plugin/installer.rb +16 -13
  148. data/bundler/lib/bundler/plugin/source_list.rb +5 -1
  149. data/bundler/lib/bundler/plugin.rb +59 -12
  150. data/bundler/lib/bundler/process_lock.rb +1 -1
  151. data/bundler/lib/bundler/remote_specification.rb +12 -7
  152. data/bundler/lib/bundler/resolver/base.rb +109 -0
  153. data/bundler/lib/bundler/resolver/candidate.rb +94 -0
  154. data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
  155. data/bundler/lib/bundler/resolver/package.rb +72 -0
  156. data/bundler/lib/bundler/resolver/root.rb +25 -0
  157. data/bundler/lib/bundler/resolver/spec_group.rb +49 -74
  158. data/bundler/lib/bundler/resolver.rb +336 -344
  159. data/bundler/lib/bundler/retry.rb +2 -2
  160. data/bundler/lib/bundler/ruby_dsl.rb +1 -1
  161. data/bundler/lib/bundler/ruby_version.rb +6 -19
  162. data/bundler/lib/bundler/rubygems_ext.rb +231 -32
  163. data/bundler/lib/bundler/rubygems_gem_installer.rb +89 -16
  164. data/bundler/lib/bundler/rubygems_integration.rb +81 -167
  165. data/bundler/lib/bundler/runtime.rb +23 -31
  166. data/bundler/lib/bundler/self_manager.rb +168 -0
  167. data/bundler/lib/bundler/settings.rb +146 -73
  168. data/bundler/lib/bundler/setup.rb +5 -2
  169. data/bundler/lib/bundler/shared_helpers.rb +20 -35
  170. data/bundler/lib/bundler/similarity_detector.rb +1 -1
  171. data/bundler/lib/bundler/source/git/git_proxy.rb +263 -114
  172. data/bundler/lib/bundler/source/git.rb +64 -47
  173. data/bundler/lib/bundler/source/metadata.rb +3 -8
  174. data/bundler/lib/bundler/source/path/installer.rb +11 -32
  175. data/bundler/lib/bundler/source/path.rb +16 -10
  176. data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
  177. data/bundler/lib/bundler/source/rubygems.rb +167 -200
  178. data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
  179. data/bundler/lib/bundler/source.rb +25 -5
  180. data/bundler/lib/bundler/source_list.rb +112 -64
  181. data/bundler/lib/bundler/source_map.rb +71 -0
  182. data/bundler/lib/bundler/spec_set.rb +74 -61
  183. data/bundler/lib/bundler/stub_specification.rb +30 -10
  184. data/bundler/lib/bundler/templates/Executable +3 -5
  185. data/bundler/lib/bundler/templates/Executable.bundler +11 -16
  186. data/bundler/lib/bundler/templates/Executable.standalone +4 -4
  187. data/bundler/lib/bundler/templates/Gemfile +0 -2
  188. data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  189. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  190. data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  191. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +15 -1
  192. data/bundler/lib/bundler/templates/newgem/README.md.tt +13 -16
  193. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +43 -5
  194. data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -0
  195. data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
  196. data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  197. data/bundler/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +2 -0
  198. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  199. data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  200. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
  201. data/bundler/lib/bundler/templates/newgem/gitignore.tt +3 -0
  202. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
  203. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  204. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  205. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +34 -18
  206. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  207. data/bundler/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  208. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  209. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  210. data/bundler/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  211. data/bundler/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
  212. data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
  213. data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  214. data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  215. data/bundler/lib/bundler/ui/shell.rb +37 -14
  216. data/bundler/lib/bundler/ui/silent.rb +21 -5
  217. data/bundler/lib/bundler/uri_credentials_filter.rb +3 -1
  218. data/bundler/lib/bundler/uri_normalizer.rb +23 -0
  219. data/bundler/lib/bundler/vendor/.document +1 -0
  220. data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  221. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  222. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  223. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
  224. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +41 -74
  225. data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  226. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
  227. data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  228. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +82 -189
  229. data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  230. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  231. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  232. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  233. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
  234. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  235. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  236. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  237. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  238. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
  239. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  240. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  241. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
  242. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
  243. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +243 -0
  244. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  245. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  246. data/bundler/lib/bundler/vendor/thor/LICENSE.md +20 -0
  247. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  248. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +9 -7
  249. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  250. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
  251. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
  252. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  253. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +10 -5
  254. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
  255. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
  256. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +28 -7
  257. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  258. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  259. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  260. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  261. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +5 -13
  262. data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  263. data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
  264. data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  265. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +76 -91
  266. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
  267. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
  268. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +32 -13
  269. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
  270. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
  271. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
  272. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
  273. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
  274. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +14 -21
  275. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +11 -17
  276. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  277. data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
  278. data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
  279. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +3 -3
  280. data/bundler/lib/bundler/vendored_persistent.rb +1 -40
  281. data/bundler/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
  282. data/bundler/lib/bundler/vendored_tsort.rb +4 -0
  283. data/bundler/lib/bundler/version.rb +5 -1
  284. data/bundler/lib/bundler/worker.rb +25 -12
  285. data/bundler/lib/bundler/yaml_serializer.rb +1 -1
  286. data/bundler/lib/bundler.rb +98 -110
  287. data/hide_lib_for_update/note.txt +0 -4
  288. data/lib/rubygems/available_set.rb +7 -9
  289. data/lib/rubygems/basic_specification.rb +23 -21
  290. data/lib/rubygems/bundler_version_finder.rb +27 -54
  291. data/lib/rubygems/command.rb +63 -52
  292. data/lib/rubygems/command_manager.rb +36 -16
  293. data/lib/rubygems/commands/build_command.rb +50 -27
  294. data/lib/rubygems/commands/cert_command.rb +78 -75
  295. data/lib/rubygems/commands/check_command.rb +20 -22
  296. data/lib/rubygems/commands/cleanup_command.rb +30 -26
  297. data/lib/rubygems/commands/contents_command.rb +16 -18
  298. data/lib/rubygems/commands/dependency_command.rb +39 -51
  299. data/lib/rubygems/commands/environment_command.rb +11 -10
  300. data/lib/rubygems/commands/exec_command.rb +248 -0
  301. data/lib/rubygems/commands/fetch_command.rb +33 -16
  302. data/lib/rubygems/commands/generate_index_command.rb +17 -19
  303. data/lib/rubygems/commands/help_command.rb +9 -9
  304. data/lib/rubygems/commands/info_command.rb +10 -7
  305. data/lib/rubygems/commands/install_command.rb +36 -30
  306. data/lib/rubygems/commands/list_command.rb +9 -8
  307. data/lib/rubygems/commands/lock_command.rb +5 -7
  308. data/lib/rubygems/commands/mirror_command.rb +3 -5
  309. data/lib/rubygems/commands/open_command.rb +10 -14
  310. data/lib/rubygems/commands/outdated_command.rb +5 -7
  311. data/lib/rubygems/commands/owner_command.rb +26 -16
  312. data/lib/rubygems/commands/pristine_command.rb +70 -49
  313. data/lib/rubygems/commands/push_command.rb +22 -59
  314. data/lib/rubygems/commands/query_command.rb +21 -351
  315. data/lib/rubygems/commands/rdoc_command.rb +26 -27
  316. data/lib/rubygems/commands/search_command.rb +8 -8
  317. data/lib/rubygems/commands/server_command.rb +16 -77
  318. data/lib/rubygems/commands/setup_command.rb +255 -229
  319. data/lib/rubygems/commands/signin_command.rb +9 -11
  320. data/lib/rubygems/commands/signout_command.rb +7 -9
  321. data/lib/rubygems/commands/sources_command.rb +27 -25
  322. data/lib/rubygems/commands/specification_command.rb +25 -21
  323. data/lib/rubygems/commands/stale_command.rb +3 -5
  324. data/lib/rubygems/commands/uninstall_command.rb +44 -43
  325. data/lib/rubygems/commands/unpack_command.rb +14 -16
  326. data/lib/rubygems/commands/update_command.rb +126 -74
  327. data/lib/rubygems/commands/which_command.rb +7 -9
  328. data/lib/rubygems/commands/yank_command.rb +16 -19
  329. data/lib/rubygems/compatibility.rb +4 -2
  330. data/lib/rubygems/config_file.rb +75 -26
  331. data/lib/rubygems/core_ext/kernel_gem.rb +1 -6
  332. data/lib/rubygems/core_ext/kernel_require.rb +108 -112
  333. data/lib/rubygems/core_ext/kernel_warn.rb +31 -36
  334. data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
  335. data/lib/rubygems/defaults.rb +124 -34
  336. data/lib/rubygems/dependency.rb +24 -22
  337. data/lib/rubygems/dependency_installer.rb +43 -115
  338. data/lib/rubygems/dependency_list.rb +13 -15
  339. data/lib/rubygems/deprecate.rb +102 -8
  340. data/lib/rubygems/doctor.rb +22 -22
  341. data/lib/rubygems/errors.rb +6 -21
  342. data/lib/rubygems/exceptions.rb +34 -37
  343. data/lib/rubygems/ext/build_error.rb +2 -0
  344. data/lib/rubygems/ext/builder.rb +64 -54
  345. data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +27 -0
  346. data/lib/rubygems/ext/cargo_builder.rb +360 -0
  347. data/lib/rubygems/ext/cmake_builder.rb +6 -9
  348. data/lib/rubygems/ext/configure_builder.rb +5 -8
  349. data/lib/rubygems/ext/ext_conf_builder.rb +43 -66
  350. data/lib/rubygems/ext/rake_builder.rb +7 -10
  351. data/lib/rubygems/ext.rb +7 -6
  352. data/lib/rubygems/gem_runner.rb +15 -26
  353. data/lib/rubygems/gemcutter_utilities.rb +161 -33
  354. data/lib/rubygems/indexer.rb +31 -50
  355. data/lib/rubygems/install_default_message.rb +2 -2
  356. data/lib/rubygems/install_message.rb +2 -2
  357. data/lib/rubygems/install_update_options.rb +73 -64
  358. data/lib/rubygems/installer.rb +199 -156
  359. data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
  360. data/lib/rubygems/local_remote_options.rb +22 -24
  361. data/lib/rubygems/mock_gem_ui.rb +2 -8
  362. data/lib/rubygems/name_tuple.rb +9 -14
  363. data/lib/rubygems/openssl.rb +7 -0
  364. data/lib/rubygems/optparse/.document +1 -0
  365. data/lib/rubygems/optparse/COPYING +56 -0
  366. data/lib/rubygems/optparse/lib/optionparser.rb +2 -0
  367. data/lib/rubygems/optparse/lib/optparse/ac.rb +54 -0
  368. data/lib/rubygems/optparse/lib/optparse/date.rb +18 -0
  369. data/lib/rubygems/optparse/lib/optparse/kwargs.rb +22 -0
  370. data/lib/rubygems/optparse/lib/optparse/shellwords.rb +7 -0
  371. data/lib/rubygems/optparse/lib/optparse/time.rb +11 -0
  372. data/lib/rubygems/optparse/lib/optparse/uri.rb +7 -0
  373. data/lib/rubygems/optparse/lib/optparse/version.rb +71 -0
  374. data/lib/rubygems/optparse/lib/optparse.rb +2308 -0
  375. data/lib/rubygems/optparse.rb +3 -0
  376. data/lib/rubygems/package/digest_io.rb +0 -2
  377. data/lib/rubygems/package/file_source.rb +2 -4
  378. data/lib/rubygems/package/io_source.rb +4 -2
  379. data/lib/rubygems/package/old.rb +9 -11
  380. data/lib/rubygems/package/tar_header.rb +65 -67
  381. data/lib/rubygems/package/tar_reader/entry.rb +89 -11
  382. data/lib/rubygems/package/tar_reader.rb +1 -32
  383. data/lib/rubygems/package/tar_writer.rb +8 -18
  384. data/lib/rubygems/package.rb +109 -120
  385. data/lib/rubygems/package_task.rb +5 -11
  386. data/lib/rubygems/path_support.rb +2 -9
  387. data/lib/rubygems/platform.rb +113 -74
  388. data/lib/rubygems/psych_tree.rb +1 -3
  389. data/lib/rubygems/query_utils.rb +351 -0
  390. data/lib/rubygems/rdoc.rb +2 -14
  391. data/lib/rubygems/remote_fetcher.rb +48 -74
  392. data/lib/rubygems/request/connection_pools.rb +6 -10
  393. data/lib/rubygems/request/http_pool.rb +2 -4
  394. data/lib/rubygems/request/https_pool.rb +0 -2
  395. data/lib/rubygems/request.rb +26 -31
  396. data/lib/rubygems/request_set/gem_dependency_api.rb +127 -130
  397. data/lib/rubygems/request_set/lockfile/parser.rb +26 -28
  398. data/lib/rubygems/request_set/lockfile/tokenizer.rb +5 -7
  399. data/lib/rubygems/request_set/lockfile.rb +17 -21
  400. data/lib/rubygems/request_set.rb +27 -40
  401. data/lib/rubygems/requirement.rb +29 -49
  402. data/lib/rubygems/resolver/activation_request.rb +12 -6
  403. data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
  404. data/lib/rubygems/resolver/api_set.rb +32 -25
  405. data/lib/rubygems/resolver/api_specification.rb +29 -15
  406. data/lib/rubygems/resolver/best_set.rb +7 -9
  407. data/lib/rubygems/resolver/composed_set.rb +3 -5
  408. data/lib/rubygems/resolver/conflict.rb +12 -14
  409. data/lib/rubygems/resolver/current_set.rb +0 -2
  410. data/lib/rubygems/resolver/dependency_request.rb +3 -5
  411. data/lib/rubygems/resolver/git_set.rb +2 -4
  412. data/lib/rubygems/resolver/git_specification.rb +6 -8
  413. data/lib/rubygems/resolver/index_set.rb +4 -6
  414. data/lib/rubygems/resolver/index_specification.rb +38 -7
  415. data/lib/rubygems/resolver/installed_specification.rb +4 -6
  416. data/lib/rubygems/resolver/installer_set.rb +66 -24
  417. data/lib/rubygems/resolver/local_specification.rb +2 -4
  418. data/lib/rubygems/resolver/lock_set.rb +6 -8
  419. data/lib/rubygems/resolver/lock_specification.rb +4 -6
  420. data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
  421. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  422. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +8 -0
  423. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  424. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
  425. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
  426. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
  427. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
  428. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
  429. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
  430. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
  431. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +51 -12
  432. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +42 -9
  433. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +82 -8
  434. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  435. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +13 -1
  436. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
  437. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +510 -165
  438. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
  439. data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
  440. data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
  441. data/lib/rubygems/resolver/molinillo.rb +1 -1
  442. data/lib/rubygems/resolver/requirement_list.rb +0 -2
  443. data/lib/rubygems/resolver/set.rb +0 -3
  444. data/lib/rubygems/resolver/source_set.rb +0 -2
  445. data/lib/rubygems/resolver/spec_specification.rb +14 -2
  446. data/lib/rubygems/resolver/specification.rb +14 -4
  447. data/lib/rubygems/resolver/stats.rb +1 -3
  448. data/lib/rubygems/resolver/vendor_set.rb +1 -3
  449. data/lib/rubygems/resolver/vendor_specification.rb +3 -5
  450. data/lib/rubygems/resolver.rb +53 -51
  451. data/lib/rubygems/s3_uri_signer.rb +7 -15
  452. data/lib/rubygems/safe_yaml.rb +14 -16
  453. data/lib/rubygems/security/policies.rb +47 -47
  454. data/lib/rubygems/security/policy.rb +25 -29
  455. data/lib/rubygems/security/signer.rb +13 -16
  456. data/lib/rubygems/security/trust_dir.rb +5 -6
  457. data/lib/rubygems/security.rb +90 -69
  458. data/lib/rubygems/security_option.rb +7 -7
  459. data/lib/rubygems/source/git.rb +31 -31
  460. data/lib/rubygems/source/installed.rb +1 -3
  461. data/lib/rubygems/source/local.rb +4 -6
  462. data/lib/rubygems/source/lock.rb +0 -2
  463. data/lib/rubygems/source/specific_file.rb +1 -3
  464. data/lib/rubygems/source/vendor.rb +0 -2
  465. data/lib/rubygems/source.rb +44 -38
  466. data/lib/rubygems/source_list.rb +9 -16
  467. data/lib/rubygems/spec_fetcher.rb +49 -48
  468. data/lib/rubygems/specification.rb +382 -343
  469. data/lib/rubygems/specification_policy.rb +131 -61
  470. data/lib/rubygems/stub_specification.rb +24 -31
  471. data/lib/rubygems/text.rb +22 -21
  472. data/lib/rubygems/tsort/.document +1 -0
  473. data/lib/rubygems/tsort/LICENSE.txt +22 -0
  474. data/lib/rubygems/tsort/lib/tsort.rb +452 -0
  475. data/lib/rubygems/tsort.rb +3 -0
  476. data/lib/rubygems/uninstaller.rb +98 -45
  477. data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
  478. data/lib/rubygems/update_suggestion.rb +69 -0
  479. data/lib/rubygems/uri.rb +126 -0
  480. data/lib/rubygems/uri_formatter.rb +2 -3
  481. data/lib/rubygems/user_interaction.rb +43 -54
  482. data/lib/rubygems/util/licenses.rb +115 -10
  483. data/lib/rubygems/util/list.rb +0 -2
  484. data/lib/rubygems/util.rb +19 -17
  485. data/lib/rubygems/validator.rb +7 -9
  486. data/lib/rubygems/version.rb +31 -22
  487. data/lib/rubygems/version_option.rb +11 -5
  488. data/lib/rubygems.rb +213 -290
  489. data/rubygems-update.gemspec +5 -5
  490. data/setup.rb +11 -22
  491. data/test/rubygems/alternate_cert.pem +14 -14
  492. data/test/rubygems/alternate_cert_32.pem +15 -15
  493. data/test/rubygems/alternate_key.pem +25 -25
  494. data/test/rubygems/bundler_test_gem.rb +419 -0
  495. data/test/rubygems/child_cert.pem +15 -16
  496. data/test/rubygems/child_cert_32.pem +15 -16
  497. data/test/rubygems/child_key.pem +25 -25
  498. data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
  499. data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
  500. data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
  501. data/test/rubygems/data/pry-0.4.7.gemspec.rz +0 -0
  502. data/test/rubygems/encrypted_private_key.pem +26 -26
  503. data/test/rubygems/expired_cert.pem +15 -15
  504. data/test/rubygems/future_cert.pem +15 -15
  505. data/test/rubygems/future_cert_32.pem +15 -15
  506. data/test/rubygems/grandchild_cert.pem +15 -16
  507. data/test/rubygems/grandchild_cert_32.pem +15 -16
  508. data/test/rubygems/grandchild_key.pem +25 -25
  509. data/{lib/rubygems/test_case.rb → test/rubygems/helper.rb} +402 -327
  510. data/{lib → test}/rubygems/installer_test_case.rb +38 -24
  511. data/test/rubygems/invalid_issuer_cert.pem +16 -16
  512. data/test/rubygems/invalid_issuer_cert_32.pem +16 -16
  513. data/test/rubygems/invalid_key.pem +25 -25
  514. data/test/rubygems/invalid_signer_cert.pem +15 -15
  515. data/test/rubygems/invalid_signer_cert_32.pem +15 -15
  516. data/test/rubygems/invalidchild_cert.pem +15 -16
  517. data/test/rubygems/invalidchild_cert_32.pem +15 -16
  518. data/test/rubygems/invalidchild_key.pem +25 -25
  519. data/{lib → test}/rubygems/package/tar_test_case.rb +51 -18
  520. data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
  521. data/test/rubygems/packages/ascii_binder-0.1.10.1.gem +0 -0
  522. data/test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem +0 -0
  523. data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
  524. data/test/rubygems/plugin/load/rubygems_plugin.rb +0 -2
  525. data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
  526. data/test/rubygems/private_ec_key.pem +9 -0
  527. data/test/rubygems/private_key.pem +25 -25
  528. data/test/rubygems/public_cert.pem +16 -16
  529. data/test/rubygems/public_cert_32.pem +15 -15
  530. data/test/rubygems/public_key.pem +7 -7
  531. data/test/rubygems/rubygems/commands/crash_command.rb +0 -2
  532. data/test/rubygems/rubygems_plugin.rb +2 -4
  533. data/test/rubygems/simple_gem.rb +1 -1
  534. data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
  535. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +4 -6
  536. data/test/rubygems/test_bundled_ca.rb +43 -50
  537. data/test/rubygems/test_config.rb +5 -7
  538. data/test/rubygems/test_deprecate.rb +87 -10
  539. data/test/rubygems/test_exit.rb +17 -0
  540. data/test/rubygems/test_gem.rb +560 -826
  541. data/test/rubygems/test_gem_available_set.rb +24 -26
  542. data/test/rubygems/test_gem_bundler_version_finder.rb +40 -46
  543. data/test/rubygems/test_gem_command.rb +78 -49
  544. data/test/rubygems/test_gem_command_manager.rb +163 -35
  545. data/test/rubygems/test_gem_commands_build_command.rb +285 -57
  546. data/test/rubygems/test_gem_commands_cert_command.rb +180 -125
  547. data/test/rubygems/test_gem_commands_check_command.rb +9 -11
  548. data/test/rubygems/test_gem_commands_cleanup_command.rb +78 -69
  549. data/test/rubygems/test_gem_commands_contents_command.rb +73 -42
  550. data/test/rubygems/test_gem_commands_dependency_command.rb +38 -40
  551. data/test/rubygems/test_gem_commands_environment_command.rb +60 -38
  552. data/test/rubygems/test_gem_commands_exec_command.rb +851 -0
  553. data/test/rubygems/test_gem_commands_fetch_command.rb +163 -32
  554. data/test/rubygems/test_gem_commands_generate_index_command.rb +8 -14
  555. data/test/rubygems/test_gem_commands_help_command.rb +34 -16
  556. data/test/rubygems/test_gem_commands_info_command.rb +33 -9
  557. data/test/rubygems/test_gem_commands_install_command.rb +420 -198
  558. data/test/rubygems/test_gem_commands_list_command.rb +5 -7
  559. data/test/rubygems/test_gem_commands_lock_command.rb +11 -13
  560. data/test/rubygems/test_gem_commands_mirror.rb +3 -5
  561. data/test/rubygems/test_gem_commands_open_command.rb +16 -19
  562. data/test/rubygems/test_gem_commands_outdated_command.rb +23 -7
  563. data/test/rubygems/test_gem_commands_owner_command.rb +181 -46
  564. data/test/rubygems/test_gem_commands_pristine_command.rb +179 -99
  565. data/test/rubygems/test_gem_commands_push_command.rb +156 -67
  566. data/test/rubygems/test_gem_commands_query_command.rb +91 -91
  567. data/test/rubygems/test_gem_commands_search_command.rb +2 -4
  568. data/test/rubygems/test_gem_commands_server_command.rb +6 -50
  569. data/test/rubygems/test_gem_commands_setup_command.rb +285 -183
  570. data/test/rubygems/test_gem_commands_signin_command.rb +187 -28
  571. data/test/rubygems/test_gem_commands_signout_command.rb +3 -10
  572. data/test/rubygems/test_gem_commands_sources_command.rb +139 -32
  573. data/test/rubygems/test_gem_commands_specification_command.rb +81 -55
  574. data/test/rubygems/test_gem_commands_stale_command.rb +4 -6
  575. data/test/rubygems/test_gem_commands_uninstall_command.rb +102 -87
  576. data/test/rubygems/test_gem_commands_unpack_command.rb +32 -34
  577. data/test/rubygems/test_gem_commands_update_command.rb +341 -94
  578. data/test/rubygems/test_gem_commands_which_command.rb +12 -14
  579. data/test/rubygems/test_gem_commands_yank_command.rb +80 -44
  580. data/test/rubygems/test_gem_config_file.rb +114 -97
  581. data/test/rubygems/test_gem_dependency.rb +88 -86
  582. data/test/rubygems/test_gem_dependency_installer.rb +277 -391
  583. data/test/rubygems/test_gem_dependency_list.rb +57 -59
  584. data/test/rubygems/test_gem_dependency_resolution_error.rb +5 -7
  585. data/test/rubygems/test_gem_doctor.rb +73 -47
  586. data/test/rubygems/test_gem_ext_builder.rb +115 -111
  587. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
  588. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +8 -0
  589. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +233 -0
  590. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml +10 -0
  591. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/src/lib.rs +27 -0
  592. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +1 -0
  593. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore +1 -0
  594. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +247 -0
  595. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +10 -0
  596. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec +8 -0
  597. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +51 -0
  598. data/test/rubygems/test_gem_ext_cargo_builder.rb +166 -0
  599. data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +33 -0
  600. data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +60 -0
  601. data/test/rubygems/test_gem_ext_cmake_builder.rb +31 -38
  602. data/test/rubygems/test_gem_ext_configure_builder.rb +23 -39
  603. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +66 -82
  604. data/test/rubygems/test_gem_ext_rake_builder.rb +49 -32
  605. data/test/rubygems/test_gem_gem_runner.rb +57 -9
  606. data/test/rubygems/test_gem_gemcutter_utilities.rb +91 -76
  607. data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -6
  608. data/test/rubygems/test_gem_indexer.rb +100 -83
  609. data/test/rubygems/test_gem_install_update_options.rb +31 -21
  610. data/test/rubygems/test_gem_installer.rb +857 -484
  611. data/test/rubygems/test_gem_local_remote_options.rb +11 -13
  612. data/test/rubygems/test_gem_name_tuple.rb +4 -6
  613. data/test/rubygems/test_gem_package.rb +330 -305
  614. data/test/rubygems/test_gem_package_old.rb +18 -20
  615. data/test/rubygems/test_gem_package_tar_header.rb +69 -52
  616. data/test/rubygems/test_gem_package_tar_reader.rb +54 -9
  617. data/test/rubygems/test_gem_package_tar_reader_entry.rb +168 -25
  618. data/test/rubygems/test_gem_package_tar_writer.rb +96 -100
  619. data/test/rubygems/test_gem_package_task.rb +58 -25
  620. data/test/rubygems/test_gem_path_support.rb +15 -21
  621. data/test/rubygems/test_gem_platform.rb +388 -201
  622. data/test/rubygems/test_gem_rdoc.rb +19 -21
  623. data/test/rubygems/test_gem_remote_fetcher.rb +377 -338
  624. data/test/rubygems/test_gem_request.rb +114 -86
  625. data/test/rubygems/test_gem_request_connection_pools.rb +30 -34
  626. data/test/rubygems/test_gem_request_set.rb +124 -125
  627. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +227 -231
  628. data/test/rubygems/test_gem_request_set_lockfile.rb +93 -95
  629. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +69 -71
  630. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +136 -138
  631. data/test/rubygems/test_gem_requirement.rb +133 -54
  632. data/test/rubygems/test_gem_resolver.rb +182 -117
  633. data/test/rubygems/test_gem_resolver_activation_request.rb +6 -8
  634. data/test/rubygems/test_gem_resolver_api_set.rb +79 -78
  635. data/test/rubygems/test_gem_resolver_api_specification.rb +47 -49
  636. data/test/rubygems/test_gem_resolver_best_set.rb +43 -22
  637. data/test/rubygems/test_gem_resolver_composed_set.rb +1 -3
  638. data/test/rubygems/test_gem_resolver_conflict.rb +12 -14
  639. data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -17
  640. data/test/rubygems/test_gem_resolver_git_set.rb +22 -24
  641. data/test/rubygems/test_gem_resolver_git_specification.rb +22 -23
  642. data/test/rubygems/test_gem_resolver_index_set.rb +14 -16
  643. data/test/rubygems/test_gem_resolver_index_specification.rb +16 -18
  644. data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -7
  645. data/test/rubygems/test_gem_resolver_installer_set.rb +104 -44
  646. data/test/rubygems/test_gem_resolver_local_specification.rb +7 -9
  647. data/test/rubygems/test_gem_resolver_lock_set.rb +15 -17
  648. data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -19
  649. data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -3
  650. data/test/rubygems/test_gem_resolver_specification.rb +8 -12
  651. data/test/rubygems/test_gem_resolver_vendor_set.rb +9 -11
  652. data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -12
  653. data/test/rubygems/test_gem_security.rb +105 -79
  654. data/test/rubygems/test_gem_security_policy.rb +102 -107
  655. data/test/rubygems/test_gem_security_signer.rb +51 -53
  656. data/test/rubygems/test_gem_security_trust_dir.rb +14 -16
  657. data/test/rubygems/test_gem_silent_ui.rb +46 -42
  658. data/test/rubygems/test_gem_source.rb +53 -52
  659. data/test/rubygems/test_gem_source_fetch_problem.rb +16 -8
  660. data/test/rubygems/test_gem_source_git.rb +78 -72
  661. data/test/rubygems/test_gem_source_installed.rb +16 -18
  662. data/test/rubygems/test_gem_source_list.rb +5 -6
  663. data/test/rubygems/test_gem_source_local.rb +15 -17
  664. data/test/rubygems/test_gem_source_lock.rb +31 -33
  665. data/test/rubygems/test_gem_source_specific_file.rb +18 -20
  666. data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
  667. data/test/rubygems/test_gem_source_vendor.rb +13 -15
  668. data/test/rubygems/test_gem_spec_fetcher.rb +74 -67
  669. data/test/rubygems/test_gem_specification.rb +967 -1056
  670. data/test/rubygems/test_gem_stream_ui.rb +23 -23
  671. data/test/rubygems/test_gem_stub_specification.rb +39 -57
  672. data/test/rubygems/test_gem_text.rb +8 -4
  673. data/test/rubygems/test_gem_uninstaller.rb +234 -105
  674. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -5
  675. data/test/rubygems/test_gem_update_suggestion.rb +208 -0
  676. data/test/rubygems/test_gem_uri.rb +39 -0
  677. data/test/rubygems/test_gem_uri_formatter.rb +14 -16
  678. data/test/rubygems/test_gem_util.rb +37 -35
  679. data/test/rubygems/test_gem_validator.rb +10 -12
  680. data/test/rubygems/test_gem_version.rb +32 -32
  681. data/test/rubygems/test_gem_version_option.rb +16 -18
  682. data/test/rubygems/test_kernel.rb +47 -67
  683. data/test/rubygems/test_project_sanity.rb +8 -3
  684. data/test/rubygems/test_remote_fetch_error.rb +7 -9
  685. data/test/rubygems/test_require.rb +269 -182
  686. data/test/rubygems/test_rubygems.rb +74 -0
  687. data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +63 -50
  688. data/test/rubygems/wrong_key_cert.pem +15 -15
  689. data/test/rubygems/wrong_key_cert_32.pem +15 -15
  690. data/test/test_changelog_generator.rb +17 -0
  691. metadata +190 -173
  692. data/.bundle/config +0 -2
  693. data/.rubocop.yml +0 -91
  694. data/Gemfile +0 -8
  695. data/Gemfile.lock +0 -43
  696. data/History.txt +0 -4473
  697. data/Rakefile +0 -428
  698. data/bundler/CODE_OF_CONDUCT.md +0 -136
  699. data/bundler/lib/bundler/dep_proxy.rb +0 -48
  700. data/bundler/lib/bundler/gemdeps.rb +0 -29
  701. data/bundler/lib/bundler/psyched_yaml.rb +0 -37
  702. data/bundler/lib/bundler/templates/gems.rb +0 -8
  703. data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -6
  704. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
  705. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  706. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  707. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
  708. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  709. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  710. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  711. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  712. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  713. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  714. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  715. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  716. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -158
  717. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
  718. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
  719. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  720. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
  721. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  722. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
  723. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  724. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  725. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
  726. data/bundler/lib/bundler/version_ranges.rb +0 -122
  727. data/bundler/man/bundle-add.1.txt +0 -58
  728. data/bundler/man/bundle-binstubs.1.txt +0 -48
  729. data/bundler/man/bundle-cache.1.txt +0 -78
  730. data/bundler/man/bundle-check.1.txt +0 -33
  731. data/bundler/man/bundle-clean.1.txt +0 -26
  732. data/bundler/man/bundle-config.1.txt +0 -528
  733. data/bundler/man/bundle-doctor.1.txt +0 -44
  734. data/bundler/man/bundle-exec.1.txt +0 -178
  735. data/bundler/man/bundle-gem.1 +0 -80
  736. data/bundler/man/bundle-gem.1.txt +0 -91
  737. data/bundler/man/bundle-gem.ronn +0 -78
  738. data/bundler/man/bundle-info.1.txt +0 -21
  739. data/bundler/man/bundle-init.1.txt +0 -34
  740. data/bundler/man/bundle-inject.1.txt +0 -32
  741. data/bundler/man/bundle-install.1.txt +0 -401
  742. data/bundler/man/bundle-list.1.txt +0 -43
  743. data/bundler/man/bundle-lock.1.txt +0 -93
  744. data/bundler/man/bundle-open.1.txt +0 -29
  745. data/bundler/man/bundle-outdated.1.txt +0 -131
  746. data/bundler/man/bundle-platform.1.txt +0 -57
  747. data/bundler/man/bundle-pristine.1.txt +0 -44
  748. data/bundler/man/bundle-remove.1.txt +0 -34
  749. data/bundler/man/bundle-show.1.txt +0 -27
  750. data/bundler/man/bundle-update.1.txt +0 -390
  751. data/bundler/man/bundle-viz.1.txt +0 -39
  752. data/bundler/man/bundle.1.txt +0 -116
  753. data/bundler/man/gemfile.5.txt +0 -649
  754. data/lib/rubygems/psych_additions.rb +0 -10
  755. data/lib/rubygems/server.rb +0 -879
  756. data/lib/rubygems/source_local.rb +0 -7
  757. data/lib/rubygems/source_specific_file.rb +0 -6
  758. data/lib/rubygems/syck_hack.rb +0 -79
  759. data/lib/rubygems/uri_parser.rb +0 -36
  760. data/lib/rubygems/uri_parsing.rb +0 -23
  761. data/lib/ubygems.rb +0 -14
  762. data/test/rubygems/bogussources.rb +0 -9
  763. data/test/rubygems/data/null-type.gemspec.rz +0 -0
  764. data/test/rubygems/test_gem_server.rb +0 -612
  765. data/tmp/.keep +0 -0
  766. data/util/CL2notes +0 -55
  767. data/util/bisect +0 -10
  768. data/util/ci.sh +0 -62
  769. data/util/cops/deprecations.rb +0 -52
  770. data/util/create_certs.rb +0 -171
  771. data/util/create_certs.sh +0 -27
  772. data/util/create_encrypted_key.rb +0 -16
  773. data/util/generate_spdx_license_list.rb +0 -63
  774. data/util/patch_with_prs.rb +0 -77
  775. data/util/rubocop +0 -8
  776. data/util/update_bundled_ca_certificates.rb +0 -137
  777. data/util/update_changelog.rb +0 -64
  778. /data/bundler/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
  779. /data/bundler/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
  780. /data/bundler/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
  781. /data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
  782. /data/bundler/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
  783. /data/bundler/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
  784. /data/bundler/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
@@ -1,26 +1,7 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/installer_test_case'
2
+ require_relative "installer_test_case"
3
3
 
4
4
  class TestGemInstaller < Gem::InstallerTestCase
5
-
6
- @@symlink_supported = nil
7
-
8
- # Our CI does not currently hit the "symlink not supported" case, but this is
9
- # needed for Windows developers without symlink support enabled (the default
10
- # for non admin) to be able to run the tests successfully
11
- def symlink_supported?
12
- if @@symlink_supported.nil?
13
- begin
14
- File.symlink("", "")
15
- rescue Errno::ENOENT, Errno::EEXIST
16
- @@symlink_supported = true
17
- rescue NotImplementedError, SystemCallError
18
- @@symlink_supported = false
19
- end
20
- end
21
- @@symlink_supported
22
- end
23
-
24
5
  def setup
25
6
  super
26
7
  common_installer_setup
@@ -37,11 +18,12 @@ class TestGemInstaller < Gem::InstallerTestCase
37
18
  end
38
19
 
39
20
  def test_app_script_text
40
- installer = setup_base_installer
21
+ load_relative "no" do
22
+ installer = setup_base_installer
41
23
 
42
- util_make_exec @spec, ''
24
+ util_make_exec @spec, ""
43
25
 
44
- expected = <<-EOF
26
+ expected = <<-EOF
45
27
  #!#{Gem.ruby}
46
28
  #
47
29
  # This file was generated by RubyGems.
@@ -52,6 +34,8 @@ class TestGemInstaller < Gem::InstallerTestCase
52
34
 
53
35
  require 'rubygems'
54
36
 
37
+ Gem.use_gemdeps
38
+
55
39
  version = \">= 0.a\"
56
40
 
57
41
  str = ARGV.first
@@ -69,10 +53,11 @@ else
69
53
  gem "a", version
70
54
  load Gem.bin_path("a", "executable", version)
71
55
  end
72
- EOF
56
+ EOF
73
57
 
74
- wrapper = installer.app_script_text 'executable'
75
- assert_equal expected, wrapper
58
+ wrapper = installer.app_script_text "executable"
59
+ assert_equal expected, wrapper
60
+ end
76
61
  end
77
62
 
78
63
  def test_check_executable_overwrite
@@ -81,12 +66,12 @@ end
81
66
  installer.generate_bin
82
67
 
83
68
  @spec = Gem::Specification.new do |s|
84
- s.files = ['lib/code.rb']
69
+ s.files = ["lib/code.rb"]
85
70
  s.name = "a"
86
71
  s.version = "3"
87
72
  s.summary = "summary"
88
73
  s.description = "desc"
89
- s.require_path = 'lib'
74
+ s.require_path = "lib"
90
75
  end
91
76
 
92
77
  util_make_exec
@@ -94,27 +79,27 @@ end
94
79
  installer.wrappers = true
95
80
  installer.generate_bin
96
81
 
97
- installed_exec = File.join util_inst_bindir, 'executable'
98
- assert_path_exists installed_exec
82
+ installed_exec = File.join util_inst_bindir, "executable"
83
+ assert_path_exist installed_exec
99
84
 
100
85
  wrapper = File.read installed_exec
101
- assert_match %r|generated by RubyGems|, wrapper
86
+ assert_match %r{generated by RubyGems}, wrapper
102
87
  end
103
88
 
104
89
  def test_check_executable_overwrite_default_bin_dir
105
- installer = setup_base_installer
90
+ installer = setup_base_installer(false)
106
91
 
107
92
  bindir(Gem.bindir) do
108
93
  util_conflict_executable false
109
94
 
110
95
  ui = Gem::MockGemUi.new "n\n"
111
96
  use_ui ui do
112
- e = assert_raises Gem::InstallError do
97
+ e = assert_raise Gem::InstallError do
113
98
  installer.generate_bin
114
99
  end
115
100
 
116
- conflicted = File.join @gemhome, 'bin', 'executable'
117
- assert_match %r%\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z%,
101
+ conflicted = File.join @gemhome, "bin", "executable"
102
+ assert_match %r{\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z},
118
103
  e.message
119
104
  end
120
105
  end
@@ -126,15 +111,15 @@ end
126
111
  installer.generate_bin
127
112
 
128
113
  @spec = Gem::Specification.new do |s|
129
- s.files = ['lib/code.rb']
114
+ s.files = ["lib/code.rb"]
130
115
  s.name = "a"
131
116
  s.version = "3"
132
117
  s.summary = "summary"
133
118
  s.description = "desc"
134
- s.require_path = 'lib'
119
+ s.require_path = "lib"
135
120
  end
136
121
 
137
- File.open File.join(util_inst_bindir, 'executable'), 'w' do |io|
122
+ File.open File.join(util_inst_bindir, "executable"), "w" do |io|
138
123
  io.write <<-EXEC
139
124
  #!/usr/local/bin/ruby
140
125
  #
@@ -145,31 +130,31 @@ gem 'other', version
145
130
  end
146
131
 
147
132
  util_make_exec
148
- Gem::Installer.exec_format = 'foo-%s-bar'
133
+ Gem::Installer.exec_format = "foo-%s-bar"
149
134
  installer.gem_dir = @spec.gem_dir
150
135
  installer.wrappers = true
151
136
  installer.format_executable = true
152
137
 
153
138
  installer.generate_bin # should not raise
154
139
 
155
- installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
156
- assert_path_exists installed_exec
140
+ installed_exec = File.join util_inst_bindir, "foo-executable-bar"
141
+ assert_path_exist installed_exec
157
142
 
158
143
  wrapper = File.read installed_exec
159
- assert_match %r|generated by RubyGems|, wrapper
144
+ assert_match %r{generated by RubyGems}, wrapper
160
145
  ensure
161
146
  Gem::Installer.exec_format = nil
162
147
  end
163
148
 
164
149
  def test_check_executable_overwrite_other_gem
165
- installer = setup_base_installer
150
+ installer = setup_base_installer(false)
166
151
 
167
152
  util_conflict_executable true
168
153
 
169
154
  ui = Gem::MockGemUi.new "n\n"
170
155
 
171
156
  use_ui ui do
172
- e = assert_raises Gem::InstallError do
157
+ e = assert_raise Gem::InstallError do
173
158
  installer.generate_bin
174
159
  end
175
160
 
@@ -187,11 +172,11 @@ gem 'other', version
187
172
 
188
173
  installer.generate_bin
189
174
 
190
- installed_exec = File.join util_inst_bindir, 'executable'
191
- assert_path_exists installed_exec
175
+ installed_exec = File.join util_inst_bindir, "executable"
176
+ assert_path_exist installed_exec
192
177
 
193
178
  wrapper = File.read installed_exec
194
- assert_match %r|generated by RubyGems|, wrapper
179
+ assert_match %r{generated by RubyGems}, wrapper
195
180
  end
196
181
 
197
182
  def test_check_executable_overwrite_other_non_gem
@@ -202,11 +187,11 @@ gem 'other', version
202
187
 
203
188
  installer.generate_bin
204
189
 
205
- installed_exec = File.join util_inst_bindir, 'executable'
206
- assert_path_exists installed_exec
190
+ installed_exec = File.join util_inst_bindir, "executable"
191
+ assert_path_exist installed_exec
207
192
 
208
193
  wrapper = File.read installed_exec
209
- assert_match %r|generated by RubyGems|, wrapper
194
+ assert_match %r{generated by RubyGems}, wrapper
210
195
  end unless Gem.win_platform?
211
196
 
212
197
  def test_check_that_user_bin_dir_is_in_path
@@ -215,11 +200,21 @@ gem 'other', version
215
200
  bin_dir = installer.bin_dir
216
201
 
217
202
  if Gem.win_platform?
218
- bin_dir = bin_dir.downcase.gsub(File::SEPARATOR, File::ALT_SEPARATOR)
203
+ bin_dir = bin_dir.downcase
219
204
  end
220
205
 
221
- orig_PATH, ENV['PATH'] =
222
- ENV['PATH'], [ENV['PATH'], bin_dir].join(File::PATH_SEPARATOR)
206
+ orig_PATH, ENV["PATH"] =
207
+ ENV["PATH"], [ENV["PATH"], bin_dir].join(File::PATH_SEPARATOR)
208
+
209
+ use_ui @ui do
210
+ installer.check_that_user_bin_dir_is_in_path
211
+ end
212
+
213
+ assert_empty @ui.error
214
+
215
+ return unless win_platform?
216
+
217
+ ENV["PATH"] = [orig_PATH, bin_dir.tr(File::SEPARATOR, File::ALT_SEPARATOR)].join(File::PATH_SEPARATOR)
223
218
 
224
219
  use_ui @ui do
225
220
  installer.check_that_user_bin_dir_is_in_path
@@ -227,17 +222,17 @@ gem 'other', version
227
222
 
228
223
  assert_empty @ui.error
229
224
  ensure
230
- ENV['PATH'] = orig_PATH
225
+ ENV["PATH"] = orig_PATH
231
226
  end
232
227
 
233
228
  def test_check_that_user_bin_dir_is_in_path_tilde
234
- skip "Tilde is PATH is not supported under MS Windows" if win_platform?
229
+ pend "Tilde is PATH is not supported under MS Windows" if win_platform?
235
230
 
236
- orig_PATH, ENV['PATH'] =
237
- ENV['PATH'], [ENV['PATH'], '~/bin'].join(File::PATH_SEPARATOR)
231
+ orig_PATH, ENV["PATH"] =
232
+ ENV["PATH"], [ENV["PATH"], "~/bin"].join(File::PATH_SEPARATOR)
238
233
 
239
234
  installer = setup_base_installer
240
- installer.bin_dir.replace File.join @userhome, 'bin'
235
+ installer.bin_dir.replace File.join @userhome, "bin"
241
236
 
242
237
  use_ui @ui do
243
238
  installer.check_that_user_bin_dir_is_in_path
@@ -245,7 +240,7 @@ gem 'other', version
245
240
 
246
241
  assert_empty @ui.error
247
242
  ensure
248
- ENV['PATH'] = orig_PATH unless win_platform?
243
+ ENV["PATH"] = orig_PATH unless win_platform?
249
244
  end
250
245
 
251
246
  def test_check_that_user_bin_dir_is_in_path_not_in_path
@@ -258,7 +253,7 @@ gem 'other', version
258
253
  expected = installer.bin_dir
259
254
 
260
255
  if Gem.win_platform?
261
- expected = expected.downcase.gsub(File::SEPARATOR, File::ALT_SEPARATOR)
256
+ expected = expected.downcase
262
257
  end
263
258
 
264
259
  assert_match expected, @ui.error
@@ -267,27 +262,27 @@ gem 'other', version
267
262
  def test_ensure_dependency
268
263
  installer = setup_base_installer
269
264
 
270
- util_spec 'a'
265
+ util_spec "a"
271
266
 
272
- dep = Gem::Dependency.new 'a', '>= 2'
267
+ dep = Gem::Dependency.new "a", ">= 2"
273
268
  assert installer.ensure_dependency(@spec, dep)
274
269
 
275
- dep = Gem::Dependency.new 'b', '> 2'
276
- e = assert_raises Gem::InstallError do
270
+ dep = Gem::Dependency.new "b", "> 2"
271
+ e = assert_raise Gem::InstallError do
277
272
  installer.ensure_dependency @spec, dep
278
273
  end
279
274
 
280
- assert_equal 'a requires b (> 2)', e.message
275
+ assert_equal "a requires b (> 2)", e.message
281
276
  end
282
277
 
283
278
  def test_ensure_loadable_spec
284
- a, a_gem = util_gem 'a', 2 do |s|
285
- s.add_dependency 'garbage ~> 5'
279
+ a, a_gem = util_gem "a", 2 do |s|
280
+ s.add_dependency "garbage ~> 5"
286
281
  end
287
282
 
288
283
  installer = Gem::Installer.at a_gem
289
284
 
290
- e = assert_raises Gem::InstallError do
285
+ e = assert_raise Gem::InstallError do
291
286
  installer.ensure_loadable_spec
292
287
  end
293
288
 
@@ -296,16 +291,16 @@ gem 'other', version
296
291
  end
297
292
 
298
293
  def test_ensure_loadable_spec_security_policy
299
- skip 'openssl is missing' unless defined?(OpenSSL::SSL)
294
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
300
295
 
301
- _, a_gem = util_gem 'a', 2 do |s|
302
- s.add_dependency 'garbage ~> 5'
296
+ _, a_gem = util_gem "a", 2 do |s|
297
+ s.add_dependency "garbage ~> 5"
303
298
  end
304
299
 
305
300
  policy = Gem::Security::HighSecurity
306
301
  installer = Gem::Installer.at a_gem, :security_policy => policy
307
302
 
308
- assert_raises Gem::Security::Exception do
303
+ assert_raise Gem::Security::Exception do
309
304
  installer.ensure_loadable_spec
310
305
  end
311
306
  end
@@ -315,7 +310,7 @@ gem 'other', version
315
310
 
316
311
  installer.extract_files
317
312
 
318
- assert_path_exists File.join @spec.gem_dir, 'bin/executable'
313
+ assert_path_exist File.join @spec.gem_dir, "bin/executable"
319
314
  end
320
315
 
321
316
  def test_generate_bin_bindir
@@ -324,12 +319,12 @@ gem 'other', version
324
319
  installer.wrappers = true
325
320
 
326
321
  @spec.executables = %w[executable]
327
- @spec.bindir = 'bin'
322
+ @spec.bindir = "bin"
328
323
 
329
- exec_file = installer.formatted_program_filename 'executable'
324
+ exec_file = installer.formatted_program_filename "executable"
330
325
  exec_path = File.join @spec.gem_dir, exec_file
331
- File.open exec_path, 'w' do |f|
332
- f.puts '#!/usr/bin/ruby'
326
+ File.open exec_path, "w" do |f|
327
+ f.puts "#!/usr/bin/ruby"
333
328
  end
334
329
 
335
330
  installer.gem_dir = @spec.gem_dir
@@ -337,12 +332,12 @@ gem 'other', version
337
332
  installer.generate_bin
338
333
 
339
334
  assert_directory_exists util_inst_bindir
340
- installed_exec = File.join(util_inst_bindir, 'executable')
341
- assert_path_exists installed_exec
335
+ installed_exec = File.join(util_inst_bindir, "executable")
336
+ assert_path_exist installed_exec
342
337
  assert_equal mask, File.stat(installed_exec).mode unless win_platform?
343
338
 
344
339
  wrapper = File.read installed_exec
345
- assert_match %r|generated by RubyGems|, wrapper
340
+ assert_match %r{generated by RubyGems}, wrapper
346
341
  end
347
342
 
348
343
  def test_generate_bin_bindir_with_user_install_warning
@@ -354,10 +349,10 @@ gem 'other', version
354
349
 
355
350
  options = {
356
351
  :bin_dir => bin_dir,
357
- :install_dir => "/non/existent"
352
+ :install_dir => "/non/existent",
358
353
  }
359
354
 
360
- inst = Gem::Installer.at '', options
355
+ inst = Gem::Installer.at "", options
361
356
 
362
357
  Gem::Installer.path_warning = false
363
358
 
@@ -380,12 +375,12 @@ gem 'other', version
380
375
 
381
376
  installer.generate_bin
382
377
  assert_directory_exists util_inst_bindir
383
- installed_exec = File.join util_inst_bindir, 'executable'
384
- assert_path_exists installed_exec
378
+ installed_exec = File.join util_inst_bindir, "executable"
379
+ assert_path_exist installed_exec
385
380
  assert_equal mask, File.stat(installed_exec).mode unless win_platform?
386
381
 
387
382
  wrapper = File.read installed_exec
388
- assert_match %r|generated by RubyGems|, wrapper
383
+ assert_match %r{generated by RubyGems}, wrapper
389
384
  end
390
385
 
391
386
  def test_generate_bin_script_format
@@ -396,11 +391,11 @@ gem 'other', version
396
391
  util_make_exec
397
392
  installer.gem_dir = @spec.gem_dir
398
393
 
399
- Gem::Installer.exec_format = 'foo-%s-bar'
394
+ Gem::Installer.exec_format = "foo-%s-bar"
400
395
  installer.generate_bin
401
396
  assert_directory_exists util_inst_bindir
402
- installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
403
- assert_path_exists installed_exec
397
+ installed_exec = File.join util_inst_bindir, "foo-executable-bar"
398
+ assert_path_exist installed_exec
404
399
  ensure
405
400
  Gem::Installer.exec_format = nil
406
401
  end
@@ -412,11 +407,11 @@ gem 'other', version
412
407
  util_make_exec
413
408
  installer.gem_dir = @spec.gem_dir
414
409
 
415
- Gem::Installer.exec_format = 'foo-%s-bar'
410
+ Gem::Installer.exec_format = "foo-%s-bar"
416
411
  installer.generate_bin
417
412
  assert_directory_exists util_inst_bindir
418
- installed_exec = File.join util_inst_bindir, 'executable'
419
- assert_path_exists installed_exec
413
+ installed_exec = File.join util_inst_bindir, "executable"
414
+ assert_path_exist installed_exec
420
415
  ensure
421
416
  Gem::Installer.exec_format = nil
422
417
  end
@@ -427,24 +422,24 @@ gem 'other', version
427
422
  installer.wrappers = true
428
423
 
429
424
  gem_dir = File.join("#{@gemhome}2", "gems", @spec.full_name)
430
- gem_bindir = File.join gem_dir, 'bin'
425
+ gem_bindir = File.join gem_dir, "bin"
431
426
  FileUtils.mkdir_p gem_bindir
432
- File.open File.join(gem_bindir, 'executable'), 'w' do |f|
427
+ File.open File.join(gem_bindir, "executable"), "w" do |f|
433
428
  f.puts "#!/bin/ruby"
434
429
  end
435
430
 
436
431
  installer.gem_home = "#{@gemhome}2"
437
432
  installer.gem_dir = gem_dir
438
- installer.bin_dir = File.join "#{@gemhome}2", 'bin'
433
+ installer.bin_dir = File.join "#{@gemhome}2", "bin"
439
434
 
440
435
  installer.generate_bin
441
436
 
442
- installed_exec = File.join("#{@gemhome}2", "bin", 'executable')
443
- assert_path_exists installed_exec
437
+ installed_exec = File.join("#{@gemhome}2", "bin", "executable")
438
+ assert_path_exist installed_exec
444
439
  assert_equal mask, File.stat(installed_exec).mode unless win_platform?
445
440
 
446
441
  wrapper = File.read installed_exec
447
- assert_match %r|generated by RubyGems|, wrapper
442
+ assert_match %r{generated by RubyGems}, wrapper
448
443
  end
449
444
 
450
445
  def test_generate_bin_script_no_execs
@@ -455,7 +450,7 @@ gem 'other', version
455
450
  installer.wrappers = true
456
451
  installer.generate_bin
457
452
 
458
- refute_path_exists util_inst_bindir, 'bin dir was created when not needed'
453
+ assert_path_not_exist util_inst_bindir, "bin dir was created when not needed"
459
454
  end
460
455
 
461
456
  def test_generate_bin_script_no_perms
@@ -467,18 +462,18 @@ gem 'other', version
467
462
  Dir.mkdir util_inst_bindir
468
463
 
469
464
  if win_platform?
470
- skip('test_generate_bin_script_no_perms skipped on MS Windows')
465
+ pend("test_generate_bin_script_no_perms skipped on MS Windows")
471
466
  elsif Process.uid.zero?
472
- skip('test_generate_bin_script_no_perms skipped in root privilege')
467
+ pend("test_generate_bin_script_no_perms skipped in root privilege")
473
468
  else
474
469
  FileUtils.chmod 0000, util_inst_bindir
475
470
 
476
- assert_raises Gem::FilePermissionError do
471
+ assert_raise Gem::FilePermissionError do
477
472
  installer.generate_bin
478
473
  end
479
474
  end
480
475
  ensure
481
- FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG or win_platform?)
476
+ FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG || win_platform?)
482
477
  end
483
478
 
484
479
  def test_generate_bin_script_no_shebang
@@ -487,21 +482,21 @@ gem 'other', version
487
482
  installer.wrappers = true
488
483
  @spec.executables = %w[executable]
489
484
 
490
- gem_dir = File.join @gemhome, 'gems', @spec.full_name
491
- gem_bindir = File.join gem_dir, 'bin'
485
+ gem_dir = File.join @gemhome, "gems", @spec.full_name
486
+ gem_bindir = File.join gem_dir, "bin"
492
487
  FileUtils.mkdir_p gem_bindir
493
- File.open File.join(gem_bindir, 'executable'), 'w' do |f|
488
+ File.open File.join(gem_bindir, "executable"), "w" do |f|
494
489
  f.puts "blah blah blah"
495
490
  end
496
491
 
497
492
  installer.generate_bin
498
493
 
499
- installed_exec = File.join @gemhome, 'bin', 'executable'
500
- assert_path_exists installed_exec
494
+ installed_exec = File.join @gemhome, "bin", "executable"
495
+ assert_path_exist installed_exec
501
496
  assert_equal mask, File.stat(installed_exec).mode unless win_platform?
502
497
 
503
498
  wrapper = File.read installed_exec
504
- assert_match %r|generated by RubyGems|, wrapper
499
+ assert_match %r{generated by RubyGems}, wrapper
505
500
  # HACK some gems don't have #! in their executables, restore 2008/06
506
501
  #assert_no_match %r|generated by RubyGems|, wrapper
507
502
  end
@@ -512,9 +507,9 @@ gem 'other', version
512
507
  installer.wrappers = true
513
508
  util_make_exec
514
509
  installer.gem_dir = @spec.gem_dir
515
- installed_exec = File.join(util_inst_bindir, 'executable')
510
+ installed_exec = File.join(util_inst_bindir, "executable")
516
511
 
517
- real_exec = File.join @spec.gem_dir, 'bin', 'executable'
512
+ real_exec = File.join @spec.gem_dir, "bin", "executable"
518
513
 
519
514
  # fake --no-wrappers for previous install
520
515
  unless Gem.win_platform?
@@ -524,17 +519,17 @@ gem 'other', version
524
519
 
525
520
  installer.generate_bin
526
521
  assert_directory_exists util_inst_bindir
527
- assert_path_exists installed_exec
522
+ assert_path_exist installed_exec
528
523
  assert_equal mask, File.stat(installed_exec).mode unless win_platform?
529
524
 
530
- assert_match %r|generated by RubyGems|, File.read(installed_exec)
525
+ assert_match %r{generated by RubyGems}, File.read(installed_exec)
531
526
 
532
- refute_match %r|generated by RubyGems|, File.read(real_exec),
533
- 'real executable overwritten'
527
+ refute_match %r{generated by RubyGems}, File.read(real_exec),
528
+ "real executable overwritten"
534
529
  end
535
530
 
536
531
  def test_generate_bin_symlink
537
- skip "Symlinks not supported or not enabled" unless symlink_supported?
532
+ pend "Symlinks not supported or not enabled" unless symlink_supported?
538
533
 
539
534
  installer = setup_base_installer
540
535
 
@@ -544,9 +539,9 @@ gem 'other', version
544
539
 
545
540
  installer.generate_bin
546
541
  assert_directory_exists util_inst_bindir
547
- installed_exec = File.join util_inst_bindir, 'executable'
542
+ installed_exec = File.join util_inst_bindir, "executable"
548
543
  assert_equal true, File.symlink?(installed_exec)
549
- assert_equal(File.join(@spec.gem_dir, 'bin', 'executable'),
544
+ assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
550
545
  File.readlink(installed_exec))
551
546
  end
552
547
 
@@ -558,7 +553,7 @@ gem 'other', version
558
553
  installer.wrappers = false
559
554
  installer.generate_bin
560
555
 
561
- refute_path_exists util_inst_bindir
556
+ assert_path_not_exist util_inst_bindir
562
557
  end
563
558
 
564
559
  def test_generate_bin_symlink_no_perms
@@ -571,22 +566,22 @@ gem 'other', version
571
566
  Dir.mkdir util_inst_bindir
572
567
 
573
568
  if win_platform?
574
- skip('test_generate_bin_symlink_no_perms skipped on MS Windows')
569
+ pend("test_generate_bin_symlink_no_perms skipped on MS Windows")
575
570
  elsif Process.uid.zero?
576
- skip('test_user_install_disabled_read_only test skipped in root privilege')
571
+ pend("test_user_install_disabled_read_only test skipped in root privilege")
577
572
  else
578
573
  FileUtils.chmod 0000, util_inst_bindir
579
574
 
580
- assert_raises Gem::FilePermissionError do
575
+ assert_raise Gem::FilePermissionError do
581
576
  installer.generate_bin
582
577
  end
583
578
  end
584
579
  ensure
585
- FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG or win_platform?)
580
+ FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG || win_platform?)
586
581
  end
587
582
 
588
583
  def test_generate_bin_symlink_update_newer
589
- skip "Symlinks not supported or not enabled" unless symlink_supported?
584
+ pend "Symlinks not supported or not enabled" unless symlink_supported?
590
585
 
591
586
  installer = setup_base_installer
592
587
 
@@ -595,30 +590,30 @@ gem 'other', version
595
590
  installer.gem_dir = @spec.gem_dir
596
591
 
597
592
  installer.generate_bin
598
- installed_exec = File.join(util_inst_bindir, 'executable')
599
- assert_equal(File.join(@spec.gem_dir, 'bin', 'executable'),
593
+ installed_exec = File.join(util_inst_bindir, "executable")
594
+ assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
600
595
  File.readlink(installed_exec))
601
596
 
602
597
  @spec = Gem::Specification.new do |s|
603
- s.files = ['lib/code.rb']
598
+ s.files = ["lib/code.rb"]
604
599
  s.name = "a"
605
600
  s.version = "3"
606
601
  s.summary = "summary"
607
602
  s.description = "desc"
608
- s.require_path = 'lib'
603
+ s.require_path = "lib"
609
604
  end
610
605
 
611
606
  util_make_exec
612
607
  installer.gem_dir = @spec.gem_dir
613
608
  installer.generate_bin
614
- installed_exec = File.join(util_inst_bindir, 'executable')
615
- assert_equal(@spec.bin_file('executable'),
609
+ installed_exec = File.join(util_inst_bindir, "executable")
610
+ assert_equal(@spec.bin_file("executable"),
616
611
  File.readlink(installed_exec),
617
612
  "Ensure symlink moved to latest version")
618
613
  end
619
614
 
620
615
  def test_generate_bin_symlink_update_older
621
- skip "Symlinks not supported or not enabled" unless symlink_supported?
616
+ pend "Symlinks not supported or not enabled" unless symlink_supported?
622
617
 
623
618
  installer = setup_base_installer
624
619
 
@@ -627,17 +622,17 @@ gem 'other', version
627
622
  installer.gem_dir = @spec.gem_dir
628
623
 
629
624
  installer.generate_bin
630
- installed_exec = File.join(util_inst_bindir, 'executable')
631
- assert_equal(File.join(@spec.gem_dir, 'bin', 'executable'),
625
+ installed_exec = File.join(util_inst_bindir, "executable")
626
+ assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
632
627
  File.readlink(installed_exec))
633
628
 
634
629
  spec = Gem::Specification.new do |s|
635
- s.files = ['lib/code.rb']
630
+ s.files = ["lib/code.rb"]
636
631
  s.name = "a"
637
632
  s.version = "1"
638
633
  s.summary = "summary"
639
634
  s.description = "desc"
640
- s.require_path = 'lib'
635
+ s.require_path = "lib"
641
636
  end
642
637
 
643
638
  util_make_exec
@@ -648,15 +643,15 @@ gem 'other', version
648
643
 
649
644
  installer.generate_bin
650
645
 
651
- installed_exec = File.join util_inst_bindir, 'executable'
652
- expected = File.join @spec.gem_dir, 'bin', 'executable'
646
+ installed_exec = File.join util_inst_bindir, "executable"
647
+ expected = File.join @spec.gem_dir, "bin", "executable"
653
648
  assert_equal(expected,
654
649
  File.readlink(installed_exec),
655
650
  "Ensure symlink not moved")
656
651
  end
657
652
 
658
653
  def test_generate_bin_symlink_update_remove_wrapper
659
- skip "Symlinks not supported or not enabled" unless symlink_supported?
654
+ pend "Symlinks not supported or not enabled" unless symlink_supported?
660
655
 
661
656
  installer = setup_base_installer
662
657
 
@@ -666,16 +661,16 @@ gem 'other', version
666
661
 
667
662
  installer.generate_bin
668
663
 
669
- installed_exec = File.join util_inst_bindir, 'executable'
670
- assert_path_exists installed_exec
664
+ installed_exec = File.join util_inst_bindir, "executable"
665
+ assert_path_exist installed_exec
671
666
 
672
667
  @spec = Gem::Specification.new do |s|
673
- s.files = ['lib/code.rb']
668
+ s.files = ["lib/code.rb"]
674
669
  s.name = "a"
675
670
  s.version = "3"
676
671
  s.summary = "summary"
677
672
  s.description = "desc"
678
- s.require_path = 'lib'
673
+ s.require_path = "lib"
679
674
  end
680
675
  util_make_exec
681
676
 
@@ -685,8 +680,8 @@ gem 'other', version
685
680
 
686
681
  installer.generate_bin
687
682
 
688
- installed_exec = File.join util_inst_bindir, 'executable'
689
- assert_equal(@spec.bin_file('executable'),
683
+ installed_exec = File.join util_inst_bindir, "executable"
684
+ assert_equal(@spec.bin_file("executable"),
690
685
  File.readlink(installed_exec),
691
686
  "Ensure symlink moved to latest version")
692
687
  end
@@ -696,7 +691,7 @@ gem 'other', version
696
691
  Gem.win_platform = true
697
692
  old_alt_separator = File::ALT_SEPARATOR
698
693
  File.__send__(:remove_const, :ALT_SEPARATOR)
699
- File.const_set(:ALT_SEPARATOR, '\\')
694
+ File.const_set(:ALT_SEPARATOR, "\\")
700
695
 
701
696
  installer = setup_base_installer
702
697
 
@@ -709,8 +704,8 @@ gem 'other', version
709
704
  end
710
705
 
711
706
  assert_directory_exists util_inst_bindir
712
- installed_exec = File.join(util_inst_bindir, 'executable')
713
- assert_path_exists installed_exec
707
+ installed_exec = File.join(util_inst_bindir, "executable")
708
+ assert_path_exist installed_exec
714
709
 
715
710
  if symlink_supported?
716
711
  assert File.symlink?(installed_exec)
@@ -729,24 +724,191 @@ gem 'other', version
729
724
  end
730
725
 
731
726
  def test_generate_bin_uses_default_shebang
732
- skip "Symlinks not supported or not enabled" unless symlink_supported?
727
+ pend "Symlinks not supported or not enabled" unless symlink_supported?
733
728
 
734
- installer = setup_base_installer
729
+ load_relative "no" do
730
+ installer = setup_base_installer
735
731
 
736
- installer.wrappers = true
737
- util_make_exec
732
+ installer.wrappers = true
733
+ util_make_exec
738
734
 
739
- installer.generate_bin
735
+ installer.generate_bin
740
736
 
741
- default_shebang = Gem.ruby
742
- shebang_line = open("#{@gemhome}/bin/executable") { |f| f.readlines.first }
743
- assert_match(/\A#!/, shebang_line)
744
- assert_match(/#{default_shebang}/, shebang_line)
737
+ default_shebang = Gem.ruby
738
+ shebang_line = File.open("#{@gemhome}/bin/executable") {|f| f.readlines.first }
739
+ assert_match(/\A#!/, shebang_line)
740
+ assert_match(/#{default_shebang}/, shebang_line)
741
+ end
742
+ end
743
+
744
+ def test_generate_bin_with_dangling_symlink
745
+ gem_with_dangling_symlink = File.expand_path("packages/ascii_binder-0.1.10.1.gem", __dir__)
746
+
747
+ installer = Gem::Installer.at(
748
+ gem_with_dangling_symlink,
749
+ :user_install => false,
750
+ :force => true
751
+ )
752
+
753
+ build_rake_in do
754
+ use_ui @ui do
755
+ installer.install
756
+ end
757
+ end
758
+
759
+ errors = @ui.error.split("\n")
760
+ assert_equal "WARNING: ascii_binder-0.1.10.1 ships with a dangling symlink named bin/ascii_binder pointing to missing bin/asciibinder file. Ignoring", errors.shift
761
+ assert_empty errors
762
+
763
+ assert_empty @ui.output
764
+ end
765
+
766
+ def test_generate_plugins
767
+ installer = util_setup_installer do |spec|
768
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
769
+ io.write "puts __FILE__"
770
+ end
771
+
772
+ spec.files += %w[lib/rubygems_plugin.rb]
773
+ end
774
+
775
+ build_rake_in do
776
+ installer.install
777
+ end
778
+
779
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
780
+
781
+ FileUtils.rm plugin_path
782
+
783
+ installer.generate_plugins
784
+
785
+ assert File.exist?(plugin_path), "plugin not written"
786
+ end
787
+
788
+ def test_generate_plugins_with_install_dir
789
+ spec = quick_gem "a" do |s|
790
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
791
+ io.write "puts __FILE__"
792
+ end
793
+
794
+ s.files += %w[lib/rubygems_plugin.rb]
795
+ end
796
+
797
+ util_build_gem spec
798
+
799
+ plugin_path = File.join "#{@gemhome}2", "plugins", "a_plugin.rb"
800
+ installer = util_installer spec, "#{@gemhome}2"
801
+
802
+ assert_equal spec, installer.install
803
+
804
+ assert File.exist?(plugin_path), "plugin not written to install_dir"
805
+ end
806
+
807
+ def test_generate_plugins_with_user_install
808
+ spec = quick_gem "a" do |s|
809
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
810
+ io.write "puts __FILE__"
811
+ end
812
+
813
+ s.files += %w[lib/rubygems_plugin.rb]
814
+ end
815
+
816
+ util_build_gem spec
817
+
818
+ File.chmod(0555, Gem.plugindir)
819
+ system_path = File.join(Gem.plugindir, "a_plugin.rb")
820
+ user_path = File.join(Gem.plugindir(Gem.user_dir), "a_plugin.rb")
821
+ installer = util_installer spec, Gem.dir, :user
822
+
823
+ assert_equal spec, installer.install
824
+
825
+ assert !File.exist?(system_path), "plugin incorrectly written to system plugins_dir"
826
+ assert File.exist?(user_path), "plugin not written to user plugins_dir"
827
+ end
828
+
829
+ def test_generate_plugins_with_build_root
830
+ spec = quick_gem "a" do |s|
831
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
832
+ io.write "puts __FILE__"
833
+ end
834
+
835
+ s.files += %w[lib/rubygems_plugin.rb]
836
+ end
837
+
838
+ util_build_gem spec
839
+
840
+ File.chmod(0555, Gem.plugindir)
841
+ system_path = File.join(Gem.plugindir, "a_plugin.rb")
842
+
843
+ build_root = File.join(@tempdir, "build_root")
844
+ build_root_path = File.join(build_root, Gem.plugindir.gsub(/^[a-zA-Z]:/, ""), "a_plugin.rb")
845
+
846
+ installer = Gem::Installer.at spec.cache_file, :build_root => build_root
847
+
848
+ assert_equal spec, installer.install
849
+
850
+ assert !File.exist?(system_path), "plugin written incorrect written to system plugins_dir"
851
+ assert File.exist?(build_root_path), "plugin not written to build_root"
852
+
853
+ refute_includes File.read(build_root_path), build_root
854
+ end
855
+
856
+ def test_keeps_plugins_up_to_date
857
+ # NOTE: version a-2 is already installed by setup hooks
858
+
859
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
860
+ io.write "puts __FILE__"
861
+ end
862
+
863
+ build_rake_in do
864
+ util_setup_installer do |spec|
865
+ spec.version = "1"
866
+ spec.files += %w[lib/rubygems_plugin.rb]
867
+ end.install
868
+
869
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
870
+ refute File.exist?(plugin_path), "old version installed while newer version without plugin also installed, but plugin written"
871
+
872
+ util_setup_installer do |spec|
873
+ spec.version = "2"
874
+ spec.files += %w[lib/rubygems_plugin.rb]
875
+ end.install
876
+
877
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
878
+ assert File.exist?(plugin_path), "latest version reinstalled, but plugin not written"
879
+ assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), "written plugin has incorrect content"
880
+
881
+ util_setup_installer do |spec|
882
+ spec.version = "3"
883
+ spec.files += %w[lib/rubygems_plugin.rb]
884
+ end.install
885
+
886
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
887
+ assert File.exist?(plugin_path), "latest version installed, but plugin removed"
888
+ assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), "written plugin has incorrect content"
889
+
890
+ util_setup_installer do |spec|
891
+ spec.version = "4"
892
+ end.install
893
+
894
+ refute File.exist?(plugin_path), "new version installed without a plugin while older version with a plugin installed, but plugin not removed"
895
+ end
896
+ end
897
+
898
+ def test_generates_plugins_dir_under_install_dir_if_not_there
899
+ Gem.use_paths "#{@gemhome}2" # Set GEM_HOME to an uninitialized repo
900
+
901
+ @spec = util_spec "a"
902
+
903
+ path = Gem::Package.build @spec
904
+
905
+ installer = Gem::Installer.at path, :install_dir => "#{@gemhome}3"
906
+ assert_equal @spec, installer.install
745
907
  end
746
908
 
747
909
  def test_initialize
748
- spec = util_spec 'a' do |s|
749
- s.platform = Gem::Platform.new 'mswin32'
910
+ spec = util_spec "a" do |s|
911
+ s.platform = Gem::Platform.new "mswin32"
750
912
  end
751
913
 
752
914
  gem = File.join @tempdir, spec.file_name
@@ -757,8 +919,8 @@ gem 'other', version
757
919
 
758
920
  installer = Gem::Installer.at gem
759
921
 
760
- assert_equal File.join(@gemhome, 'gems', spec.full_name), installer.gem_dir
761
- assert_equal File.join(@gemhome, 'bin'), installer.bin_dir
922
+ assert_equal File.join(@gemhome, "gems", spec.full_name), installer.gem_dir
923
+ assert_equal File.join(@gemhome, "bin"), installer.bin_dir
762
924
  end
763
925
 
764
926
  def test_initialize_user_install
@@ -766,7 +928,7 @@ gem 'other', version
766
928
 
767
929
  installer = Gem::Installer.at @gem, :user_install => true
768
930
 
769
- assert_equal File.join(Gem.user_dir, 'gems', @spec.full_name),
931
+ assert_equal File.join(Gem.user_dir, "gems", @spec.full_name),
770
932
  installer.gem_dir
771
933
  assert_equal Gem.bindir(Gem.user_dir), installer.bin_dir
772
934
  end
@@ -777,7 +939,7 @@ gem 'other', version
777
939
  installer =
778
940
  Gem::Installer.at @gem, :user_install => true, :bin_dir => @tempdir
779
941
 
780
- assert_equal File.join(Gem.user_dir, 'gems', @spec.full_name),
942
+ assert_equal File.join(Gem.user_dir, "gems", @spec.full_name),
781
943
  installer.gem_dir
782
944
  assert_equal @tempdir, installer.bin_dir
783
945
  end
@@ -785,29 +947,26 @@ gem 'other', version
785
947
  def test_install
786
948
  installer = util_setup_installer
787
949
 
788
- gemdir = File.join @gemhome, 'gems', @spec.full_name
789
- cache_file = File.join @gemhome, 'cache', @spec.file_name
790
- stub_exe = File.join @gemhome, 'bin', 'executable'
791
- rakefile = File.join gemdir, 'ext', 'a', 'Rakefile'
792
- spec_file = File.join @gemhome, 'specifications', @spec.spec_name
950
+ gemdir = File.join @gemhome, "gems", @spec.full_name
951
+ cache_file = File.join @gemhome, "cache", @spec.file_name
952
+ stub_exe = File.join @gemhome, "bin", "executable"
953
+ rakefile = File.join gemdir, "ext", "a", "Rakefile"
954
+ spec_file = File.join @gemhome, "specifications", @spec.spec_name
793
955
 
794
956
  Gem.pre_install do
795
- refute_path_exists cache_file, 'cache file must not exist yet'
796
- refute_path_exists spec_file, 'spec file must not exist yet'
957
+ assert_path_not_exist cache_file, "cache file must not exist yet"
797
958
  true
798
959
  end
799
960
 
800
961
  Gem.post_build do
801
- assert_path_exists gemdir, 'gem install dir must exist'
802
- assert_path_exists rakefile, 'gem executable must exist'
803
- refute_path_exists stub_exe, 'gem executable must not exist'
804
- refute_path_exists spec_file, 'spec file must not exist yet'
962
+ assert_path_exist gemdir, "gem install dir must exist"
963
+ assert_path_exist rakefile, "gem executable must exist"
964
+ assert_path_not_exist stub_exe, "gem executable must not exist"
805
965
  true
806
966
  end
807
967
 
808
968
  Gem.post_install do
809
- assert_path_exists cache_file, 'cache file must exist'
810
- assert_path_exists spec_file, 'spec file must exist'
969
+ assert_path_exist cache_file, "cache file must exist"
811
970
  end
812
971
 
813
972
  @newspec = nil
@@ -818,21 +977,21 @@ gem 'other', version
818
977
  end
819
978
 
820
979
  assert_equal @spec, @newspec
821
- assert_path_exists gemdir
822
- assert_path_exists stub_exe, 'gem executable must exist'
980
+ assert_path_exist gemdir
981
+ assert_path_exist stub_exe, "gem executable must exist"
823
982
 
824
- exe = File.join gemdir, 'bin', 'executable'
825
- assert_path_exists exe
983
+ exe = File.join gemdir, "bin", "executable"
984
+ assert_path_exist exe
826
985
 
827
986
  exe_mode = File.stat(exe).mode & 0111
828
987
  assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
829
988
 
830
- assert_path_exists File.join gemdir, 'lib', 'code.rb'
989
+ assert_path_exist File.join gemdir, "lib", "code.rb"
831
990
 
832
- assert_path_exists rakefile
991
+ assert_path_exist rakefile
833
992
 
834
993
  assert_equal spec_file, @newspec.loaded_from
835
- assert_path_exists spec_file
994
+ assert_path_exist spec_file
836
995
 
837
996
  assert_same installer, @post_build_hook_arg
838
997
  assert_same installer, @post_install_hook_arg
@@ -844,7 +1003,7 @@ gem 'other', version
844
1003
 
845
1004
  installer.wrappers = true
846
1005
 
847
- gemdir = File.join @gemhome, 'gems', @spec.full_name
1006
+ gemdir = File.join @gemhome, "gems", @spec.full_name
848
1007
 
849
1008
  @newspec = nil
850
1009
  build_rake_in do
@@ -853,9 +1012,9 @@ gem 'other', version
853
1012
  end
854
1013
  end
855
1014
 
856
- exe = File.join gemdir, 'bin', 'executable'
1015
+ exe = File.join gemdir, "bin", "executable"
857
1016
 
858
- e = assert_raises RuntimeError do
1017
+ e = assert_raise RuntimeError do
859
1018
  instance_eval File.read(exe)
860
1019
  end
861
1020
 
@@ -867,10 +1026,10 @@ gem 'other', version
867
1026
 
868
1027
  # build old version that has a bin file
869
1028
  installer = util_setup_gem do |spec|
870
- File.open File.join('bin', 'executable'), 'w' do |f|
1029
+ File.open File.join("bin", "executable"), "w" do |f|
871
1030
  f.puts "require 'code'"
872
1031
  end
873
- File.open File.join('lib', 'code.rb'), 'w' do |f|
1032
+ File.open File.join("lib", "code.rb"), "w" do |f|
874
1033
  f.puts 'raise "I have an executable"'
875
1034
  end
876
1035
  end
@@ -882,15 +1041,15 @@ gem 'other', version
882
1041
  end
883
1042
  end
884
1043
 
885
- old_bin_file = File.join installer.bin_dir, 'executable'
1044
+ old_bin_file = File.join installer.bin_dir, "executable"
886
1045
 
887
1046
  # build new version that doesn't have a bin file
888
1047
  installer = util_setup_gem do |spec|
889
- FileUtils.rm File.join('bin', 'executable')
890
- spec.files.delete File.join('bin', 'executable')
891
- spec.executables.delete 'executable'
1048
+ FileUtils.rm File.join("bin", "executable")
1049
+ spec.files.delete File.join("bin", "executable")
1050
+ spec.executables.delete "executable"
892
1051
  spec.version = @spec.version.bump
893
- File.open File.join('lib', 'code.rb'), 'w' do |f|
1052
+ File.open File.join("lib", "code.rb"), "w" do |f|
894
1053
  f.puts 'raise "I do not have an executable"'
895
1054
  end
896
1055
  end
@@ -901,13 +1060,13 @@ gem 'other', version
901
1060
  end
902
1061
  end
903
1062
 
904
- e = assert_raises RuntimeError do
1063
+ e = assert_raise RuntimeError do
905
1064
  instance_eval File.read(old_bin_file)
906
1065
  end
907
1066
 
908
1067
  # We expect the bin stub to activate the version that actually contains
909
1068
  # the binstub.
910
- assert_match('I have an executable', e.message)
1069
+ assert_match("I have an executable", e.message)
911
1070
  end
912
1071
 
913
1072
  def test_install_creates_binstub_that_understand_version
@@ -922,14 +1081,14 @@ gem 'other', version
922
1081
  end
923
1082
  end
924
1083
 
925
- exe = File.join @gemhome, 'bin', 'executable'
1084
+ exe = File.join @gemhome, "bin", "executable"
926
1085
 
927
1086
  ARGV.unshift "_3.0_"
928
1087
 
929
1088
  begin
930
1089
  Gem::Specification.reset
931
1090
 
932
- e = assert_raises Gem::GemNotFoundException do
1091
+ e = assert_raise Gem::GemNotFoundException do
933
1092
  instance_eval File.read(exe)
934
1093
  end
935
1094
  ensure
@@ -940,11 +1099,17 @@ gem 'other', version
940
1099
  end
941
1100
 
942
1101
  def test_install_creates_binstub_that_prefers_user_installed_gem_to_default
943
- install_default_gems new_default_spec('default', '2')
1102
+ default_spec = new_default_spec("default", "2", nil, "exe/executable")
1103
+ default_spec.executables = "executable"
1104
+ install_default_gems default_spec
1105
+
1106
+ exe = File.join @gemhome, "bin", "executable"
1107
+
1108
+ assert_path_exist exe, "default gem's executable not installed"
944
1109
 
945
1110
  installer = util_setup_installer do |spec|
946
- spec.name = 'default'
947
- spec.version = '2'
1111
+ spec.name = "default"
1112
+ spec.version = "2"
948
1113
  end
949
1114
 
950
1115
  util_clear_gems
@@ -958,9 +1123,7 @@ gem 'other', version
958
1123
  end
959
1124
  end
960
1125
 
961
- exe = File.join @gemhome, 'bin', 'executable'
962
-
963
- e = assert_raises RuntimeError do
1126
+ e = assert_raise RuntimeError do
964
1127
  instance_eval File.read(exe)
965
1128
  end
966
1129
 
@@ -979,7 +1142,7 @@ gem 'other', version
979
1142
  end
980
1143
  end
981
1144
 
982
- exe = File.join @gemhome, 'bin', 'executable'
1145
+ exe = File.join @gemhome, "bin", "executable"
983
1146
 
984
1147
  extra_arg = "\xE4pfel".dup.force_encoding("UTF-8")
985
1148
  ARGV.unshift extra_arg
@@ -987,7 +1150,7 @@ gem 'other', version
987
1150
  begin
988
1151
  Gem::Specification.reset
989
1152
 
990
- e = assert_raises RuntimeError do
1153
+ e = assert_raise RuntimeError do
991
1154
  instance_eval File.read(exe)
992
1155
  end
993
1156
  ensure
@@ -1006,16 +1169,16 @@ gem 'other', version
1006
1169
  end
1007
1170
  end
1008
1171
 
1009
- gemdir = File.join(@gemhome, 'gems', @spec.full_name)
1010
- assert_path_exists File.join gemdir, 'lib', 'code.rb'
1172
+ gemdir = File.join(@gemhome, "gems", @spec.full_name)
1173
+ assert_path_exist File.join gemdir, "lib", "code.rb"
1011
1174
 
1012
1175
  installer = util_setup_installer
1013
1176
 
1014
1177
  # Morph spec to have lib/other.rb instead of code.rb and recreate
1015
- @spec.files = File.join('lib', 'other.rb')
1178
+ @spec.files = File.join("lib", "other.rb")
1016
1179
  Dir.chdir @tempdir do
1017
- File.open File.join('lib', 'other.rb'), 'w' do |f|
1018
- f.puts '1'
1180
+ File.open File.join("lib", "other.rb"), "w" do |f|
1181
+ f.puts "1"
1019
1182
  end
1020
1183
 
1021
1184
  use_ui ui do
@@ -1023,56 +1186,71 @@ gem 'other', version
1023
1186
  Gem::Package.build @spec
1024
1187
  end
1025
1188
  end
1026
- installer = Gem::Installer.at @gem
1189
+ installer = Gem::Installer.at @gem, :force => true
1027
1190
  build_rake_in do
1028
1191
  use_ui @ui do
1029
1192
  assert_equal @spec, installer.install
1030
1193
  end
1031
1194
  end
1032
1195
 
1033
- assert_path_exists File.join gemdir, 'lib', 'other.rb'
1034
- refute_path_exists File.join gemdir, 'lib', 'code.rb',
1196
+ assert_path_exist File.join gemdir, "lib", "other.rb"
1197
+ assert_path_not_exist File.join gemdir, "lib", "code.rb",
1035
1198
  "code.rb from prior install of same gem shouldn't remain here"
1036
1199
  end
1037
1200
 
1038
1201
  def test_install_force
1202
+ _, missing_dep_gem = util_gem "missing_dep", "1" do |s|
1203
+ s.add_dependency "doesnt_exist", "1"
1204
+ end
1205
+
1039
1206
  use_ui @ui do
1040
- installer = Gem::Installer.at old_ruby_required('= 1.4.6'), :force => true
1207
+ installer = Gem::Installer.at missing_dep_gem, :force => true
1041
1208
  installer.install
1042
1209
  end
1043
1210
 
1044
- gem_dir = File.join(@gemhome, 'gems', 'old_ruby_required-1')
1045
- assert_path_exists gem_dir
1211
+ gem_dir = File.join(@gemhome, "gems", "missing_dep-1")
1212
+ assert_path_exist gem_dir
1213
+ end
1214
+
1215
+ def test_install_build_root
1216
+ build_root = File.join(@tempdir, "build_root")
1217
+
1218
+ @gem = setup_base_gem
1219
+ installer = Gem::Installer.at @gem, :build_root => build_root
1220
+
1221
+ assert_equal @spec, installer.install
1046
1222
  end
1047
1223
 
1048
1224
  def test_install_missing_dirs
1049
1225
  installer = setup_base_installer
1050
1226
 
1051
- FileUtils.rm_f File.join(Gem.dir, 'cache')
1052
- FileUtils.rm_f File.join(Gem.dir, 'doc')
1053
- FileUtils.rm_f File.join(Gem.dir, 'specifications')
1227
+ FileUtils.rm_rf File.join(Gem.dir, "doc")
1228
+ FileUtils.rm_rf File.join(Gem.dir, "specifications")
1054
1229
 
1055
1230
  use_ui @ui do
1056
1231
  installer.install
1057
1232
  end
1058
1233
 
1059
- assert_directory_exists File.join(Gem.dir, 'cache')
1060
- assert_directory_exists File.join(Gem.dir, 'doc')
1061
- assert_directory_exists File.join(Gem.dir, 'specifications')
1234
+ assert_directory_exists File.join(Gem.dir, "doc")
1235
+ assert_directory_exists File.join(Gem.dir, "specifications")
1062
1236
 
1063
- assert_path_exists File.join @gemhome, 'cache', @spec.file_name
1064
- assert_path_exists File.join @gemhome, 'specifications', @spec.spec_name
1237
+ assert_path_exist File.join @gemhome, "cache", @spec.file_name
1238
+ assert_path_exist File.join @gemhome, "specifications", @spec.spec_name
1065
1239
  end
1066
1240
 
1067
1241
  def test_install_post_build_false
1068
- installer = setup_base_installer
1242
+ @spec = util_spec "a"
1243
+
1244
+ util_build_gem @spec
1245
+
1246
+ installer = util_installer @spec, @gemhome
1069
1247
 
1070
1248
  Gem.post_build do
1071
1249
  false
1072
1250
  end
1073
1251
 
1074
1252
  use_ui @ui do
1075
- e = assert_raises Gem::InstallError do
1253
+ e = assert_raise Gem::InstallError do
1076
1254
  installer.install
1077
1255
  end
1078
1256
 
@@ -1081,11 +1259,11 @@ gem 'other', version
1081
1259
  assert_equal "post-build hook at #{location} failed for a-2", e.message
1082
1260
  end
1083
1261
 
1084
- spec_file = File.join @gemhome, 'specifications', @spec.spec_name
1085
- refute_path_exists spec_file
1262
+ spec_file = File.join @gemhome, "specifications", @spec.spec_name
1263
+ assert_path_not_exist spec_file
1086
1264
 
1087
- gem_dir = File.join @gemhome, 'gems', @spec.full_name
1088
- refute_path_exists gem_dir
1265
+ gem_dir = File.join @gemhome, "gems", @spec.full_name
1266
+ assert_path_not_exist gem_dir
1089
1267
  end
1090
1268
 
1091
1269
  def test_install_post_build_nil
@@ -1099,22 +1277,26 @@ gem 'other', version
1099
1277
  installer.install
1100
1278
  end
1101
1279
 
1102
- spec_file = File.join @gemhome, 'specifications', @spec.spec_name
1103
- assert_path_exists spec_file
1280
+ spec_file = File.join @gemhome, "specifications", @spec.spec_name
1281
+ assert_path_exist spec_file
1104
1282
 
1105
- gem_dir = File.join @gemhome, 'gems', @spec.full_name
1106
- assert_path_exists gem_dir
1283
+ gem_dir = File.join @gemhome, "gems", @spec.full_name
1284
+ assert_path_exist gem_dir
1107
1285
  end
1108
1286
 
1109
1287
  def test_install_pre_install_false
1110
- installer = setup_base_installer
1288
+ @spec = util_spec "a"
1289
+
1290
+ util_build_gem @spec
1291
+
1292
+ installer = util_installer @spec, @gemhome
1111
1293
 
1112
1294
  Gem.pre_install do
1113
1295
  false
1114
1296
  end
1115
1297
 
1116
1298
  use_ui @ui do
1117
- e = assert_raises Gem::InstallError do
1299
+ e = assert_raise Gem::InstallError do
1118
1300
  installer.install
1119
1301
  end
1120
1302
 
@@ -1123,8 +1305,8 @@ gem 'other', version
1123
1305
  assert_equal "pre-install hook at #{location} failed for a-2", e.message
1124
1306
  end
1125
1307
 
1126
- spec_file = File.join @gemhome, 'specifications', @spec.spec_name
1127
- refute_path_exists spec_file
1308
+ spec_file = File.join @gemhome, "specifications", @spec.spec_name
1309
+ assert_path_not_exist spec_file
1128
1310
  end
1129
1311
 
1130
1312
  def test_install_pre_install_nil
@@ -1138,13 +1320,13 @@ gem 'other', version
1138
1320
  installer.install
1139
1321
  end
1140
1322
 
1141
- spec_file = File.join @gemhome, 'specifications', @spec.spec_name
1142
- assert_path_exists spec_file
1323
+ spec_file = File.join @gemhome, "specifications", @spec.spec_name
1324
+ assert_path_exist spec_file
1143
1325
  end
1144
1326
 
1145
1327
  def test_install_with_message
1146
1328
  @spec = setup_base_spec
1147
- @spec.post_install_message = 'I am a shiny gem!'
1329
+ @spec.post_install_message = "I am a shiny gem!"
1148
1330
 
1149
1331
  use_ui @ui do
1150
1332
  path = Gem::Package.build @spec
@@ -1153,12 +1335,12 @@ gem 'other', version
1153
1335
  installer.install
1154
1336
  end
1155
1337
 
1156
- assert_match %r|I am a shiny gem!|, @ui.output
1338
+ assert_match %r{I am a shiny gem!}, @ui.output
1157
1339
  end
1158
1340
 
1159
1341
  def test_install_with_skipped_message
1160
1342
  @spec = setup_base_spec
1161
- @spec.post_install_message = 'I am a shiny gem!'
1343
+ @spec.post_install_message = "I am a shiny gem!"
1162
1344
 
1163
1345
  use_ui @ui do
1164
1346
  path = Gem::Package.build @spec
@@ -1167,7 +1349,7 @@ gem 'other', version
1167
1349
  installer.install
1168
1350
  end
1169
1351
 
1170
- refute_match %r|I am a shiny gem!|, @ui.output
1352
+ refute_match %r{I am a shiny gem!}, @ui.output
1171
1353
  end
1172
1354
 
1173
1355
  def test_install_extension_dir
@@ -1191,9 +1373,9 @@ gem 'other', version
1191
1373
  installer.install
1192
1374
  end
1193
1375
 
1194
- expected_makefile = File.join gemhome2, 'gems', @spec.full_name, 'Makefile'
1376
+ expected_makefile = File.join gemhome2, "gems", @spec.full_name, "Makefile"
1195
1377
 
1196
- assert_path_exists expected_makefile
1378
+ assert_path_exist expected_makefile
1197
1379
  end
1198
1380
 
1199
1381
  def test_install_extension_dir_is_removed_on_reinstall
@@ -1222,15 +1404,15 @@ gem 'other', version
1222
1404
  write_file should_be_removed do |io|
1223
1405
  io.write "DELETE ME ON REINSTALL"
1224
1406
  end
1225
- assert_path_exists should_be_removed
1407
+ assert_path_exist should_be_removed
1226
1408
 
1227
1409
  # reinstall the gem, this is also the same as pristine
1228
1410
  use_ui @ui do
1229
- installer = Gem::Installer.at path
1411
+ installer = Gem::Installer.at path, :force => true
1230
1412
  installer.install
1231
1413
  end
1232
1414
 
1233
- refute_path_exists should_be_removed
1415
+ assert_path_not_exist should_be_removed
1234
1416
  end
1235
1417
 
1236
1418
  def test_install_user_extension_dir
@@ -1256,15 +1438,15 @@ gem 'other', version
1256
1438
  installer.install
1257
1439
  end
1258
1440
 
1259
- expected_makefile = File.join Gem.user_dir, 'gems', @spec.full_name, 'Makefile'
1441
+ expected_makefile = File.join Gem.user_dir, "gems", @spec.full_name, "Makefile"
1260
1442
 
1261
- assert_path_exists expected_makefile
1262
- assert_path_exists expected_extension_dir
1263
- refute_path_exists File.join expected_extension_dir, 'gem_make.out'
1443
+ assert_path_exist expected_makefile
1444
+ assert_path_exist expected_extension_dir
1445
+ assert_path_not_exist File.join expected_extension_dir, "gem_make.out"
1264
1446
  end
1265
1447
 
1266
1448
  def test_find_lib_file_after_install
1267
- skip "extensions don't quite work on jruby" if Gem.java_platform?
1449
+ pend "extensions don't quite work on jruby" if Gem.java_platform?
1268
1450
 
1269
1451
  @spec = setup_base_spec
1270
1452
  @spec.extensions << "extconf.rb"
@@ -1290,7 +1472,7 @@ gem 'other', version
1290
1472
  end
1291
1473
 
1292
1474
  Dir.mkdir File.join(@tempdir, "lib")
1293
- write_file File.join(@tempdir, 'lib', "b.rb") do |io|
1475
+ write_file File.join(@tempdir, "lib", "b.rb") do |io|
1294
1476
  io.write "# b.rb"
1295
1477
  end
1296
1478
 
@@ -1303,14 +1485,15 @@ gem 'other', version
1303
1485
  installer.install
1304
1486
  end
1305
1487
 
1306
- expected = File.join @spec.full_require_paths.find { |path|
1307
- File.exist? File.join path, 'b.rb'
1308
- }, 'b.rb'
1309
- assert_equal expected, @spec.matches_for_glob('b.rb').first
1488
+ expected = File.join @spec.full_require_paths.find {|path|
1489
+ File.exist? File.join path, "b.rb"
1490
+ }, "b.rb"
1491
+ assert_equal expected, @spec.matches_for_glob("b.rb").first
1310
1492
  end
1311
1493
 
1312
1494
  def test_install_extension_and_script
1313
- skip "Makefile creation crashes on jruby" if Gem.java_platform?
1495
+ pend "Makefile creation crashes on jruby" if Gem.java_platform?
1496
+ pend if RUBY_PLATFORM.include?("mswin") && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
1314
1497
 
1315
1498
  @spec = setup_base_spec
1316
1499
  @spec.extensions << "extconf.rb"
@@ -1338,76 +1521,113 @@ gem 'other', version
1338
1521
  RUBY
1339
1522
  end
1340
1523
 
1341
- refute_path_exists File.join @spec.gem_dir, rb
1342
- refute_path_exists File.join @spec.gem_dir, rb2
1524
+ assert_path_not_exist File.join @spec.gem_dir, rb
1525
+ assert_path_not_exist File.join @spec.gem_dir, rb2
1343
1526
  use_ui @ui do
1344
1527
  path = Gem::Package.build @spec
1345
1528
 
1346
1529
  installer = Gem::Installer.at path
1347
1530
  installer.install
1348
1531
  end
1349
- assert_path_exists File.join @spec.gem_dir, rb
1350
- assert_path_exists File.join @spec.gem_dir, rb2
1532
+ assert_path_exist File.join @spec.gem_dir, rb
1533
+ assert_path_exist File.join @spec.gem_dir, rb2
1351
1534
  end
1352
1535
 
1353
1536
  def test_install_extension_flat
1354
- skip "extensions don't quite work on jruby" if Gem.java_platform?
1537
+ pend "extensions don't quite work on jruby" if Gem.java_platform?
1355
1538
 
1356
- @spec = setup_base_spec
1357
- @spec.require_paths = ["."]
1539
+ begin
1540
+ @spec = setup_base_spec
1541
+ @spec.require_paths = ["."]
1358
1542
 
1359
- @spec.extensions << "extconf.rb"
1543
+ @spec.extensions << "extconf.rb"
1360
1544
 
1361
- write_file File.join(@tempdir, "extconf.rb") do |io|
1362
- io.write <<-RUBY
1363
- require "mkmf"
1545
+ write_file File.join(@tempdir, "extconf.rb") do |io|
1546
+ io.write <<-RUBY
1547
+ require "mkmf"
1364
1548
 
1365
- CONFIG['CC'] = '$(TOUCH) $@ ||'
1366
- CONFIG['LDSHARED'] = '$(TOUCH) $@ ||'
1367
- $ruby = '#{Gem.ruby}'
1549
+ CONFIG['CC'] = '$(TOUCH) $@ ||'
1550
+ CONFIG['LDSHARED'] = '$(TOUCH) $@ ||'
1551
+ $ruby = '#{Gem.ruby}'
1368
1552
 
1369
- create_makefile("#{@spec.name}")
1370
- RUBY
1553
+ create_makefile("#{@spec.name}")
1554
+ RUBY
1555
+ end
1556
+
1557
+ # empty depend file for no auto dependencies
1558
+ @spec.files += %W[depend #{@spec.name}.c].each do |file|
1559
+ write_file File.join(@tempdir, file)
1560
+ end
1561
+
1562
+ so = File.join(@spec.extension_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}")
1563
+ assert_path_not_exist so
1564
+ use_ui @ui do
1565
+ path = Gem::Package.build @spec
1566
+
1567
+ installer = Gem::Installer.at path
1568
+ installer.install
1569
+ end
1570
+ assert_path_exist so
1571
+ rescue
1572
+ puts "-" * 78
1573
+ puts File.read File.join(@gemhome, "gems", "a-2", "Makefile")
1574
+ puts "-" * 78
1575
+
1576
+ path = File.join(@gemhome, "gems", "a-2", "gem_make.out")
1577
+
1578
+ if File.exist?(path)
1579
+ puts File.read(path)
1580
+ puts "-" * 78
1581
+ end
1582
+
1583
+ raise
1371
1584
  end
1585
+ end
1586
+
1587
+ def test_install_extension_clean_intermediate_files
1588
+ pend "extensions don't quite work on jruby" if Gem.java_platform?
1589
+ @spec = setup_base_spec
1590
+ @spec.require_paths = ["."]
1591
+ @spec.extensions << "extconf.rb"
1592
+
1593
+ File.write File.join(@tempdir, "extconf.rb"), <<-RUBY
1594
+ require "mkmf"
1595
+ CONFIG['CC'] = '$(TOUCH) $@ ||'
1596
+ CONFIG['LDSHARED'] = '$(TOUCH) $@ ||'
1597
+ $ruby = '#{Gem.ruby}'
1598
+ create_makefile("#{@spec.name}")
1599
+ RUBY
1372
1600
 
1373
1601
  # empty depend file for no auto dependencies
1374
- @spec.files += %W"depend #{@spec.name}.c".each do |file|
1602
+ @spec.files += %W[depend #{@spec.name}.c].each do |file|
1375
1603
  write_file File.join(@tempdir, file)
1376
1604
  end
1377
1605
 
1378
- so = File.join(@spec.gem_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}")
1379
- refute_path_exists so
1606
+ shared_object = "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}"
1607
+ extension_file = File.join @spec.extension_dir, shared_object
1608
+ intermediate_file = File.join @spec.gem_dir, shared_object
1609
+
1610
+ assert_path_not_exist extension_file, "no before installing"
1380
1611
  use_ui @ui do
1381
1612
  path = Gem::Package.build @spec
1382
1613
 
1383
1614
  installer = Gem::Installer.at path
1384
1615
  installer.install
1385
1616
  end
1386
- assert_path_exists so
1387
- rescue
1388
- puts '-' * 78
1389
- puts File.read File.join(@gemhome, 'gems', 'a-2', 'Makefile')
1390
- puts '-' * 78
1391
-
1392
- path = File.join(@gemhome, 'gems', 'a-2', 'gem_make.out')
1393
1617
 
1394
- if File.exist?(path)
1395
- puts File.read(path)
1396
- puts '-' * 78
1397
- end
1398
-
1399
- raise
1618
+ assert_path_exist extension_file, "installed"
1619
+ assert_path_not_exist intermediate_file
1400
1620
  end
1401
1621
 
1402
1622
  def test_installation_satisfies_dependency_eh
1403
1623
  installer = setup_base_installer
1404
1624
 
1405
- util_spec 'a'
1625
+ util_spec "a"
1406
1626
 
1407
- dep = Gem::Dependency.new 'a', '>= 2'
1627
+ dep = Gem::Dependency.new "a", ">= 2"
1408
1628
  assert installer.installation_satisfies_dependency?(dep)
1409
1629
 
1410
- dep = Gem::Dependency.new 'a', '> 2'
1630
+ dep = Gem::Dependency.new "a", "> 2"
1411
1631
  refute installer.installation_satisfies_dependency?(dep)
1412
1632
  end
1413
1633
 
@@ -1416,19 +1636,20 @@ gem 'other', version
1416
1636
  installer.options[:development] = true
1417
1637
  installer.options[:dev_shallow] = true
1418
1638
 
1419
- util_spec 'a'
1639
+ util_spec "a"
1420
1640
 
1421
- dep = Gem::Dependency.new 'a', :development
1641
+ dep = Gem::Dependency.new "a", :development
1422
1642
  assert installer.installation_satisfies_dependency?(dep)
1423
1643
  end
1424
1644
 
1425
1645
  def test_pre_install_checks_dependencies
1426
1646
  installer = setup_base_installer
1427
- @spec.add_dependency 'b', '> 5'
1647
+ @spec.add_dependency "b", "> 5"
1428
1648
  installer = util_setup_gem
1649
+ installer.force = false
1429
1650
 
1430
1651
  use_ui @ui do
1431
- assert_raises Gem::InstallError do
1652
+ assert_raise Gem::InstallError do
1432
1653
  installer.install
1433
1654
  end
1434
1655
  end
@@ -1436,7 +1657,7 @@ gem 'other', version
1436
1657
 
1437
1658
  def test_pre_install_checks_dependencies_ignore
1438
1659
  installer = util_setup_installer
1439
- @spec.add_dependency 'b', '> 5'
1660
+ @spec.add_dependency "b", "> 5"
1440
1661
  installer.ignore_dependencies = true
1441
1662
 
1442
1663
  build_rake_in do
@@ -1450,16 +1671,16 @@ gem 'other', version
1450
1671
  gemhome2 = "#{@gemhome}2"
1451
1672
 
1452
1673
  @gem = setup_base_gem
1453
- @spec.add_dependency 'd'
1674
+ @spec.add_dependency "d"
1454
1675
 
1455
- quick_gem 'd', 2
1676
+ quick_gem "d", 2
1456
1677
 
1457
1678
  gem = File.join @gemhome, @spec.file_name
1458
1679
 
1459
1680
  FileUtils.mv @gemhome, gemhome2
1460
1681
  FileUtils.mkdir @gemhome
1461
1682
 
1462
- FileUtils.mv File.join(gemhome2, 'cache', @spec.file_name), gem
1683
+ FileUtils.mv File.join(gemhome2, "cache", @spec.file_name), gem
1463
1684
 
1464
1685
  # Don't leak any already activated gems into the installer, require
1465
1686
  # that it work everything out on it's own.
@@ -1474,56 +1695,8 @@ gem 'other', version
1474
1695
  end
1475
1696
  end
1476
1697
 
1477
- def test_pre_install_checks_ruby_version
1478
- use_ui @ui do
1479
- installer = Gem::Installer.at old_ruby_required('= 1.4.6')
1480
- e = assert_raises Gem::RuntimeRequirementNotMetError do
1481
- installer.pre_install_checks
1482
- end
1483
- rv = Gem.ruby_version
1484
- assert_equal "old_ruby_required requires Ruby version = 1.4.6. The current ruby version is #{rv}.",
1485
- e.message
1486
- end
1487
- end
1488
-
1489
- def test_pre_install_checks_ruby_version_with_prereleases
1490
- util_set_RUBY_VERSION '2.6.0', -1, '63539', 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
1491
-
1492
- installer = Gem::Installer.at old_ruby_required('>= 2.6.0.preview2')
1493
- assert installer.pre_install_checks
1494
-
1495
- installer = Gem::Installer.at old_ruby_required('> 2.6.0.preview2')
1496
- e = assert_raises Gem::RuntimeRequirementNotMetError do
1497
- assert installer.pre_install_checks
1498
- end
1499
- assert_equal "old_ruby_required requires Ruby version > 2.6.0.preview2. The current ruby version is 2.6.0.preview2.",
1500
- e.message
1501
- ensure
1502
- util_restore_RUBY_VERSION
1503
- end
1504
-
1505
- def test_pre_install_checks_wrong_rubygems_version
1506
- spec = util_spec 'old_rubygems_required', '1' do |s|
1507
- s.required_rubygems_version = '< 0'
1508
- end
1509
-
1510
- util_build_gem spec
1511
-
1512
- gem = File.join(@gemhome, 'cache', spec.file_name)
1513
-
1514
- use_ui @ui do
1515
- installer = Gem::Installer.at gem
1516
- e = assert_raises Gem::RuntimeRequirementNotMetError do
1517
- installer.pre_install_checks
1518
- end
1519
- rgv = Gem::VERSION
1520
- assert_equal "old_rubygems_required requires RubyGems version < 0. The current RubyGems version is #{rgv}. " +
1521
- "Try 'gem update --system' to update RubyGems itself.", e.message
1522
- end
1523
- end
1524
-
1525
1698
  def test_pre_install_checks_malicious_name
1526
- spec = util_spec '../malicious', '1'
1699
+ spec = util_spec "../malicious", "1"
1527
1700
  def spec.full_name # so the spec is buildable
1528
1701
  "malicious-1"
1529
1702
  end
@@ -1531,19 +1704,19 @@ gem 'other', version
1531
1704
 
1532
1705
  util_build_gem spec
1533
1706
 
1534
- gem = File.join(@gemhome, 'cache', spec.file_name)
1707
+ gem = File.join(@gemhome, "cache", spec.file_name)
1535
1708
 
1536
1709
  use_ui @ui do
1537
1710
  installer = Gem::Installer.at gem
1538
- e = assert_raises Gem::InstallError do
1711
+ e = assert_raise Gem::InstallError do
1539
1712
  installer.pre_install_checks
1540
1713
  end
1541
- assert_equal '#<Gem::Specification name=../malicious version=1> has an invalid name', e.message
1714
+ assert_equal "#<Gem::Specification name=../malicious version=1> has an invalid name", e.message
1542
1715
  end
1543
1716
  end
1544
1717
 
1545
1718
  def test_pre_install_checks_malicious_name_before_eval
1546
- spec = util_spec "malicious\n::Object.const_set(:FROM_EVAL, true)#", '1'
1719
+ spec = util_spec "malicious\n::Object.const_set(:FROM_EVAL, true)#", "1"
1547
1720
  def spec.full_name # so the spec is buildable
1548
1721
  "malicious-1"
1549
1722
  end
@@ -1551,11 +1724,11 @@ gem 'other', version
1551
1724
 
1552
1725
  util_build_gem spec
1553
1726
 
1554
- gem = File.join(@gemhome, 'cache', spec.file_name)
1727
+ gem = File.join(@gemhome, "cache", spec.file_name)
1555
1728
 
1556
1729
  use_ui @ui do
1557
1730
  installer = Gem::Installer.at gem
1558
- e = assert_raises Gem::InstallError do
1731
+ e = assert_raise Gem::InstallError do
1559
1732
  installer.pre_install_checks
1560
1733
  end
1561
1734
  assert_equal "#<Gem::Specification name=malicious\n::Object.const_set(:FROM_EVAL, true)# version=1> has an invalid name", e.message
@@ -1564,7 +1737,7 @@ gem 'other', version
1564
1737
  end
1565
1738
 
1566
1739
  def test_pre_install_checks_malicious_require_paths_before_eval
1567
- spec = util_spec "malicious", '1'
1740
+ spec = util_spec "malicious", "1"
1568
1741
  def spec.full_name # so the spec is buildable
1569
1742
  "malicious-1"
1570
1743
  end
@@ -1573,11 +1746,11 @@ gem 'other', version
1573
1746
 
1574
1747
  util_build_gem spec
1575
1748
 
1576
- gem = File.join(@gemhome, 'cache', spec.file_name)
1749
+ gem = File.join(@gemhome, "cache", spec.file_name)
1577
1750
 
1578
1751
  use_ui @ui do
1579
1752
  installer = Gem::Installer.at gem
1580
- e = assert_raises Gem::InstallError do
1753
+ e = assert_raise Gem::InstallError do
1581
1754
  installer.pre_install_checks
1582
1755
  end
1583
1756
  assert_equal "#<Gem::Specification name=malicious version=1> has an invalid require_paths", e.message
@@ -1585,9 +1758,9 @@ gem 'other', version
1585
1758
  end
1586
1759
 
1587
1760
  def test_pre_install_checks_malicious_extensions_before_eval
1588
- skip "mswin environment disallow to create file contained the carriage return code." if Gem.win_platform?
1761
+ pend "mswin environment disallow to create file contained the carriage return code." if Gem.win_platform?
1589
1762
 
1590
- spec = util_spec "malicious", '1'
1763
+ spec = util_spec "malicious", "1"
1591
1764
  def spec.full_name # so the spec is buildable
1592
1765
  "malicious-1"
1593
1766
  end
@@ -1596,11 +1769,11 @@ gem 'other', version
1596
1769
 
1597
1770
  util_build_gem spec
1598
1771
 
1599
- gem = File.join(@gemhome, 'cache', spec.file_name)
1772
+ gem = File.join(@gemhome, "cache", spec.file_name)
1600
1773
 
1601
1774
  use_ui @ui do
1602
1775
  installer = Gem::Installer.at gem
1603
- e = assert_raises Gem::InstallError do
1776
+ e = assert_raise Gem::InstallError do
1604
1777
  installer.pre_install_checks
1605
1778
  end
1606
1779
  assert_equal "#<Gem::Specification name=malicious version=1> has an invalid extensions", e.message
@@ -1608,7 +1781,7 @@ gem 'other', version
1608
1781
  end
1609
1782
 
1610
1783
  def test_pre_install_checks_malicious_specification_version_before_eval
1611
- spec = util_spec "malicious", '1'
1784
+ spec = util_spec "malicious", "1"
1612
1785
  def spec.full_name # so the spec is buildable
1613
1786
  "malicious-1"
1614
1787
  end
@@ -1617,11 +1790,11 @@ gem 'other', version
1617
1790
 
1618
1791
  util_build_gem spec
1619
1792
 
1620
- gem = File.join(@gemhome, 'cache', spec.file_name)
1793
+ gem = File.join(@gemhome, "cache", spec.file_name)
1621
1794
 
1622
1795
  use_ui @ui do
1623
1796
  installer = Gem::Installer.at gem
1624
- e = assert_raises Gem::InstallError do
1797
+ e = assert_raise Gem::InstallError do
1625
1798
  installer.pre_install_checks
1626
1799
  end
1627
1800
  assert_equal "#<Gem::Specification name=malicious version=1> has an invalid specification_version", e.message
@@ -1629,196 +1802,332 @@ gem 'other', version
1629
1802
  end
1630
1803
 
1631
1804
  def test_pre_install_checks_malicious_dependencies_before_eval
1632
- spec = util_spec "malicious", '1'
1805
+ spec = util_spec "malicious", "1"
1633
1806
  def spec.full_name # so the spec is buildable
1634
1807
  "malicious-1"
1635
1808
  end
1636
1809
  def spec.validate(*args); end
1637
- spec.add_dependency "b\nfoo", '> 5'
1810
+ spec.add_dependency "b\nfoo", "> 5"
1638
1811
 
1639
1812
  util_build_gem spec
1640
1813
 
1641
- gem = File.join(@gemhome, 'cache', spec.file_name)
1814
+ gem = File.join(@gemhome, "cache", spec.file_name)
1642
1815
 
1643
1816
  use_ui @ui do
1644
1817
  installer = Gem::Installer.at gem
1645
1818
  installer.ignore_dependencies = true
1646
- e = assert_raises Gem::InstallError do
1819
+ e = assert_raise Gem::InstallError do
1647
1820
  installer.pre_install_checks
1648
1821
  end
1649
1822
  assert_equal "#<Gem::Specification name=malicious version=1> has an invalid dependencies", e.message
1650
1823
  end
1651
1824
  end
1652
1825
 
1826
+ def test_pre_install_checks_malicious_platform_before_eval
1827
+ gem_with_ill_formated_platform = File.expand_path("packages/ill-formatted-platform-1.0.0.10.gem", __dir__)
1828
+
1829
+ installer = Gem::Installer.at(
1830
+ gem_with_ill_formated_platform,
1831
+ :install_dir => @gemhome,
1832
+ :user_install => false,
1833
+ :force => true
1834
+ )
1835
+
1836
+ use_ui @ui do
1837
+ e = assert_raise Gem::InstallError do
1838
+ installer.pre_install_checks
1839
+ end
1840
+
1841
+ assert_equal "x86-mswin32\n system('id > /tmp/nyangawa')# is an invalid platform", e.message
1842
+ assert_empty @ui.output
1843
+ end
1844
+ end
1845
+
1653
1846
  def test_shebang
1654
- installer = setup_base_installer
1847
+ load_relative "no" do
1848
+ installer = setup_base_installer
1655
1849
 
1656
- util_make_exec @spec, "#!/usr/bin/ruby"
1850
+ util_make_exec @spec, "#!/usr/bin/ruby"
1657
1851
 
1658
- shebang = installer.shebang 'executable'
1852
+ shebang = installer.shebang "executable"
1659
1853
 
1660
- assert_equal "#!#{Gem.ruby}", shebang
1854
+ assert_equal "#!#{Gem.ruby}", shebang
1855
+ end
1661
1856
  end
1662
1857
 
1663
1858
  def test_process_options
1664
1859
  installer = setup_base_installer
1665
1860
 
1666
1861
  assert_nil installer.build_root
1667
- assert_equal File.join(@gemhome, 'bin'), installer.bin_dir
1862
+ assert_equal File.join(@gemhome, "bin"), installer.bin_dir
1668
1863
  assert_equal @gemhome, installer.gem_home
1669
1864
  end
1670
1865
 
1671
1866
  def test_process_options_build_root
1672
- build_root = File.join @tempdir, 'build_root'
1867
+ build_root = File.join @tempdir, "build_root"
1868
+ bin_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""), "bin")
1869
+ gem_home = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""))
1870
+ plugins_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""), "plugins")
1673
1871
 
1674
1872
  @gem = setup_base_gem
1675
- installer = Gem::Installer.at @gem, :build_root => build_root
1873
+ installer = use_ui(@ui) { Gem::Installer.at @gem, :build_root => build_root }
1874
+
1875
+ assert_equal build_root, installer.build_root
1876
+ assert_equal bin_dir, installer.bin_dir
1877
+ assert_equal gem_home, installer.gem_home
1676
1878
 
1677
- assert_equal Pathname(build_root), installer.build_root
1678
- assert_equal File.join(build_root, @gemhome, 'bin'), installer.bin_dir
1679
- assert_equal File.join(build_root, @gemhome), installer.gem_home
1879
+ errors = @ui.error.split("\n")
1880
+
1881
+ assert_equal "WARNING: You build with buildroot.", errors.shift
1882
+ assert_equal " Build root: #{build_root}", errors.shift
1883
+ assert_equal " Bin dir: #{bin_dir}", errors.shift
1884
+ assert_equal " Gem home: #{gem_home}", errors.shift
1885
+ assert_equal " Plugins dir: #{plugins_dir}", errors.shift
1680
1886
  end
1681
1887
 
1682
1888
  def test_shebang_arguments
1683
- installer = setup_base_installer
1889
+ load_relative "no" do
1890
+ installer = setup_base_installer
1684
1891
 
1685
- util_make_exec @spec, "#!/usr/bin/ruby -ws"
1892
+ util_make_exec @spec, "#!/usr/bin/ruby -ws"
1686
1893
 
1687
- shebang = installer.shebang 'executable'
1894
+ shebang = installer.shebang "executable"
1688
1895
 
1689
- assert_equal "#!#{Gem.ruby} -ws", shebang
1896
+ assert_equal "#!#{Gem.ruby} -ws", shebang
1897
+ end
1898
+ end
1899
+
1900
+ def test_shebang_arguments_with_load_relative
1901
+ load_relative "yes" do
1902
+ installer = setup_base_installer
1903
+
1904
+ util_make_exec @spec, "#!/usr/bin/ruby -ws"
1905
+
1906
+ shebang = installer.shebang "executable"
1907
+
1908
+ shebang_lines = shebang.split "\n"
1909
+
1910
+ assert_equal "#!/bin/sh", shebang_lines.shift
1911
+ assert_includes shebang_lines, "#!#{Gem.ruby} -ws"
1912
+ end
1690
1913
  end
1691
1914
 
1692
1915
  def test_shebang_empty
1693
- installer = setup_base_installer
1916
+ load_relative "no" do
1917
+ installer = setup_base_installer
1694
1918
 
1695
- util_make_exec @spec, ''
1919
+ util_make_exec @spec, ""
1696
1920
 
1697
- shebang = installer.shebang 'executable'
1698
- assert_equal "#!#{Gem.ruby}", shebang
1921
+ shebang = installer.shebang "executable"
1922
+ assert_equal "#!#{Gem.ruby}", shebang
1923
+ end
1699
1924
  end
1700
1925
 
1701
1926
  def test_shebang_env
1702
- installer = setup_base_installer
1927
+ load_relative "no" do
1928
+ installer = setup_base_installer
1703
1929
 
1704
- util_make_exec @spec, "#!/usr/bin/env ruby"
1930
+ util_make_exec @spec, "#!/usr/bin/env ruby"
1705
1931
 
1706
- shebang = installer.shebang 'executable'
1932
+ shebang = installer.shebang "executable"
1707
1933
 
1708
- assert_equal "#!#{Gem.ruby}", shebang
1934
+ assert_equal "#!#{Gem.ruby}", shebang
1935
+ end
1709
1936
  end
1710
1937
 
1711
1938
  def test_shebang_env_arguments
1712
- installer = setup_base_installer
1939
+ load_relative "no" do
1940
+ installer = setup_base_installer
1941
+
1942
+ util_make_exec @spec, "#!/usr/bin/env ruby -ws"
1943
+
1944
+ shebang = installer.shebang "executable"
1713
1945
 
1714
- util_make_exec @spec, "#!/usr/bin/env ruby -ws"
1946
+ assert_equal "#!#{Gem.ruby} -ws", shebang
1947
+ end
1948
+ end
1949
+
1950
+ def test_shebang_env_arguments_with_load_relative
1951
+ load_relative "yes" do
1952
+ installer = setup_base_installer
1953
+
1954
+ util_make_exec @spec, "#!/usr/bin/env ruby -ws"
1955
+
1956
+ shebang = installer.shebang "executable"
1715
1957
 
1716
- shebang = installer.shebang 'executable'
1958
+ shebang_lines = shebang.split "\n"
1717
1959
 
1718
- assert_equal "#!#{Gem.ruby} -ws", shebang
1960
+ assert_equal "#!/bin/sh", shebang_lines.shift
1961
+ assert_includes shebang_lines, "#!#{Gem.ruby} -ws"
1962
+ end
1719
1963
  end
1720
1964
 
1721
1965
  def test_shebang_env_shebang
1722
1966
  installer = setup_base_installer
1723
1967
 
1724
- util_make_exec @spec, ''
1968
+ util_make_exec @spec, ""
1725
1969
  installer.env_shebang = true
1726
1970
 
1727
- shebang = installer.shebang 'executable'
1971
+ shebang = installer.shebang "executable"
1728
1972
 
1729
- env_shebang = "/usr/bin/env" unless Gem.win_platform?
1973
+ bin_env = get_bin_env
1730
1974
 
1731
- assert_equal("#!#{env_shebang} #{RbConfig::CONFIG['ruby_install_name']}",
1975
+ assert_equal("#!#{bin_env} #{RbConfig::CONFIG['ruby_install_name']}",
1732
1976
  shebang)
1733
1977
  end
1734
1978
 
1735
1979
  def test_shebang_nested
1736
- installer = setup_base_installer
1980
+ load_relative "no" do
1981
+ installer = setup_base_installer
1737
1982
 
1738
- util_make_exec @spec, "#!/opt/local/ruby/bin/ruby"
1983
+ util_make_exec @spec, "#!/opt/local/ruby/bin/ruby"
1739
1984
 
1740
- shebang = installer.shebang 'executable'
1985
+ shebang = installer.shebang "executable"
1741
1986
 
1742
- assert_equal "#!#{Gem.ruby}", shebang
1987
+ assert_equal "#!#{Gem.ruby}", shebang
1988
+ end
1743
1989
  end
1744
1990
 
1745
1991
  def test_shebang_nested_arguments
1746
- installer = setup_base_installer
1992
+ load_relative "no" do
1993
+ installer = setup_base_installer
1747
1994
 
1748
- util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
1995
+ util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
1749
1996
 
1750
- shebang = installer.shebang 'executable'
1997
+ shebang = installer.shebang "executable"
1751
1998
 
1752
- assert_equal "#!#{Gem.ruby} -ws", shebang
1999
+ assert_equal "#!#{Gem.ruby} -ws", shebang
2000
+ end
2001
+ end
2002
+
2003
+ def test_shebang_nested_arguments_with_load_relative
2004
+ load_relative "yes" do
2005
+ installer = setup_base_installer
2006
+
2007
+ util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
2008
+
2009
+ shebang = installer.shebang "executable"
2010
+
2011
+ shebang_lines = shebang.split "\n"
2012
+
2013
+ assert_equal "#!/bin/sh", shebang_lines.shift
2014
+ assert_includes shebang_lines, "#!#{Gem.ruby} -ws"
2015
+ end
1753
2016
  end
1754
2017
 
1755
2018
  def test_shebang_version
1756
- installer = setup_base_installer
2019
+ load_relative "no" do
2020
+ installer = setup_base_installer
1757
2021
 
1758
- util_make_exec @spec, "#!/usr/bin/ruby18"
2022
+ util_make_exec @spec, "#!/usr/bin/ruby18"
1759
2023
 
1760
- shebang = installer.shebang 'executable'
2024
+ shebang = installer.shebang "executable"
1761
2025
 
1762
- assert_equal "#!#{Gem.ruby}", shebang
2026
+ assert_equal "#!#{Gem.ruby}", shebang
2027
+ end
1763
2028
  end
1764
2029
 
1765
2030
  def test_shebang_version_arguments
1766
- installer = setup_base_installer
2031
+ load_relative "no" do
2032
+ installer = setup_base_installer
2033
+
2034
+ util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
2035
+
2036
+ shebang = installer.shebang "executable"
1767
2037
 
1768
- util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
2038
+ assert_equal "#!#{Gem.ruby} -ws", shebang
2039
+ end
2040
+ end
1769
2041
 
1770
- shebang = installer.shebang 'executable'
2042
+ def test_shebang_version_arguments_with_load_relative
2043
+ load_relative "yes" do
2044
+ installer = setup_base_installer
1771
2045
 
1772
- assert_equal "#!#{Gem.ruby} -ws", shebang
2046
+ util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
2047
+
2048
+ shebang = installer.shebang "executable"
2049
+
2050
+ shebang_lines = shebang.split "\n"
2051
+
2052
+ assert_equal "#!/bin/sh", shebang_lines.shift
2053
+ assert_includes shebang_lines, "#!#{Gem.ruby} -ws"
2054
+ end
1773
2055
  end
1774
2056
 
1775
2057
  def test_shebang_version_env
1776
- installer = setup_base_installer
2058
+ load_relative "no" do
2059
+ installer = setup_base_installer
1777
2060
 
1778
- util_make_exec @spec, "#!/usr/bin/env ruby18"
2061
+ util_make_exec @spec, "#!/usr/bin/env ruby18"
1779
2062
 
1780
- shebang = installer.shebang 'executable'
2063
+ shebang = installer.shebang "executable"
1781
2064
 
1782
- assert_equal "#!#{Gem.ruby}", shebang
2065
+ assert_equal "#!#{Gem.ruby}", shebang
2066
+ end
1783
2067
  end
1784
2068
 
1785
2069
  def test_shebang_version_env_arguments
1786
- installer = setup_base_installer
2070
+ load_relative "no" do
2071
+ installer = setup_base_installer
2072
+
2073
+ util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
2074
+
2075
+ shebang = installer.shebang "executable"
2076
+
2077
+ assert_equal "#!#{Gem.ruby} -ws", shebang
2078
+ end
2079
+ end
2080
+
2081
+ def test_shebang_version_env_arguments_with_load_relative
2082
+ load_relative "yes" do
2083
+ installer = setup_base_installer
1787
2084
 
1788
- util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
2085
+ util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
1789
2086
 
1790
- shebang = installer.shebang 'executable'
2087
+ shebang = installer.shebang "executable"
1791
2088
 
1792
- assert_equal "#!#{Gem.ruby} -ws", shebang
2089
+ shebang_lines = shebang.split "\n"
2090
+
2091
+ assert_equal "#!/bin/sh", shebang_lines.shift
2092
+ assert_includes shebang_lines, "#!#{Gem.ruby} -ws"
2093
+ end
1793
2094
  end
1794
2095
 
1795
2096
  def test_shebang_custom
1796
2097
  installer = setup_base_installer
1797
2098
 
1798
2099
  conf = Gem::ConfigFile.new []
1799
- conf[:custom_shebang] = 'test'
2100
+ conf[:custom_shebang] = "test"
1800
2101
 
1801
2102
  Gem.configuration = conf
1802
2103
 
1803
2104
  util_make_exec @spec, "#!/usr/bin/ruby"
1804
2105
 
1805
- shebang = installer.shebang 'executable'
2106
+ shebang = installer.shebang "executable"
1806
2107
 
1807
2108
  assert_equal "#!test", shebang
1808
2109
  end
1809
2110
 
2111
+ def get_bin_env
2112
+ if win_platform?
2113
+ ""
2114
+ else
2115
+ %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) }
2116
+ end
2117
+ end
2118
+
1810
2119
  def test_shebang_custom_with_expands
1811
2120
  installer = setup_base_installer
1812
2121
 
1813
- bin_env = win_platform? ? '' : '/usr/bin/env'
2122
+ bin_env = get_bin_env
1814
2123
  conf = Gem::ConfigFile.new []
1815
- conf[:custom_shebang] = '1 $env 2 $ruby 3 $exec 4 $name'
2124
+ conf[:custom_shebang] = "1 $env 2 $ruby 3 $exec 4 $name"
1816
2125
 
1817
2126
  Gem.configuration = conf
1818
2127
 
1819
2128
  util_make_exec @spec, "#!/usr/bin/ruby"
1820
2129
 
1821
- shebang = installer.shebang 'executable'
2130
+ shebang = installer.shebang "executable"
1822
2131
 
1823
2132
  assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} 3 executable 4 a", shebang
1824
2133
  end
@@ -1826,15 +2135,15 @@ gem 'other', version
1826
2135
  def test_shebang_custom_with_expands_and_arguments
1827
2136
  installer = setup_base_installer
1828
2137
 
1829
- bin_env = win_platform? ? '' : '/usr/bin/env'
2138
+ bin_env = get_bin_env
1830
2139
  conf = Gem::ConfigFile.new []
1831
- conf[:custom_shebang] = '1 $env 2 $ruby 3 $exec'
2140
+ conf[:custom_shebang] = "1 $env 2 $ruby 3 $exec"
1832
2141
 
1833
2142
  Gem.configuration = conf
1834
2143
 
1835
2144
  util_make_exec @spec, "#!/usr/bin/ruby -ws"
1836
2145
 
1837
- shebang = installer.shebang 'executable'
2146
+ shebang = installer.shebang "executable"
1838
2147
 
1839
2148
  assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} -ws 3 executable", shebang
1840
2149
  end
@@ -1842,20 +2151,20 @@ gem 'other', version
1842
2151
  def test_unpack
1843
2152
  installer = util_setup_installer
1844
2153
 
1845
- dest = File.join @gemhome, 'gems', @spec.full_name
2154
+ dest = File.join @gemhome, "gems", @spec.full_name
1846
2155
 
1847
2156
  Gem::Deprecate.skip_during do
1848
2157
  installer.unpack dest
1849
2158
  end
1850
2159
 
1851
- assert_path_exists File.join dest, 'lib', 'code.rb'
1852
- assert_path_exists File.join dest, 'bin', 'executable'
2160
+ assert_path_exist File.join dest, "lib", "code.rb"
2161
+ assert_path_exist File.join dest, "bin", "executable"
1853
2162
  end
1854
2163
 
1855
2164
  def test_write_build_info_file
1856
2165
  installer = setup_base_installer
1857
2166
 
1858
- refute_path_exists @spec.build_info_file
2167
+ assert_path_not_exist @spec.build_info_file
1859
2168
 
1860
2169
  installer.build_args = %w[
1861
2170
  --with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4
@@ -1863,7 +2172,7 @@ gem 'other', version
1863
2172
 
1864
2173
  installer.write_build_info_file
1865
2174
 
1866
- assert_path_exists @spec.build_info_file
2175
+ assert_path_exist @spec.build_info_file
1867
2176
 
1868
2177
  expected = "--with-libyaml-dir\n/usr/local/Cellar/libyaml/0.1.4\n"
1869
2178
 
@@ -1873,11 +2182,11 @@ gem 'other', version
1873
2182
  def test_write_build_info_file_empty
1874
2183
  installer = setup_base_installer
1875
2184
 
1876
- refute_path_exists @spec.build_info_file
2185
+ assert_path_not_exist @spec.build_info_file
1877
2186
 
1878
2187
  installer.write_build_info_file
1879
2188
 
1880
- refute_path_exists @spec.build_info_file
2189
+ assert_path_not_exist @spec.build_info_file
1881
2190
  end
1882
2191
 
1883
2192
  def test_write_build_info_file_install_dir
@@ -1890,38 +2199,38 @@ gem 'other', version
1890
2199
 
1891
2200
  installer.write_build_info_file
1892
2201
 
1893
- refute_path_exists @spec.build_info_file
1894
- assert_path_exists \
1895
- File.join("#{@gemhome}2", 'build_info', "#{@spec.full_name}.info")
2202
+ assert_path_not_exist @spec.build_info_file
2203
+ assert_path_exist \
2204
+ File.join("#{@gemhome}2", "build_info", "#{@spec.full_name}.info")
1896
2205
  end
1897
2206
 
1898
2207
  def test_write_cache_file
1899
2208
  @gem = setup_base_gem
1900
- cache_file = File.join @gemhome, 'cache', @spec.file_name
2209
+ cache_file = File.join @gemhome, "cache", @spec.file_name
1901
2210
  gem = File.join @gemhome, @spec.file_name
1902
2211
 
1903
2212
  FileUtils.mv cache_file, gem
1904
- refute_path_exists cache_file
2213
+ assert_path_not_exist cache_file
1905
2214
 
1906
2215
  installer = Gem::Installer.at gem
1907
2216
  installer.gem_home = @gemhome
1908
2217
 
1909
2218
  installer.write_cache_file
1910
2219
 
1911
- assert_path_exists cache_file
2220
+ assert_path_exist cache_file
1912
2221
  end
1913
2222
 
1914
2223
  def test_write_spec
1915
2224
  @spec = setup_base_spec
1916
2225
  FileUtils.rm @spec.spec_file
1917
- refute_path_exists @spec.spec_file
2226
+ assert_path_not_exist @spec.spec_file
1918
2227
 
1919
2228
  installer = Gem::Installer.for_spec @spec
1920
2229
  installer.gem_home = @gemhome
1921
2230
 
1922
2231
  installer.write_spec
1923
2232
 
1924
- assert_path_exists @spec.spec_file
2233
+ assert_path_exist @spec.spec_file
1925
2234
 
1926
2235
  loaded = Gem::Specification.load @spec.spec_file
1927
2236
 
@@ -1933,7 +2242,7 @@ gem 'other', version
1933
2242
  def test_write_spec_writes_cached_spec
1934
2243
  @spec = setup_base_spec
1935
2244
  FileUtils.rm @spec.spec_file
1936
- refute_path_exists @spec.spec_file
2245
+ assert_path_not_exist @spec.spec_file
1937
2246
 
1938
2247
  @spec.files = %w[a.rb b.rb c.rb]
1939
2248
 
@@ -1948,14 +2257,45 @@ gem 'other', version
1948
2257
  assert_equal @spec, eval(File.read(@spec.spec_file))
1949
2258
  end
1950
2259
 
2260
+ def test_leaves_no_empty_cached_spec_when_no_more_disk_space
2261
+ @spec = setup_base_spec
2262
+ FileUtils.rm @spec.spec_file
2263
+ assert_path_not_exist @spec.spec_file
2264
+
2265
+ @spec.files = %w[a.rb b.rb c.rb]
2266
+
2267
+ installer = Gem::Installer.for_spec @spec
2268
+ installer.gem_home = @gemhome
2269
+
2270
+ File.class_eval do
2271
+ alias_method :original_write, :write
2272
+
2273
+ def write(data)
2274
+ raise Errno::ENOSPC
2275
+ end
2276
+ end
2277
+
2278
+ assert_raise Errno::ENOSPC do
2279
+ installer.write_spec
2280
+ end
2281
+
2282
+ assert_path_not_exist @spec.spec_file
2283
+ ensure
2284
+ File.class_eval do
2285
+ remove_method :write
2286
+ alias_method :write, :original_write # rubocop:disable Lint/DuplicateMethods
2287
+ remove_method :original_write
2288
+ end
2289
+ end
2290
+
1951
2291
  def test_dir
1952
2292
  installer = setup_base_installer
1953
2293
 
1954
- assert_match %r!/gemhome/gems/a-2$!, installer.dir
2294
+ assert_match %r{/gemhome/gems/a-2$}, installer.dir
1955
2295
  end
1956
2296
 
1957
2297
  def test_default_gem_loaded_from
1958
- spec = util_spec 'a'
2298
+ spec = util_spec "a"
1959
2299
  installer = Gem::Installer.for_spec spec, :install_as_default => true
1960
2300
  installer.install
1961
2301
  assert_predicate spec, :default_gem?
@@ -1964,7 +2304,7 @@ gem 'other', version
1964
2304
  def test_default_gem_without_wrappers
1965
2305
  installer = setup_base_installer
1966
2306
 
1967
- FileUtils.rm_f File.join(Gem.dir, 'specifications')
2307
+ FileUtils.rm_rf File.join(Gem.default_dir, "specifications")
1968
2308
 
1969
2309
  installer.wrappers = false
1970
2310
  installer.options[:install_as_default] = true
@@ -1974,24 +2314,30 @@ gem 'other', version
1974
2314
  installer.install
1975
2315
  end
1976
2316
 
1977
- assert_directory_exists File.join(@spec.gem_dir, 'bin')
1978
- installed_exec = File.join @spec.gem_dir, 'bin', 'executable'
1979
- assert_path_exists installed_exec
2317
+ assert_directory_exists File.join(@spec.gem_dir, "bin")
2318
+ installed_exec = File.join @spec.gem_dir, "bin", "executable"
2319
+ assert_path_exist installed_exec
1980
2320
 
1981
- assert_directory_exists File.join(Gem.default_dir, 'specifications')
1982
- assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default')
2321
+ assert_directory_exists File.join(Gem.default_dir, "specifications")
2322
+ assert_directory_exists File.join(Gem.default_dir, "specifications", "default")
1983
2323
 
1984
- default_spec = eval File.read File.join(Gem.default_dir, 'specifications', 'default', 'a-2.gemspec')
2324
+ default_spec = eval File.read File.join(Gem.default_dir, "specifications", "default", "a-2.gemspec")
1985
2325
  assert_equal Gem::Version.new("2"), default_spec.version
1986
- assert_equal ['bin/executable'], default_spec.files
2326
+ assert_equal ["bin/executable"], default_spec.files
1987
2327
 
1988
2328
  assert_directory_exists util_inst_bindir
1989
2329
 
1990
- installed_exec = File.join util_inst_bindir, 'executable'
1991
- assert_path_exists installed_exec
2330
+ installed_exec = File.join util_inst_bindir, "executable"
2331
+ assert_path_exist installed_exec
1992
2332
 
1993
2333
  wrapper = File.read installed_exec
1994
- refute_match %r|generated by RubyGems|, wrapper
2334
+
2335
+ if symlink_supported?
2336
+ refute_match %r{generated by RubyGems}, wrapper
2337
+ else # when symlink not supported, it warns and fallbacks back to installing wrapper
2338
+ assert_match %r{Unable to use symlinks, installing wrapper}, @ui.error
2339
+ assert_match %r{generated by RubyGems}, wrapper
2340
+ end
1995
2341
  end
1996
2342
 
1997
2343
  def test_default_gem_with_wrappers
@@ -2007,16 +2353,16 @@ gem 'other', version
2007
2353
 
2008
2354
  assert_directory_exists util_inst_bindir
2009
2355
 
2010
- installed_exec = File.join util_inst_bindir, 'executable'
2011
- assert_path_exists installed_exec
2356
+ installed_exec = File.join util_inst_bindir, "executable"
2357
+ assert_path_exist installed_exec
2012
2358
 
2013
2359
  wrapper = File.read installed_exec
2014
- assert_match %r|generated by RubyGems|, wrapper
2360
+ assert_match %r{generated by RubyGems}, wrapper
2015
2361
  end
2016
2362
 
2017
2363
  def test_default_gem_with_exe_as_bindir
2018
- @spec = quick_gem 'c' do |spec|
2019
- util_make_exec spec, '#!/usr/bin/ruby', 'exe'
2364
+ @spec = quick_gem "c" do |spec|
2365
+ util_make_exec spec, "#!/usr/bin/ruby", "exe"
2020
2366
  end
2021
2367
 
2022
2368
  util_build_gem @spec
@@ -2032,21 +2378,38 @@ gem 'other', version
2032
2378
  installer.install
2033
2379
  end
2034
2380
 
2035
- assert_directory_exists File.join(@spec.gem_dir, 'exe')
2036
- installed_exec = File.join @spec.gem_dir, 'exe', 'executable'
2037
- assert_path_exists installed_exec
2381
+ assert_directory_exists File.join(@spec.gem_dir, "exe")
2382
+ installed_exec = File.join @spec.gem_dir, "exe", "executable"
2383
+ assert_path_exist installed_exec
2038
2384
 
2039
- assert_directory_exists File.join(Gem.default_dir, 'specifications')
2040
- assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default')
2385
+ assert_directory_exists File.join(Gem.default_dir, "specifications")
2386
+ assert_directory_exists File.join(Gem.default_dir, "specifications", "default")
2041
2387
 
2042
- default_spec = eval File.read File.join(Gem.default_dir, 'specifications', 'default', 'c-2.gemspec')
2388
+ default_spec = eval File.read File.join(Gem.default_dir, "specifications", "default", "c-2.gemspec")
2043
2389
  assert_equal Gem::Version.new("2"), default_spec.version
2044
- assert_equal ['exe/executable'], default_spec.files
2390
+ assert_equal ["exe/executable"], default_spec.files
2391
+ end
2392
+
2393
+ def test_default_gem_to_specific_install_dir
2394
+ @gem = setup_base_gem
2395
+ installer = util_installer @spec, "#{@gemhome}2"
2396
+ installer.options[:install_as_default] = true
2397
+
2398
+ use_ui @ui do
2399
+ installer.install
2400
+ end
2401
+
2402
+ assert_directory_exists File.join("#{@gemhome}2", "specifications")
2403
+ assert_directory_exists File.join("#{@gemhome}2", "specifications", "default")
2404
+
2405
+ default_spec = eval File.read File.join("#{@gemhome}2", "specifications", "default", "a-2.gemspec")
2406
+ assert_equal Gem::Version.new("2"), default_spec.version
2407
+ assert_equal ["bin/executable"], default_spec.files
2045
2408
  end
2046
2409
 
2047
2410
  def test_package_attribute
2048
- gem = quick_gem 'c' do |spec|
2049
- util_make_exec spec, '#!/usr/bin/ruby', 'exe'
2411
+ gem = quick_gem "c" do |spec|
2412
+ util_make_exec spec, "#!/usr/bin/ruby", "exe"
2050
2413
  end
2051
2414
 
2052
2415
  installer = util_installer(gem, @gemhome)
@@ -2054,25 +2417,27 @@ gem 'other', version
2054
2417
  assert_kind_of(Gem::Package, installer.package)
2055
2418
  end
2056
2419
 
2057
- def old_ruby_required(requirement)
2058
- spec = util_spec 'old_ruby_required', '1' do |s|
2059
- s.required_ruby_version = requirement
2420
+ def test_gem_attribute
2421
+ gem = quick_gem "c" do |spec|
2422
+ util_make_exec spec, "#!/usr/bin/ruby", "exe"
2060
2423
  end
2061
2424
 
2062
- util_build_gem spec
2063
-
2064
- spec.cache_file
2425
+ installer = util_installer(gem, @gemhome)
2426
+ assert_respond_to(installer, :gem)
2427
+ assert_kind_of(String, installer.gem)
2065
2428
  end
2066
2429
 
2430
+ private
2431
+
2067
2432
  def util_execless
2068
- @spec = util_spec 'z'
2433
+ @spec = util_spec "z"
2069
2434
  util_build_gem @spec
2070
2435
 
2071
2436
  util_installer @spec, @gemhome
2072
2437
  end
2073
2438
 
2074
2439
  def util_conflict_executable(wrappers)
2075
- conflict = quick_gem 'conflict' do |spec|
2440
+ conflict = quick_gem "conflict" do |spec|
2076
2441
  util_make_exec spec
2077
2442
  end
2078
2443
 
@@ -2084,7 +2449,15 @@ gem 'other', version
2084
2449
  end
2085
2450
 
2086
2451
  def mask
2087
- 0100755 & (~File.umask)
2452
+ 0100755
2088
2453
  end
2089
2454
 
2455
+ def load_relative(value)
2456
+ orig_LIBRUBY_RELATIVE = RbConfig::CONFIG["LIBRUBY_RELATIVE"]
2457
+ RbConfig::CONFIG["LIBRUBY_RELATIVE"] = value
2458
+
2459
+ yield
2460
+ ensure
2461
+ RbConfig::CONFIG["LIBRUBY_RELATIVE"] = orig_LIBRUBY_RELATIVE
2462
+ end
2090
2463
  end