rubygems-update 3.4.22 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (528) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +99 -2
  3. data/Manifest.txt +34 -221
  4. data/README.md +1 -3
  5. data/bundler/CHANGELOG.md +53 -0
  6. data/bundler/bundler.gemspec +4 -2
  7. data/bundler/exe/bundle +1 -10
  8. data/bundler/lib/bundler/build_metadata.rb +3 -3
  9. data/bundler/lib/bundler/capistrano.rb +1 -1
  10. data/bundler/lib/bundler/checksum.rb +245 -0
  11. data/bundler/lib/bundler/ci_detector.rb +75 -0
  12. data/bundler/lib/bundler/cli/add.rb +3 -3
  13. data/bundler/lib/bundler/cli/binstubs.rb +4 -4
  14. data/bundler/lib/bundler/cli/cache.rb +1 -1
  15. data/bundler/lib/bundler/cli/check.rb +1 -1
  16. data/bundler/lib/bundler/cli/common.rb +9 -1
  17. data/bundler/lib/bundler/cli/config.rb +8 -7
  18. data/bundler/lib/bundler/cli/console.rb +3 -2
  19. data/bundler/lib/bundler/cli/doctor.rb +2 -2
  20. data/bundler/lib/bundler/cli/exec.rb +1 -1
  21. data/bundler/lib/bundler/cli/gem.rb +28 -23
  22. data/bundler/lib/bundler/cli/info.rb +2 -13
  23. data/bundler/lib/bundler/cli/install.rb +5 -4
  24. data/bundler/lib/bundler/cli/issue.rb +1 -1
  25. data/bundler/lib/bundler/cli/lock.rb +4 -4
  26. data/bundler/lib/bundler/cli/open.rb +1 -1
  27. data/bundler/lib/bundler/cli/outdated.rb +6 -6
  28. data/bundler/lib/bundler/cli/plugin.rb +7 -14
  29. data/bundler/lib/bundler/cli/pristine.rb +38 -30
  30. data/bundler/lib/bundler/cli/show.rb +2 -2
  31. data/bundler/lib/bundler/cli/update.rb +5 -5
  32. data/bundler/lib/bundler/cli.rb +215 -263
  33. data/bundler/lib/bundler/compact_index_client/cache.rb +29 -9
  34. data/bundler/lib/bundler/compact_index_client/cache_file.rb +153 -0
  35. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +7 -3
  36. data/bundler/lib/bundler/compact_index_client/updater.rb +79 -81
  37. data/bundler/lib/bundler/compact_index_client.rb +14 -7
  38. data/bundler/lib/bundler/constants.rb +1 -1
  39. data/bundler/lib/bundler/current_ruby.rb +5 -21
  40. data/bundler/lib/bundler/definition.rb +42 -15
  41. data/bundler/lib/bundler/dependency.rb +16 -12
  42. data/bundler/lib/bundler/digest.rb +2 -2
  43. data/bundler/lib/bundler/dsl.rb +43 -25
  44. data/bundler/lib/bundler/endpoint_specification.rb +5 -1
  45. data/bundler/lib/bundler/env.rb +1 -3
  46. data/bundler/lib/bundler/errors.rb +43 -0
  47. data/bundler/lib/bundler/fetcher/base.rb +3 -1
  48. data/bundler/lib/bundler/fetcher/compact_index.rb +4 -4
  49. data/bundler/lib/bundler/fetcher/downloader.rb +13 -11
  50. data/bundler/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
  51. data/bundler/lib/bundler/fetcher/index.rb +1 -1
  52. data/bundler/lib/bundler/fetcher.rb +28 -25
  53. data/bundler/lib/bundler/friendly_errors.rb +5 -5
  54. data/bundler/lib/bundler/gem_helper.rb +1 -1
  55. data/bundler/lib/bundler/gem_helpers.rb +5 -2
  56. data/bundler/lib/bundler/graph.rb +9 -9
  57. data/bundler/lib/bundler/index.rb +1 -2
  58. data/bundler/lib/bundler/injector.rb +1 -1
  59. data/bundler/lib/bundler/inline.rb +3 -3
  60. data/bundler/lib/bundler/installer/gem_installer.rb +5 -5
  61. data/bundler/lib/bundler/installer/parallel_installer.rb +16 -8
  62. data/bundler/lib/bundler/installer/standalone.rb +2 -3
  63. data/bundler/lib/bundler/installer.rb +9 -9
  64. data/bundler/lib/bundler/lazy_specification.rb +24 -17
  65. data/bundler/lib/bundler/lockfile_generator.rb +9 -0
  66. data/bundler/lib/bundler/lockfile_parser.rb +81 -10
  67. data/bundler/lib/bundler/man/bundle-add.1 +3 -26
  68. data/bundler/lib/bundler/man/bundle-binstubs.1 +4 -16
  69. data/bundler/lib/bundler/man/bundle-cache.1 +3 -24
  70. data/bundler/lib/bundler/man/bundle-check.1 +3 -12
  71. data/bundler/lib/bundler/man/bundle-clean.1 +3 -10
  72. data/bundler/lib/bundler/man/bundle-config.1 +20 -211
  73. data/bundler/lib/bundler/man/bundle-config.1.ronn +6 -0
  74. data/bundler/lib/bundler/man/bundle-console.1 +4 -22
  75. data/bundler/lib/bundler/man/bundle-doctor.1 +4 -18
  76. data/bundler/lib/bundler/man/bundle-exec.1 +12 -73
  77. data/bundler/lib/bundler/man/bundle-gem.1 +13 -49
  78. data/bundler/lib/bundler/man/bundle-help.1 +3 -7
  79. data/bundler/lib/bundler/man/bundle-info.1 +3 -9
  80. data/bundler/lib/bundler/man/bundle-init.1 +3 -12
  81. data/bundler/lib/bundler/man/bundle-inject.1 +6 -19
  82. data/bundler/lib/bundler/man/bundle-install.1 +27 -125
  83. data/bundler/lib/bundler/man/bundle-install.1.ronn +1 -0
  84. data/bundler/lib/bundler/man/bundle-list.1 +4 -19
  85. data/bundler/lib/bundler/man/bundle-lock.1 +5 -29
  86. data/bundler/lib/bundler/man/bundle-open.1 +7 -27
  87. data/bundler/lib/bundler/man/bundle-outdated.1 +3 -55
  88. data/bundler/lib/bundler/man/bundle-outdated.1.ronn +1 -0
  89. data/bundler/lib/bundler/man/bundle-platform.1 +5 -27
  90. data/bundler/lib/bundler/man/bundle-plugin.1 +3 -29
  91. data/bundler/lib/bundler/man/bundle-pristine.1 +5 -16
  92. data/bundler/lib/bundler/man/bundle-remove.1 +4 -14
  93. data/bundler/lib/bundler/man/bundle-show.1 +3 -10
  94. data/bundler/lib/bundler/man/bundle-update.1 +18 -137
  95. data/bundler/lib/bundler/man/bundle-version.1 +3 -16
  96. data/bundler/lib/bundler/man/bundle-viz.1 +4 -16
  97. data/bundler/lib/bundler/man/bundle.1 +5 -44
  98. data/bundler/lib/bundler/man/gemfile.5 +24 -301
  99. data/bundler/lib/bundler/man/gemfile.5.ronn +4 -0
  100. data/bundler/lib/bundler/match_metadata.rb +4 -0
  101. data/bundler/lib/bundler/match_platform.rb +1 -1
  102. data/bundler/lib/bundler/plugin/api/source.rb +3 -2
  103. data/bundler/lib/bundler/plugin/installer.rb +1 -1
  104. data/bundler/lib/bundler/plugin.rb +3 -3
  105. data/bundler/lib/bundler/resolver/base.rb +1 -1
  106. data/bundler/lib/bundler/resolver/incompatibility.rb +1 -1
  107. data/bundler/lib/bundler/resolver/spec_group.rb +1 -4
  108. data/bundler/lib/bundler/resolver.rb +16 -16
  109. data/bundler/lib/bundler/ruby_dsl.rb +20 -12
  110. data/bundler/lib/bundler/ruby_version.rb +1 -1
  111. data/bundler/lib/bundler/rubygems_ext.rb +24 -50
  112. data/bundler/lib/bundler/rubygems_gem_installer.rb +6 -56
  113. data/bundler/lib/bundler/rubygems_integration.rb +25 -94
  114. data/bundler/lib/bundler/runtime.rb +2 -2
  115. data/bundler/lib/bundler/self_manager.rb +23 -7
  116. data/bundler/lib/bundler/settings.rb +27 -7
  117. data/bundler/lib/bundler/setup.rb +4 -1
  118. data/bundler/lib/bundler/shared_helpers.rb +35 -13
  119. data/bundler/lib/bundler/source/git/git_proxy.rb +15 -15
  120. data/bundler/lib/bundler/source/git.rb +4 -3
  121. data/bundler/lib/bundler/source/metadata.rb +15 -15
  122. data/bundler/lib/bundler/source/path.rb +7 -6
  123. data/bundler/lib/bundler/source/rubygems.rb +21 -14
  124. data/bundler/lib/bundler/source.rb +2 -0
  125. data/bundler/lib/bundler/spec_set.rb +38 -10
  126. data/bundler/lib/bundler/stub_specification.rb +1 -0
  127. data/bundler/lib/bundler/templates/Executable.bundler +1 -1
  128. data/bundler/lib/bundler/templates/newgem/README.md.tt +3 -3
  129. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +2 -6
  130. data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  131. data/bundler/lib/bundler/templates/newgem/standard.yml.tt +1 -1
  132. data/bundler/lib/bundler/ui/shell.rb +1 -1
  133. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  134. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +53 -6
  135. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +8 -20
  136. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +3 -3
  137. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +2 -2
  138. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +1 -1
  139. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +35 -35
  140. data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +3 -0
  141. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +256 -132
  142. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1 -0
  143. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +95 -31
  144. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  145. data/bundler/lib/bundler/vendored_net_http.rb +8 -0
  146. data/bundler/lib/bundler/vendored_persistent.rb +0 -4
  147. data/bundler/lib/bundler/vendored_timeout.rb +8 -0
  148. data/bundler/lib/bundler/version.rb +1 -1
  149. data/bundler/lib/bundler/vlad.rb +1 -1
  150. data/bundler/lib/bundler/yaml_serializer.rb +3 -3
  151. data/bundler/lib/bundler.rb +38 -27
  152. data/lib/rubygems/available_set.rb +4 -4
  153. data/lib/rubygems/basic_specification.rb +35 -37
  154. data/lib/rubygems/bundler_version_finder.rb +4 -4
  155. data/lib/rubygems/ci_detector.rb +75 -0
  156. data/lib/rubygems/command.rb +13 -15
  157. data/lib/rubygems/command_manager.rb +5 -4
  158. data/lib/rubygems/commands/build_command.rb +2 -2
  159. data/lib/rubygems/commands/cert_command.rb +1 -2
  160. data/lib/rubygems/commands/check_command.rb +4 -4
  161. data/lib/rubygems/commands/cleanup_command.rb +12 -14
  162. data/lib/rubygems/commands/contents_command.rb +4 -4
  163. data/lib/rubygems/commands/dependency_command.rb +4 -5
  164. data/lib/rubygems/commands/environment_command.rb +1 -3
  165. data/lib/rubygems/commands/exec_command.rb +1 -1
  166. data/lib/rubygems/commands/fetch_command.rb +2 -2
  167. data/lib/rubygems/commands/generate_index_command.rb +39 -74
  168. data/lib/rubygems/commands/help_command.rb +3 -3
  169. data/lib/rubygems/commands/info_command.rb +2 -2
  170. data/lib/rubygems/commands/install_command.rb +8 -16
  171. data/lib/rubygems/commands/list_command.rb +2 -2
  172. data/lib/rubygems/commands/lock_command.rb +1 -1
  173. data/lib/rubygems/commands/open_command.rb +1 -1
  174. data/lib/rubygems/commands/owner_command.rb +1 -1
  175. data/lib/rubygems/commands/pristine_command.rb +13 -15
  176. data/lib/rubygems/commands/push_command.rb +2 -2
  177. data/lib/rubygems/commands/query_command.rb +4 -5
  178. data/lib/rubygems/commands/rdoc_command.rb +2 -2
  179. data/lib/rubygems/commands/search_command.rb +2 -2
  180. data/lib/rubygems/commands/setup_command.rb +31 -34
  181. data/lib/rubygems/commands/sources_command.rb +12 -12
  182. data/lib/rubygems/commands/specification_command.rb +10 -10
  183. data/lib/rubygems/commands/stale_command.rb +1 -1
  184. data/lib/rubygems/commands/uninstall_command.rb +9 -10
  185. data/lib/rubygems/commands/unpack_command.rb +4 -4
  186. data/lib/rubygems/commands/update_command.rb +10 -12
  187. data/lib/rubygems/commands/which_command.rb +1 -1
  188. data/lib/rubygems/commands/yank_command.rb +1 -1
  189. data/lib/rubygems/compatibility.rb +5 -6
  190. data/lib/rubygems/config_file.rb +4 -4
  191. data/lib/rubygems/core_ext/kernel_gem.rb +0 -2
  192. data/lib/rubygems/core_ext/kernel_require.rb +19 -48
  193. data/lib/rubygems/core_ext/kernel_warn.rb +1 -1
  194. data/lib/rubygems/core_ext/tcpsocket_init.rb +1 -1
  195. data/lib/rubygems/defaults.rb +15 -3
  196. data/lib/rubygems/dependency.rb +12 -14
  197. data/lib/rubygems/dependency_installer.rb +29 -30
  198. data/lib/rubygems/dependency_list.rb +1 -1
  199. data/lib/rubygems/deprecate.rb +16 -15
  200. data/lib/rubygems/doctor.rb +5 -5
  201. data/lib/rubygems/errors.rb +2 -6
  202. data/lib/rubygems/exceptions.rb +2 -1
  203. data/lib/rubygems/ext/builder.rb +15 -10
  204. data/lib/rubygems/ext/cargo_builder.rb +5 -5
  205. data/lib/rubygems/ext/ext_conf_builder.rb +1 -3
  206. data/lib/rubygems/gem_runner.rb +4 -4
  207. data/lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb +3 -3
  208. data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +3 -3
  209. data/lib/rubygems/gemcutter_utilities.rb +18 -19
  210. data/lib/rubygems/install_update_options.rb +18 -19
  211. data/lib/rubygems/installer.rb +59 -33
  212. data/lib/rubygems/installer_uninstaller_utils.rb +0 -2
  213. data/lib/rubygems/local_remote_options.rb +7 -10
  214. data/lib/rubygems/name_tuple.rb +7 -9
  215. data/lib/rubygems/net/http.rb +3 -0
  216. data/lib/rubygems/net-http/LICENSE.txt +22 -0
  217. data/lib/rubygems/net-http/lib/net/http/backward.rb +40 -0
  218. data/lib/rubygems/net-http/lib/net/http/exceptions.rb +34 -0
  219. data/lib/rubygems/net-http/lib/net/http/generic_request.rb +414 -0
  220. data/lib/rubygems/net-http/lib/net/http/header.rb +981 -0
  221. data/lib/rubygems/net-http/lib/net/http/proxy_delta.rb +17 -0
  222. data/lib/rubygems/net-http/lib/net/http/request.rb +88 -0
  223. data/lib/rubygems/net-http/lib/net/http/requests.rb +425 -0
  224. data/lib/rubygems/net-http/lib/net/http/response.rb +738 -0
  225. data/lib/rubygems/net-http/lib/net/http/responses.rb +1174 -0
  226. data/lib/rubygems/net-http/lib/net/http/status.rb +84 -0
  227. data/lib/rubygems/net-http/lib/net/http.rb +2496 -0
  228. data/lib/rubygems/net-http/lib/net/https.rb +23 -0
  229. data/lib/rubygems/net-protocol/LICENSE.txt +22 -0
  230. data/lib/rubygems/net-protocol/lib/net/protocol.rb +544 -0
  231. data/lib/rubygems/optparse/lib/optparse.rb +39 -17
  232. data/lib/rubygems/package/old.rb +2 -2
  233. data/lib/rubygems/package/tar_header.rb +45 -39
  234. data/lib/rubygems/package/tar_reader/entry.rb +5 -4
  235. data/lib/rubygems/package/tar_reader.rb +5 -3
  236. data/lib/rubygems/package/tar_writer.rb +19 -17
  237. data/lib/rubygems/package.rb +27 -26
  238. data/lib/rubygems/package_task.rb +2 -2
  239. data/lib/rubygems/path_support.rb +9 -10
  240. data/lib/rubygems/platform.rb +60 -45
  241. data/lib/rubygems/query_utils.rb +7 -9
  242. data/lib/rubygems/remote_fetcher.rb +15 -15
  243. data/lib/rubygems/request/connection_pools.rb +3 -3
  244. data/lib/rubygems/request.rb +20 -17
  245. data/lib/rubygems/request_set/gem_dependency_api.rb +119 -122
  246. data/lib/rubygems/request_set/lockfile/parser.rb +9 -9
  247. data/lib/rubygems/request_set/lockfile/tokenizer.rb +20 -12
  248. data/lib/rubygems/request_set/lockfile.rb +6 -11
  249. data/lib/rubygems/request_set.rb +5 -5
  250. data/lib/rubygems/requirement.rb +7 -7
  251. data/lib/rubygems/resolv/LICENSE.txt +22 -0
  252. data/lib/rubygems/resolv/lib/resolv.rb +3387 -0
  253. data/lib/rubygems/resolver/activation_request.rb +1 -3
  254. data/lib/rubygems/resolver/api_set/gem_parser.rb +7 -3
  255. data/lib/rubygems/resolver/best_set.rb +1 -1
  256. data/lib/rubygems/resolver/composed_set.rb +1 -1
  257. data/lib/rubygems/resolver/conflict.rb +4 -12
  258. data/lib/rubygems/resolver/index_set.rb +4 -4
  259. data/lib/rubygems/resolver/index_specification.rb +2 -2
  260. data/lib/rubygems/resolver/installer_set.rb +5 -6
  261. data/lib/rubygems/resolver/lock_set.rb +1 -1
  262. data/lib/rubygems/resolver.rb +3 -10
  263. data/lib/rubygems/s3_uri_signer.rb +6 -6
  264. data/lib/rubygems/safe_marshal/elements.rb +138 -0
  265. data/lib/rubygems/safe_marshal/reader.rb +306 -0
  266. data/lib/rubygems/safe_marshal/visitors/stream_printer.rb +31 -0
  267. data/lib/rubygems/safe_marshal/visitors/to_ruby.rb +385 -0
  268. data/lib/rubygems/safe_marshal/visitors/visitor.rb +74 -0
  269. data/lib/rubygems/safe_marshal.rb +74 -0
  270. data/lib/rubygems/safe_yaml.rb +5 -28
  271. data/lib/rubygems/security/policies.rb +36 -38
  272. data/lib/rubygems/security/policy.rb +7 -11
  273. data/lib/rubygems/security/signer.rb +1 -1
  274. data/lib/rubygems/security/trust_dir.rb +3 -3
  275. data/lib/rubygems/security.rb +8 -22
  276. data/lib/rubygems/source/git.rb +1 -3
  277. data/lib/rubygems/source/installed.rb +0 -2
  278. data/lib/rubygems/source/local.rb +5 -8
  279. data/lib/rubygems/source/lock.rb +1 -3
  280. data/lib/rubygems/source/specific_file.rb +0 -1
  281. data/lib/rubygems/source/vendor.rb +0 -2
  282. data/lib/rubygems/source.rb +12 -12
  283. data/lib/rubygems/source_list.rb +4 -4
  284. data/lib/rubygems/spec_fetcher.rb +29 -29
  285. data/lib/rubygems/specification.rb +125 -138
  286. data/lib/rubygems/specification_policy.rb +55 -25
  287. data/lib/rubygems/stub_specification.rb +4 -5
  288. data/lib/rubygems/text.rb +1 -2
  289. data/lib/rubygems/timeout/LICENSE.txt +22 -0
  290. data/lib/rubygems/timeout/lib/timeout.rb +199 -0
  291. data/lib/rubygems/timeout.rb +3 -0
  292. data/lib/rubygems/tsort/lib/tsort.rb +3 -0
  293. data/lib/rubygems/uninstaller.rb +7 -9
  294. data/lib/rubygems/update_suggestion.rb +5 -18
  295. data/lib/rubygems/uri_formatter.rb +1 -1
  296. data/lib/rubygems/user_interaction.rb +15 -21
  297. data/lib/rubygems/util/licenses.rb +65 -35
  298. data/lib/rubygems/util/list.rb +3 -1
  299. data/lib/rubygems/util.rb +2 -4
  300. data/lib/rubygems/validator.rb +5 -3
  301. data/lib/rubygems/version.rb +34 -28
  302. data/lib/rubygems/version_option.rb +2 -5
  303. data/lib/rubygems/yaml_serializer.rb +3 -3
  304. data/lib/rubygems.rb +37 -37
  305. data/rubygems-update.gemspec +4 -4
  306. data/setup.rb +2 -2
  307. metadata +38 -225
  308. data/lib/rubygems/indexer.rb +0 -428
  309. data/lib/rubygems/mock_gem_ui.rb +0 -86
  310. data/test/rubygems/alternate_cert.pem +0 -19
  311. data/test/rubygems/alternate_cert_32.pem +0 -19
  312. data/test/rubygems/alternate_key.pem +0 -27
  313. data/test/rubygems/bad_rake.rb +0 -3
  314. data/test/rubygems/bundler_test_gem.rb +0 -424
  315. data/test/rubygems/ca_cert.pem +0 -77
  316. data/test/rubygems/child_cert.pem +0 -19
  317. data/test/rubygems/child_cert_32.pem +0 -19
  318. data/test/rubygems/child_key.pem +0 -27
  319. data/test/rubygems/client.pem +0 -107
  320. data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
  321. data/test/rubygems/data/gem-private_key.pem +0 -27
  322. data/test/rubygems/data/gem-public_cert.pem +0 -20
  323. data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
  324. data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
  325. data/test/rubygems/data/pry-0.4.7.gemspec.rz +0 -0
  326. data/test/rubygems/encrypted_private_key.pem +0 -30
  327. data/test/rubygems/expired_cert.pem +0 -19
  328. data/test/rubygems/fake_certlib/openssl.rb +0 -9
  329. data/test/rubygems/foo/discover.rb +0 -1
  330. data/test/rubygems/future_cert.pem +0 -19
  331. data/test/rubygems/future_cert_32.pem +0 -19
  332. data/test/rubygems/good_rake.rb +0 -3
  333. data/test/rubygems/grandchild_cert.pem +0 -19
  334. data/test/rubygems/grandchild_cert_32.pem +0 -19
  335. data/test/rubygems/grandchild_key.pem +0 -27
  336. data/test/rubygems/helper.rb +0 -1649
  337. data/test/rubygems/installer_test_case.rb +0 -248
  338. data/test/rubygems/invalid_client.pem +0 -49
  339. data/test/rubygems/invalid_issuer_cert.pem +0 -20
  340. data/test/rubygems/invalid_issuer_cert_32.pem +0 -20
  341. data/test/rubygems/invalid_key.pem +0 -27
  342. data/test/rubygems/invalid_signer_cert.pem +0 -19
  343. data/test/rubygems/invalid_signer_cert_32.pem +0 -19
  344. data/test/rubygems/invalidchild_cert.pem +0 -19
  345. data/test/rubygems/invalidchild_cert_32.pem +0 -19
  346. data/test/rubygems/invalidchild_key.pem +0 -27
  347. data/test/rubygems/multifactor_auth_utilities.rb +0 -111
  348. data/test/rubygems/package/tar_test_case.rb +0 -175
  349. data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
  350. data/test/rubygems/packages/ascii_binder-0.1.10.1.gem +0 -0
  351. data/test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem +0 -0
  352. data/test/rubygems/plugin/exception/rubygems_plugin.rb +0 -4
  353. data/test/rubygems/plugin/load/rubygems_plugin.rb +0 -5
  354. data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +0 -4
  355. data/test/rubygems/private3072_key.pem +0 -40
  356. data/test/rubygems/private_ec_key.pem +0 -9
  357. data/test/rubygems/private_key.pem +0 -27
  358. data/test/rubygems/public3072_cert.pem +0 -25
  359. data/test/rubygems/public_cert.pem +0 -20
  360. data/test/rubygems/public_cert_32.pem +0 -19
  361. data/test/rubygems/public_key.pem +0 -9
  362. data/test/rubygems/rubygems/commands/crash_command.rb +0 -5
  363. data/test/rubygems/rubygems_plugin.rb +0 -24
  364. data/test/rubygems/sff/discover.rb +0 -1
  365. data/test/rubygems/simple_gem.rb +0 -68
  366. data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -9
  367. data/test/rubygems/specifications/foo-0.0.1-x86-mswin32.gemspec +0 -0
  368. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +0 -14
  369. data/test/rubygems/ssl_cert.pem +0 -80
  370. data/test/rubygems/ssl_key.pem +0 -27
  371. data/test/rubygems/test_bundled_ca.rb +0 -61
  372. data/test/rubygems/test_config.rb +0 -28
  373. data/test/rubygems/test_deprecate.rb +0 -158
  374. data/test/rubygems/test_exit.rb +0 -17
  375. data/test/rubygems/test_gem.rb +0 -1799
  376. data/test/rubygems/test_gem_available_set.rb +0 -130
  377. data/test/rubygems/test_gem_bundler_version_finder.rb +0 -127
  378. data/test/rubygems/test_gem_command.rb +0 -403
  379. data/test/rubygems/test_gem_command_manager.rb +0 -400
  380. data/test/rubygems/test_gem_commands_build_command.rb +0 -739
  381. data/test/rubygems/test_gem_commands_cert_command.rb +0 -866
  382. data/test/rubygems/test_gem_commands_check_command.rb +0 -68
  383. data/test/rubygems/test_gem_commands_cleanup_command.rb +0 -292
  384. data/test/rubygems/test_gem_commands_contents_command.rb +0 -271
  385. data/test/rubygems/test_gem_commands_dependency_command.rb +0 -228
  386. data/test/rubygems/test_gem_commands_environment_command.rb +0 -169
  387. data/test/rubygems/test_gem_commands_exec_command.rb +0 -857
  388. data/test/rubygems/test_gem_commands_fetch_command.rb +0 -258
  389. data/test/rubygems/test_gem_commands_generate_index_command.rb +0 -81
  390. data/test/rubygems/test_gem_commands_help_command.rb +0 -94
  391. data/test/rubygems/test_gem_commands_info_command.rb +0 -70
  392. data/test/rubygems/test_gem_commands_install_command.rb +0 -1573
  393. data/test/rubygems/test_gem_commands_list_command.rb +0 -33
  394. data/test/rubygems/test_gem_commands_lock_command.rb +0 -67
  395. data/test/rubygems/test_gem_commands_mirror.rb +0 -20
  396. data/test/rubygems/test_gem_commands_open_command.rb +0 -101
  397. data/test/rubygems/test_gem_commands_outdated_command.rb +0 -50
  398. data/test/rubygems/test_gem_commands_owner_command.rb +0 -503
  399. data/test/rubygems/test_gem_commands_pristine_command.rb +0 -708
  400. data/test/rubygems/test_gem_commands_push_command.rb +0 -603
  401. data/test/rubygems/test_gem_commands_query_command.rb +0 -858
  402. data/test/rubygems/test_gem_commands_search_command.rb +0 -16
  403. data/test/rubygems/test_gem_commands_server_command.rb +0 -20
  404. data/test/rubygems/test_gem_commands_setup_command.rb +0 -474
  405. data/test/rubygems/test_gem_commands_signin_command.rb +0 -259
  406. data/test/rubygems/test_gem_commands_signout_command.rb +0 -30
  407. data/test/rubygems/test_gem_commands_sources_command.rb +0 -534
  408. data/test/rubygems/test_gem_commands_specification_command.rb +0 -277
  409. data/test/rubygems/test_gem_commands_stale_command.rb +0 -43
  410. data/test/rubygems/test_gem_commands_uninstall_command.rb +0 -542
  411. data/test/rubygems/test_gem_commands_unpack_command.rb +0 -224
  412. data/test/rubygems/test_gem_commands_update_command.rb +0 -836
  413. data/test/rubygems/test_gem_commands_which_command.rb +0 -85
  414. data/test/rubygems/test_gem_commands_yank_command.rb +0 -299
  415. data/test/rubygems/test_gem_config_file.rb +0 -551
  416. data/test/rubygems/test_gem_dependency.rb +0 -398
  417. data/test/rubygems/test_gem_dependency_installer.rb +0 -1190
  418. data/test/rubygems/test_gem_dependency_list.rb +0 -265
  419. data/test/rubygems/test_gem_dependency_resolution_error.rb +0 -27
  420. data/test/rubygems/test_gem_doctor.rb +0 -195
  421. data/test/rubygems/test_gem_ext_builder.rb +0 -337
  422. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +0 -1
  423. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +0 -10
  424. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +0 -249
  425. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml +0 -10
  426. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/src/lib.rs +0 -27
  427. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +0 -3
  428. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore +0 -1
  429. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +0 -249
  430. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +0 -10
  431. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec +0 -10
  432. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +0 -51
  433. data/test/rubygems/test_gem_ext_cargo_builder.rb +0 -167
  434. data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +0 -34
  435. data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +0 -60
  436. data/test/rubygems/test_gem_ext_cmake_builder.rb +0 -84
  437. data/test/rubygems/test_gem_ext_configure_builder.rb +0 -80
  438. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +0 -229
  439. data/test/rubygems/test_gem_ext_rake_builder.rb +0 -113
  440. data/test/rubygems/test_gem_gem_runner.rb +0 -119
  441. data/test/rubygems/test_gem_gemcutter_utilities.rb +0 -361
  442. data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -60
  443. data/test/rubygems/test_gem_indexer.rb +0 -381
  444. data/test/rubygems/test_gem_install_update_options.rb +0 -208
  445. data/test/rubygems/test_gem_installer.rb +0 -2512
  446. data/test/rubygems/test_gem_local_remote_options.rb +0 -133
  447. data/test/rubygems/test_gem_name_tuple.rb +0 -43
  448. data/test/rubygems/test_gem_package.rb +0 -1306
  449. data/test/rubygems/test_gem_package_old.rb +0 -91
  450. data/test/rubygems/test_gem_package_tar_header.rb +0 -226
  451. data/test/rubygems/test_gem_package_tar_reader.rb +0 -150
  452. data/test/rubygems/test_gem_package_tar_reader_entry.rb +0 -350
  453. data/test/rubygems/test_gem_package_tar_writer.rb +0 -331
  454. data/test/rubygems/test_gem_package_task.rb +0 -118
  455. data/test/rubygems/test_gem_path_support.rb +0 -139
  456. data/test/rubygems/test_gem_platform.rb +0 -497
  457. data/test/rubygems/test_gem_rdoc.rb +0 -137
  458. data/test/rubygems/test_gem_remote_fetcher.rb +0 -1227
  459. data/test/rubygems/test_gem_request.rb +0 -547
  460. data/test/rubygems/test_gem_request_connection_pools.rb +0 -152
  461. data/test/rubygems/test_gem_request_set.rb +0 -672
  462. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +0 -853
  463. data/test/rubygems/test_gem_request_set_lockfile.rb +0 -469
  464. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +0 -544
  465. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +0 -307
  466. data/test/rubygems/test_gem_requirement.rb +0 -505
  467. data/test/rubygems/test_gem_resolver.rb +0 -859
  468. data/test/rubygems/test_gem_resolver_activation_request.rb +0 -43
  469. data/test/rubygems/test_gem_resolver_api_set.rb +0 -210
  470. data/test/rubygems/test_gem_resolver_api_specification.rb +0 -167
  471. data/test/rubygems/test_gem_resolver_best_set.rb +0 -159
  472. data/test/rubygems/test_gem_resolver_composed_set.rb +0 -44
  473. data/test/rubygems/test_gem_resolver_conflict.rb +0 -82
  474. data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -83
  475. data/test/rubygems/test_gem_resolver_git_set.rb +0 -188
  476. data/test/rubygems/test_gem_resolver_git_specification.rb +0 -114
  477. data/test/rubygems/test_gem_resolver_index_set.rb +0 -88
  478. data/test/rubygems/test_gem_resolver_index_specification.rb +0 -93
  479. data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -47
  480. data/test/rubygems/test_gem_resolver_installer_set.rb +0 -320
  481. data/test/rubygems/test_gem_resolver_local_specification.rb +0 -44
  482. data/test/rubygems/test_gem_resolver_lock_set.rb +0 -62
  483. data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -98
  484. data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -19
  485. data/test/rubygems/test_gem_resolver_specification.rb +0 -63
  486. data/test/rubygems/test_gem_resolver_vendor_set.rb +0 -82
  487. data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -82
  488. data/test/rubygems/test_gem_security.rb +0 -341
  489. data/test/rubygems/test_gem_security_policy.rb +0 -535
  490. data/test/rubygems/test_gem_security_signer.rb +0 -218
  491. data/test/rubygems/test_gem_security_trust_dir.rb +0 -99
  492. data/test/rubygems/test_gem_silent_ui.rb +0 -123
  493. data/test/rubygems/test_gem_source.rb +0 -254
  494. data/test/rubygems/test_gem_source_fetch_problem.rb +0 -37
  495. data/test/rubygems/test_gem_source_git.rb +0 -310
  496. data/test/rubygems/test_gem_source_installed.rb +0 -35
  497. data/test/rubygems/test_gem_source_list.rb +0 -119
  498. data/test/rubygems/test_gem_source_local.rb +0 -107
  499. data/test/rubygems/test_gem_source_lock.rb +0 -113
  500. data/test/rubygems/test_gem_source_specific_file.rb +0 -76
  501. data/test/rubygems/test_gem_source_subpath_problem.rb +0 -50
  502. data/test/rubygems/test_gem_source_vendor.rb +0 -30
  503. data/test/rubygems/test_gem_spec_fetcher.rb +0 -338
  504. data/test/rubygems/test_gem_specification.rb +0 -3856
  505. data/test/rubygems/test_gem_stream_ui.rb +0 -255
  506. data/test/rubygems/test_gem_stub_specification.rb +0 -278
  507. data/test/rubygems/test_gem_text.rb +0 -103
  508. data/test/rubygems/test_gem_uninstaller.rb +0 -675
  509. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -31
  510. data/test/rubygems/test_gem_update_suggestion.rb +0 -209
  511. data/test/rubygems/test_gem_uri.rb +0 -41
  512. data/test/rubygems/test_gem_uri_formatter.rb +0 -27
  513. data/test/rubygems/test_gem_util.rb +0 -91
  514. data/test/rubygems/test_gem_validator.rb +0 -42
  515. data/test/rubygems/test_gem_version.rb +0 -305
  516. data/test/rubygems/test_gem_version_option.rb +0 -165
  517. data/test/rubygems/test_kernel.rb +0 -124
  518. data/test/rubygems/test_project_sanity.rb +0 -49
  519. data/test/rubygems/test_remote_fetch_error.rb +0 -20
  520. data/test/rubygems/test_require.rb +0 -732
  521. data/test/rubygems/test_rubygems.rb +0 -76
  522. data/test/rubygems/test_webauthn_listener.rb +0 -143
  523. data/test/rubygems/test_webauthn_listener_response.rb +0 -93
  524. data/test/rubygems/test_webauthn_poller.rb +0 -124
  525. data/test/rubygems/utilities.rb +0 -436
  526. data/test/rubygems/wrong_key_cert.pem +0 -19
  527. data/test/rubygems/wrong_key_cert_32.pem +0 -19
  528. data/test/test_changelog_generator.rb +0 -17
@@ -1,1190 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "helper"
4
- require "rubygems/dependency_installer"
5
- require "rubygems/security"
6
-
7
- class TestGemDependencyInstaller < Gem::TestCase
8
- def setup
9
- super
10
- common_installer_setup
11
-
12
- @gems_dir = File.join @tempdir, "gems"
13
- @cache_dir = File.join @gemhome, "cache"
14
-
15
- FileUtils.mkdir @gems_dir
16
-
17
- Gem::RemoteFetcher.fetcher = @fetcher = Gem::FakeFetcher.new
18
-
19
- @original_platforms = Gem.platforms
20
- Gem.platforms = []
21
- end
22
-
23
- def teardown
24
- Gem.platforms = @original_platforms
25
- super
26
- end
27
-
28
- def util_setup_gems
29
- @a1, @a1_gem = util_gem "a", "1" do |s|
30
- s.executables << "a_bin"
31
- end
32
-
33
- @a1_pre, @a1_pre_gem = util_gem "a", "1.a"
34
-
35
- @b1, @b1_gem = util_gem "b", "1" do |s|
36
- s.add_dependency "a"
37
- s.add_development_dependency "aa"
38
- end
39
-
40
- @c1, @c1_gem = util_gem "c", "1" do |s|
41
- s.add_development_dependency "b"
42
- end
43
-
44
- @d1, @d1_gem = util_gem "d", "1" do |s|
45
- s.add_development_dependency "c"
46
- end
47
-
48
- util_setup_spec_fetcher(@a1, @a1_pre, @b1, @d1)
49
- end
50
-
51
- def test_install
52
- util_setup_gems
53
-
54
- FileUtils.mv @a1_gem, @tempdir
55
- inst = nil
56
-
57
- Dir.chdir @tempdir do
58
- inst = Gem::DependencyInstaller.new
59
- inst.install "a"
60
- end
61
-
62
- assert_equal %w[a-1], Gem::Specification.map(&:full_name)
63
- assert_equal [@a1], inst.installed_gems
64
- end
65
-
66
- def test_install_prerelease
67
- util_setup_gems
68
-
69
- p1a, gem = util_gem "a", "10.a"
70
-
71
- util_setup_spec_fetcher(p1a, @a1, @a1_pre)
72
-
73
- p1a_data = Gem.read_binary(gem)
74
-
75
- @fetcher.data["http://gems.example.com/gems/a-10.a.gem"] = p1a_data
76
-
77
- dep = Gem::Dependency.new "a"
78
- inst = Gem::DependencyInstaller.new :prerelease => true
79
- inst.install dep
80
-
81
- assert_equal %w[a-10.a], Gem::Specification.map(&:full_name)
82
- assert_equal [p1a], inst.installed_gems
83
- end
84
-
85
- def test_install_prerelease_bug_990
86
- spec_fetcher do |fetcher|
87
- fetcher.gem "a", "1.b" do |s|
88
- s.add_dependency "b", "~> 1.a"
89
- end
90
-
91
- fetcher.gem "b", "1.b" do |s|
92
- s.add_dependency "c", ">= 1"
93
- end
94
-
95
- fetcher.gem "c", "1.1.b"
96
- end
97
-
98
- dep = Gem::Dependency.new "a"
99
-
100
- inst = Gem::DependencyInstaller.new :prerelease => true
101
- inst.install dep
102
-
103
- assert_equal %w[a-1.b b-1.b c-1.1.b], Gem::Specification.map(&:full_name)
104
- end
105
-
106
- def test_install_when_only_prerelease
107
- p1a, gem = util_gem "p", "1.a"
108
-
109
- util_setup_spec_fetcher(p1a)
110
-
111
- p1a_data = Gem.read_binary(gem)
112
-
113
- @fetcher.data["http://gems.example.com/gems/p-1.a.gem"] = p1a_data
114
-
115
- dep = Gem::Dependency.new "p"
116
- inst = Gem::DependencyInstaller.new
117
- assert_raise Gem::UnsatisfiableDependencyError do
118
- inst.install dep
119
- end
120
-
121
- assert_equal %w[], Gem::Specification.map(&:full_name)
122
- assert_equal [], inst.installed_gems
123
- end
124
-
125
- def test_install_prerelease_skipped_when_normal_ver
126
- util_setup_gems
127
-
128
- util_setup_spec_fetcher(@a1, @a1_pre)
129
-
130
- p1a_data = Gem.read_binary(@a1_gem)
131
-
132
- @fetcher.data["http://gems.example.com/gems/a-1.gem"] = p1a_data
133
-
134
- dep = Gem::Dependency.new "a"
135
- inst = Gem::DependencyInstaller.new :prerelease => true
136
- inst.install dep
137
-
138
- assert_equal %w[a-1], Gem::Specification.map(&:full_name)
139
- assert_equal [@a1], inst.installed_gems
140
- end
141
-
142
- def test_install_all_dependencies
143
- util_setup_gems
144
-
145
- _, e1_gem = util_gem "e", "1" do |s|
146
- s.add_dependency "b"
147
- end
148
-
149
- FileUtils.mv @a1_gem, @tempdir
150
- FileUtils.mv @b1_gem, @tempdir
151
- FileUtils.mv e1_gem, @tempdir
152
-
153
- inst = nil
154
-
155
- Dir.chdir @tempdir do
156
- inst = Gem::DependencyInstaller.new :ignore_dependencies => true
157
- inst.install "b"
158
- end
159
-
160
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
161
- "sanity check"
162
-
163
- Dir.chdir @tempdir do
164
- inst = Gem::DependencyInstaller.new
165
- inst.install "e"
166
- end
167
-
168
- assert_equal %w[a-1 e-1], inst.installed_gems.map {|s| s.full_name }
169
- end
170
-
171
- def test_install_cache_dir
172
- util_setup_gems
173
-
174
- dir = "dir"
175
- Dir.mkdir dir
176
- FileUtils.mv @a1_gem, dir
177
- FileUtils.mv @b1_gem, dir
178
- inst = nil
179
-
180
- Dir.chdir dir do
181
- inst = Gem::DependencyInstaller.new :cache_dir => @tempdir
182
- inst.install "b"
183
- end
184
-
185
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
186
-
187
- assert File.exist? File.join(@gemhome, "cache", @a1.file_name)
188
- assert File.exist? File.join(@gemhome, "cache", @b1.file_name)
189
- end
190
-
191
- def test_install_dependencies_satisfied
192
- util_setup_gems
193
-
194
- a2, a2_gem = util_gem "a", "2"
195
-
196
- FileUtils.rm_rf File.join(@gemhome, "gems")
197
-
198
- Gem::Specification.reset
199
-
200
- FileUtils.mv @a1_gem, @tempdir
201
- FileUtils.mv a2_gem, @tempdir # not in index
202
- FileUtils.mv @b1_gem, @tempdir
203
- inst = nil
204
-
205
- Dir.chdir @tempdir do
206
- inst = Gem::DependencyInstaller.new
207
- inst.install "a", req("= 2")
208
- end
209
-
210
- assert_equal %w[a-2], inst.installed_gems.map {|s| s.full_name },
211
- "sanity check"
212
-
213
- FileUtils.rm File.join(@tempdir, a2.file_name)
214
-
215
- Dir.chdir @tempdir do
216
- inst = Gem::DependencyInstaller.new
217
- inst.install "b"
218
- end
219
-
220
- assert_equal %w[a-2 b-1], Gem::Specification.map(&:full_name)
221
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
222
- end
223
-
224
- # This asserts that if a gem's dependency is satisfied by an
225
- # already installed gem, RubyGems doesn't installed a newer
226
- # version
227
- def test_install_doesnt_upgrade_installed_dependencies
228
- util_setup_gems
229
-
230
- a2, a2_gem = util_gem "a", "2"
231
- a3, a3_gem = util_gem "a", "3"
232
-
233
- util_setup_spec_fetcher @a1, a3, @b1
234
-
235
- FileUtils.rm_rf File.join(@gemhome, "gems")
236
-
237
- Gem::Specification.reset
238
-
239
- FileUtils.mv @a1_gem, @tempdir
240
- FileUtils.mv a2_gem, @tempdir # not in index
241
- FileUtils.mv @b1_gem, @tempdir
242
- FileUtils.mv a3_gem, @tempdir
243
-
244
- Dir.chdir @tempdir do
245
- Gem::DependencyInstaller.new.install "a", req("= 2")
246
- end
247
-
248
- FileUtils.rm File.join(@tempdir, a2.file_name)
249
-
250
- inst = nil
251
-
252
- Dir.chdir @tempdir do
253
- inst = Gem::DependencyInstaller.new
254
- inst.install "b"
255
- end
256
-
257
- assert_equal %w[a-2 b-1], Gem::Specification.map(&:full_name)
258
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
259
- end
260
-
261
- def test_install_dependency
262
- util_setup_gems
263
-
264
- done_installing_ran = false
265
- inst = nil
266
-
267
- Gem.done_installing do |installer, specs|
268
- done_installing_ran = true
269
- refute_nil installer
270
- assert_equal [@a1, @b1], specs
271
- end
272
-
273
- FileUtils.mv @a1_gem, @tempdir
274
- FileUtils.mv @b1_gem, @tempdir
275
-
276
- Dir.chdir @tempdir do
277
- inst = Gem::DependencyInstaller.new(:build_docs_in_background => false)
278
- inst.install "b"
279
- end
280
-
281
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
282
-
283
- assert done_installing_ran, "post installs hook was not run"
284
- end
285
-
286
- def test_install_dependency_development
287
- util_setup_gems
288
-
289
- @aa1, @aa1_gem = util_gem "aa", "1"
290
-
291
- FileUtils.mv @a1_gem, @tempdir
292
- FileUtils.mv @aa1_gem, @tempdir
293
- FileUtils.mv @b1_gem, @tempdir
294
- inst = nil
295
-
296
- Dir.chdir @tempdir do
297
- inst = Gem::DependencyInstaller.new(:development => true)
298
- inst.install "b"
299
- end
300
-
301
- assert_equal %w[a-1 aa-1 b-1], inst.installed_gems.map {|s| s.full_name }
302
- end
303
-
304
- def test_install_dependency_development_deep
305
- util_setup_gems
306
-
307
- @aa1, @aa1_gem = util_gem "aa", "1"
308
-
309
- FileUtils.mv @a1_gem, @tempdir
310
- FileUtils.mv @aa1_gem, @tempdir
311
- FileUtils.mv @b1_gem, @tempdir
312
- FileUtils.mv @c1_gem, @tempdir
313
- FileUtils.mv @d1_gem, @tempdir
314
- inst = nil
315
-
316
- Dir.chdir @tempdir do
317
- inst = Gem::DependencyInstaller.new(:development => true)
318
- inst.install "d"
319
- end
320
-
321
- assert_equal %w[a-1 aa-1 b-1 c-1 d-1], inst.installed_gems.map {|s| s.full_name }
322
- end
323
-
324
- def test_install_dependency_development_shallow
325
- util_setup_gems
326
-
327
- @aa1, @aa1_gem = util_gem "aa", "1"
328
-
329
- FileUtils.mv @a1_gem, @tempdir
330
- FileUtils.mv @aa1_gem, @tempdir
331
- FileUtils.mv @b1_gem, @tempdir
332
- FileUtils.mv @c1_gem, @tempdir
333
- FileUtils.mv @d1_gem, @tempdir
334
- inst = nil
335
-
336
- Dir.chdir @tempdir do
337
- inst = Gem::DependencyInstaller.new(:development => true, :dev_shallow => true)
338
- inst.install "d"
339
- end
340
-
341
- assert_equal %w[c-1 d-1], inst.installed_gems.map {|s| s.full_name }
342
- end
343
-
344
- def test_install_dependency_existing
345
- util_setup_gems
346
-
347
- Gem::Installer.at(@a1_gem).install
348
- FileUtils.mv @a1_gem, @tempdir
349
- FileUtils.mv @b1_gem, @tempdir
350
- inst = nil
351
-
352
- Dir.chdir @tempdir do
353
- inst = Gem::DependencyInstaller.new
354
- inst.install "b"
355
- end
356
-
357
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
358
- end
359
-
360
- def test_install_dependency_existing_extension
361
- extconf_rb = File.join @gemhome, "gems", "e-1", "extconf.rb"
362
- FileUtils.mkdir_p File.dirname extconf_rb
363
-
364
- File.open extconf_rb, "w" do |io|
365
- io.write <<-EXTCONF_RB
366
- require 'mkmf'
367
- create_makefile 'e'
368
- EXTCONF_RB
369
- end
370
-
371
- e1 = util_spec "e", "1", nil, "extconf.rb" do |s|
372
- s.extensions << "extconf.rb"
373
- end
374
- e1_gem = e1.cache_file
375
-
376
- _, f1_gem = util_gem "f", "1", "e" => nil
377
-
378
- Gem::Installer.at(e1_gem).install
379
- FileUtils.rm_r e1.extension_dir
380
-
381
- FileUtils.mv e1_gem, @tempdir
382
- FileUtils.mv f1_gem, @tempdir
383
- inst = nil
384
-
385
- pwd = Dir.getwd
386
- Dir.chdir @tempdir
387
- begin
388
- inst = Gem::DependencyInstaller.new
389
- inst.install "f"
390
- ensure
391
- Dir.chdir pwd
392
- end
393
-
394
- assert_equal %w[f-1], inst.installed_gems.map {|s| s.full_name }
395
-
396
- assert_path_exist e1.extension_dir
397
- end
398
-
399
- def test_install_dependency_old
400
- _, e1_gem = util_gem "e", "1"
401
- _, f1_gem = util_gem "f", "1", "e" => nil
402
- _, f2_gem = util_gem "f", "2"
403
-
404
- FileUtils.mv e1_gem, @tempdir
405
- FileUtils.mv f1_gem, @tempdir
406
- FileUtils.mv f2_gem, @tempdir
407
- inst = nil
408
-
409
- Dir.chdir @tempdir do
410
- inst = Gem::DependencyInstaller.new
411
- inst.install "f"
412
- end
413
-
414
- assert_equal %w[f-2], inst.installed_gems.map {|s| s.full_name }
415
- end
416
-
417
- def test_install_local
418
- util_setup_gems
419
-
420
- FileUtils.mv @a1_gem, @tempdir
421
- inst = nil
422
-
423
- Dir.chdir @tempdir do
424
- inst = Gem::DependencyInstaller.new :domain => :local
425
- inst.install "a-1.gem"
426
- end
427
-
428
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
429
- end
430
-
431
- def test_install_local_prerelease
432
- util_setup_gems
433
-
434
- FileUtils.mv @a1_pre_gem, @tempdir
435
- inst = nil
436
-
437
- Dir.chdir @tempdir do
438
- inst = Gem::DependencyInstaller.new :domain => :local
439
- inst.install "a-1.a.gem"
440
- end
441
-
442
- assert_equal %w[a-1.a], inst.installed_gems.map {|s| s.full_name }
443
- end
444
-
445
- def test_install_local_dependency
446
- util_setup_gems
447
-
448
- FileUtils.mv @a1_gem, @tempdir
449
- FileUtils.mv @b1_gem, @tempdir
450
-
451
- inst = nil
452
-
453
- Dir.chdir @tempdir do
454
- inst = Gem::DependencyInstaller.new :domain => :local
455
- inst.install "b-1.gem"
456
- end
457
-
458
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
459
- end
460
-
461
- def test_install_local_dependency_installed
462
- util_setup_gems
463
-
464
- FileUtils.mv @a1_gem, @tempdir
465
- FileUtils.mv @b1_gem, @tempdir
466
-
467
- inst = nil
468
-
469
- Dir.chdir @tempdir do
470
- Gem::Installer.at("a-1.gem").install
471
-
472
- inst = Gem::DependencyInstaller.new :domain => :local
473
- inst.install "b-1.gem"
474
- end
475
-
476
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
477
- end
478
-
479
- def test_install_local_dependency_no_network_for_target_gem
480
- a1, a1_gem = util_gem "a", "1"
481
- _, b1_gem = util_gem "b", "1" do |s|
482
- s.add_dependency "a"
483
- end
484
-
485
- util_setup_spec_fetcher(a1)
486
-
487
- a1_data = Gem.read_binary(a1_gem)
488
- @fetcher.data["http://gems.example.com/gems/a-1.gem"] = a1_data
489
-
490
- # compact index is available
491
- compact_index_response = Net::HTTPResponse.new "1.1", 200, "OK"
492
- compact_index_response.uri = URI("http://gems.example.com")
493
- @fetcher.data["http://gems.example.com/"] = compact_index_response
494
-
495
- # but private local gem not present there
496
- @fetcher.data["http://gems.example.com/info/b"] =
497
- proc do
498
- raise "should not happen"
499
- end
500
-
501
- FileUtils.mv b1_gem, @tempdir
502
-
503
- inst = nil
504
-
505
- Dir.chdir @tempdir do
506
- inst = Gem::DependencyInstaller.new
507
- inst.install "b-1.gem"
508
- end
509
-
510
- assert_equal %w[a-1 b-1], inst.installed_gems.map(&:full_name)
511
- end
512
-
513
- def test_install_local_subdir
514
- util_setup_gems
515
-
516
- inst = nil
517
-
518
- Dir.chdir @tempdir do
519
- inst = Gem::DependencyInstaller.new :domain => :local
520
- inst.install "gems/a-1.gem"
521
- end
522
-
523
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
524
- end
525
-
526
- def test_install_minimal_deps
527
- util_setup_gems
528
-
529
- _, e1_gem = util_gem "e", "1" do |s|
530
- s.add_dependency "b"
531
- end
532
-
533
- _, b2_gem = util_gem "b", "2" do |s|
534
- s.add_dependency "a"
535
- end
536
-
537
- FileUtils.mv @a1_gem, @tempdir
538
- FileUtils.mv @b1_gem, @tempdir
539
- FileUtils.mv b2_gem, @tempdir
540
- FileUtils.mv e1_gem, @tempdir
541
-
542
- inst = nil
543
-
544
- Dir.chdir @tempdir do
545
- inst = Gem::DependencyInstaller.new :ignore_dependencies => true
546
- inst.install "b", req("= 1")
547
- end
548
-
549
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
550
- "sanity check"
551
-
552
- Dir.chdir @tempdir do
553
- inst = Gem::DependencyInstaller.new :minimal_deps => true
554
- inst.install "e"
555
- end
556
-
557
- assert_equal %w[a-1 e-1], inst.installed_gems.map {|s| s.full_name }
558
- end
559
-
560
- def test_install_no_minimal_deps
561
- util_setup_gems
562
-
563
- _, e1_gem = util_gem "e", "1" do |s|
564
- s.add_dependency "b"
565
- end
566
-
567
- _, b2_gem = util_gem "b", "2" do |s|
568
- s.add_dependency "a"
569
- end
570
-
571
- FileUtils.mv @a1_gem, @tempdir
572
- FileUtils.mv @b1_gem, @tempdir
573
- FileUtils.mv b2_gem, @tempdir
574
- FileUtils.mv e1_gem, @tempdir
575
-
576
- inst = nil
577
-
578
- Dir.chdir @tempdir do
579
- inst = Gem::DependencyInstaller.new :ignore_dependencies => true
580
- inst.install "b", req("= 1")
581
- end
582
-
583
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
584
- "sanity check"
585
-
586
- Dir.chdir @tempdir do
587
- inst = Gem::DependencyInstaller.new :minimal_deps => false
588
- inst.install "e"
589
- end
590
-
591
- assert_equal %w[a-1 b-2 e-1], inst.installed_gems.map {|s| s.full_name }
592
- end
593
-
594
- def test_install_no_document
595
- util_setup_gems
596
-
597
- done_installing_called = false
598
-
599
- Gem.done_installing do |dep_installer, specs|
600
- done_installing_called = true
601
- assert_empty dep_installer.document
602
- end
603
-
604
- inst = Gem::DependencyInstaller.new :domain => :local, :document => []
605
-
606
- inst.install @a1_gem
607
-
608
- assert done_installing_called
609
- end
610
-
611
- def test_install_env_shebang
612
- util_setup_gems
613
-
614
- FileUtils.mv @a1_gem, @tempdir
615
- inst = nil
616
-
617
- Dir.chdir @tempdir do
618
- inst = Gem::DependencyInstaller.new :env_shebang => true, :wrappers => true, :format_executable => false
619
- inst.install "a"
620
- end
621
-
622
- env = "/\\S+/env" unless Gem.win_platform?
623
-
624
- assert_match %r{\A#!#{env} #{RbConfig::CONFIG['ruby_install_name']}\n},
625
- File.read(File.join(@gemhome, "bin", "a_bin"))
626
- end
627
-
628
- def test_install_force
629
- util_setup_gems
630
-
631
- FileUtils.mv @b1_gem, @tempdir
632
- si = util_setup_spec_fetcher @b1
633
- @fetcher.data["http://gems.example.com/gems/yaml"] = si.to_yaml
634
- inst = nil
635
-
636
- Dir.chdir @tempdir do
637
- inst = Gem::DependencyInstaller.new :force => true
638
- inst.install "b"
639
- end
640
-
641
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
642
- end
643
-
644
- def test_install_build_args
645
- util_setup_gems
646
-
647
- FileUtils.mv @a1_gem, @tempdir
648
- inst = nil
649
- build_args = %w[--a --b="c"]
650
-
651
- Dir.chdir @tempdir do
652
- inst = Gem::DependencyInstaller.new(
653
- :build_args => build_args)
654
- inst.install "a"
655
- end
656
-
657
- assert_equal build_args.join("\n"), File.read(inst.installed_gems.first.build_info_file).strip
658
- end
659
-
660
- def test_install_ignore_dependencies
661
- util_setup_gems
662
-
663
- FileUtils.mv @b1_gem, @tempdir
664
- inst = nil
665
-
666
- Dir.chdir @tempdir do
667
- inst = Gem::DependencyInstaller.new :ignore_dependencies => true
668
- inst.install "b"
669
- end
670
-
671
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
672
- end
673
-
674
- def test_install_install_dir
675
- util_setup_gems
676
-
677
- FileUtils.mv @a1_gem, @tempdir
678
- FileUtils.mv @b1_gem, @tempdir
679
-
680
- inst = Gem::Installer.at @a1.file_name
681
- inst.install
682
-
683
- gemhome2 = File.join @tempdir, "gemhome2"
684
- Dir.mkdir gemhome2
685
- inst = nil
686
-
687
- Dir.chdir @tempdir do
688
- inst = Gem::DependencyInstaller.new :install_dir => gemhome2
689
- inst.install "b"
690
- end
691
-
692
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
693
-
694
- assert File.exist?(File.join(gemhome2, "specifications", @a1.spec_name))
695
- assert File.exist?(File.join(gemhome2, "cache", @a1.file_name))
696
- end
697
-
698
- def test_install_domain_both
699
- util_setup_gems
700
-
701
- a1_data = nil
702
- File.open @a1_gem, "rb" do |fp|
703
- a1_data = fp.read
704
- end
705
-
706
- @fetcher.data["http://gems.example.com/gems/a-1.gem"] = a1_data
707
-
708
- FileUtils.mv @b1_gem, @tempdir
709
- inst = nil
710
-
711
- Dir.chdir @tempdir do
712
- inst = Gem::DependencyInstaller.new :domain => :both
713
- inst.install "b"
714
- end
715
-
716
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
717
- a1, b1 = inst.installed_gems
718
-
719
- assert_equal a1.spec_file, a1.loaded_from
720
- assert_equal b1.spec_file, b1.loaded_from
721
- end
722
-
723
- def test_install_domain_both_no_network
724
- util_setup_gems
725
-
726
- @fetcher.data["http://gems.example.com/gems/Marshal.#{@marshal_version}"] =
727
- proc do
728
- raise Gem::RemoteFetcher::FetchError
729
- end
730
-
731
- FileUtils.mv @a1_gem, @tempdir
732
- FileUtils.mv @b1_gem, @tempdir
733
- inst = nil
734
-
735
- Dir.chdir @tempdir do
736
- inst = Gem::DependencyInstaller.new :domain => :both
737
- inst.install "b"
738
- end
739
-
740
- assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
741
- end
742
-
743
- def test_install_domain_local
744
- util_setup_gems
745
-
746
- FileUtils.mv @b1_gem, @tempdir
747
- inst = nil
748
-
749
- Dir.chdir @tempdir do
750
- e = assert_raise Gem::UnsatisfiableDependencyError do
751
- inst = Gem::DependencyInstaller.new :domain => :local
752
- inst.install "b"
753
- end
754
-
755
- expected = "Unable to resolve dependency: 'b (>= 0)' requires 'a (>= 0)'"
756
- assert_equal expected, e.message
757
- end
758
-
759
- assert_equal [], inst.installed_gems.map {|s| s.full_name }
760
- end
761
-
762
- def test_install_domain_remote
763
- util_setup_gems
764
-
765
- a1_data = nil
766
- File.open @a1_gem, "rb" do |fp|
767
- a1_data = fp.read
768
- end
769
-
770
- @fetcher.data["http://gems.example.com/gems/a-1.gem"] = a1_data
771
-
772
- inst = Gem::DependencyInstaller.new :domain => :remote
773
- inst.install "a"
774
-
775
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
776
- end
777
-
778
- def test_install_dual_repository
779
- util_setup_gems
780
-
781
- FileUtils.mv @a1_gem, @tempdir
782
- FileUtils.mv @b1_gem, @tempdir
783
- inst = nil
784
-
785
- gemhome2 = "#{@gemhome}2"
786
-
787
- Dir.chdir @tempdir do
788
- inst = Gem::DependencyInstaller.new :install_dir => gemhome2
789
- inst.install "a"
790
- end
791
-
792
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name },
793
- "sanity check"
794
-
795
- ENV["GEM_HOME"] = @gemhome
796
- ENV["GEM_PATH"] = [@gemhome, gemhome2].join File::PATH_SEPARATOR
797
- Gem.clear_paths
798
-
799
- Dir.chdir @tempdir do
800
- inst = Gem::DependencyInstaller.new
801
- inst.install "b"
802
- end
803
-
804
- assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
805
- end
806
-
807
- def test_install_reinstall
808
- util_setup_gems
809
-
810
- Gem::Installer.at(@a1_gem).install
811
- FileUtils.mv @a1_gem, @tempdir
812
- inst = nil
813
-
814
- Dir.chdir @tempdir do
815
- inst = Gem::DependencyInstaller.new :force => true
816
- inst.install "a"
817
- end
818
-
819
- assert_equal %w[a-1], Gem::Specification.map(&:full_name)
820
- assert_equal %w[a-1], inst.installed_gems.map(&:full_name)
821
- end
822
-
823
- def test_install_remote
824
- util_setup_gems
825
-
826
- a1_data = nil
827
- File.open @a1_gem, "rb" do |fp|
828
- a1_data = fp.read
829
- end
830
-
831
- @fetcher.data["http://gems.example.com/gems/a-1.gem"] = a1_data
832
-
833
- inst = Gem::DependencyInstaller.new
834
-
835
- Dir.chdir @tempdir do
836
- inst.install "a"
837
- end
838
-
839
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
840
- end
841
-
842
- def test_install_remote_dep
843
- util_setup_gems
844
-
845
- a1_data = nil
846
- File.open @a1_gem, "rb" do |fp|
847
- a1_data = fp.read
848
- end
849
-
850
- @fetcher.data["http://gems.example.com/gems/a-1.gem"] = a1_data
851
-
852
- inst = Gem::DependencyInstaller.new
853
-
854
- Dir.chdir @tempdir do
855
- dep = Gem::Dependency.new @a1.name, @a1.version
856
- inst.install dep
857
- end
858
-
859
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
860
- end
861
-
862
- def test_install_remote_platform_newer
863
- util_setup_gems
864
-
865
- a2_o, a2_o_gem = util_gem "a", "2" do |s|
866
- s.platform = Gem::Platform.new %w[cpu other_platform 1]
867
- end
868
-
869
- si = util_setup_spec_fetcher @a1, a2_o
870
-
871
- @fetcher.data["http://gems.example.com/gems/yaml"] = si.to_yaml
872
-
873
- a1_data = nil
874
- a2_o_data = nil
875
-
876
- File.open @a1_gem, "rb" do |fp|
877
- a1_data = fp.read
878
- end
879
-
880
- File.open a2_o_gem, "rb" do |fp|
881
- a2_o_data = fp.read
882
- end
883
-
884
- @fetcher.data["http://gems.example.com/gems/#{@a1.file_name}"] =
885
- a1_data
886
- @fetcher.data["http://gems.example.com/gems/#{a2_o.file_name}"] =
887
- a2_o_data
888
-
889
- inst = Gem::DependencyInstaller.new :domain => :remote
890
- inst.install "a"
891
-
892
- assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
893
- end
894
-
895
- def test_install_platform_is_ignored_when_a_file_is_specified
896
- _, a_gem = util_gem "a", "1" do |s|
897
- s.platform = Gem::Platform.new %w[cpu other_platform 1]
898
- end
899
-
900
- inst = Gem::DependencyInstaller.new :domain => :local
901
- inst.install a_gem
902
-
903
- assert_equal %w[a-1-cpu-other_platform-1], inst.installed_gems.map {|s| s.full_name }
904
- end
905
-
906
- require "rubygems/openssl"
907
-
908
- if Gem::HAVE_OPENSSL
909
- def test_install_security_policy
910
- util_setup_gems
911
-
912
- data = File.open(@a1_gem, "rb") {|f| f.read }
913
- @fetcher.data["http://gems.example.com/gems/a-1.gem"] = data
914
-
915
- data = File.open(@b1_gem, "rb") {|f| f.read }
916
- @fetcher.data["http://gems.example.com/gems/b-1.gem"] = data
917
-
918
- policy = Gem::Security::HighSecurity
919
- inst = Gem::DependencyInstaller.new :security_policy => policy
920
-
921
- e = assert_raise Gem::Security::Exception do
922
- inst.install "b"
923
- end
924
-
925
- assert_equal "unsigned gems are not allowed by the High Security policy",
926
- e.message
927
-
928
- assert_equal %w[], inst.installed_gems.map {|s| s.full_name }
929
- end
930
- end
931
-
932
- # Wrappers don't work on mswin
933
- unless win_platform?
934
- def test_install_no_wrappers
935
- util_setup_gems
936
-
937
- @fetcher.data["http://gems.example.com/gems/a-1.gem"] = read_binary(@a1_gem)
938
-
939
- inst = Gem::DependencyInstaller.new :wrappers => false, :format_executable => false
940
- inst.install "a"
941
-
942
- refute_match(%r{This file was generated by RubyGems.},
943
- File.read(File.join(@gemhome, "bin", "a_bin")))
944
- end
945
- end
946
-
947
- def test_install_version
948
- util_setup_d
949
-
950
- data = File.open(@d2_gem, "rb") {|f| f.read }
951
- @fetcher.data["http://gems.example.com/gems/d-2.gem"] = data
952
-
953
- data = File.open(@d1_gem, "rb") {|f| f.read }
954
- @fetcher.data["http://gems.example.com/gems/d-1.gem"] = data
955
-
956
- inst = Gem::DependencyInstaller.new
957
-
958
- inst.install "d", "= 1"
959
-
960
- assert_equal %w[d-1], inst.installed_gems.map {|s| s.full_name }
961
- end
962
-
963
- def test_install_version_default
964
- util_setup_d
965
-
966
- data = File.open(@d2_gem, "rb") {|f| f.read }
967
- @fetcher.data["http://gems.example.com/gems/d-2.gem"] = data
968
-
969
- data = File.open(@d1_gem, "rb") {|f| f.read }
970
- @fetcher.data["http://gems.example.com/gems/d-1.gem"] = data
971
-
972
- inst = Gem::DependencyInstaller.new
973
- inst.install "d"
974
-
975
- assert_equal %w[d-2], inst.installed_gems.map {|s| s.full_name }
976
- end
977
-
978
- def test_install_legacy_spec_with_nil_required_ruby_version
979
- path = File.expand_path "data/null-required-ruby-version.gemspec.rz", __dir__
980
- spec = Marshal.load Gem.read_binary(path)
981
- def spec.validate(*args); end
982
-
983
- util_build_gem spec
984
-
985
- cache_file = File.join @tempdir, "gems", "#{spec.original_name}.gem"
986
- FileUtils.mkdir_p File.dirname cache_file
987
- FileUtils.mv spec.cache_file, cache_file
988
-
989
- util_setup_spec_fetcher spec
990
-
991
- data = Gem.read_binary(cache_file)
992
-
993
- @fetcher.data["http://gems.example.com/gems/activesupport-1.0.0.gem"] = data
994
-
995
- dep = Gem::Dependency.new "activesupport"
996
-
997
- inst = Gem::DependencyInstaller.new
998
- inst.install dep
999
-
1000
- assert_equal %w[activesupport-1.0.0], Gem::Specification.map(&:full_name)
1001
- end
1002
-
1003
- def test_install_legacy_spec_with_nil_required_rubygems_version
1004
- path = File.expand_path "data/null-required-rubygems-version.gemspec.rz", __dir__
1005
- spec = Marshal.load Gem.read_binary(path)
1006
- def spec.validate(*args); end
1007
-
1008
- util_build_gem spec
1009
-
1010
- cache_file = File.join @tempdir, "gems", "#{spec.original_name}.gem"
1011
- FileUtils.mkdir_p File.dirname cache_file
1012
- FileUtils.mv spec.cache_file, cache_file
1013
-
1014
- util_setup_spec_fetcher spec
1015
-
1016
- data = Gem.read_binary(cache_file)
1017
-
1018
- @fetcher.data["http://gems.example.com/gems/activesupport-1.0.0.gem"] = data
1019
-
1020
- dep = Gem::Dependency.new "activesupport"
1021
-
1022
- inst = Gem::DependencyInstaller.new
1023
- inst.install dep
1024
-
1025
- assert_equal %w[activesupport-1.0.0], Gem::Specification.map(&:full_name)
1026
- end
1027
-
1028
- def test_find_gems_gems_with_sources
1029
- util_setup_gems
1030
-
1031
- inst = Gem::DependencyInstaller.new
1032
- dep = Gem::Dependency.new "b", ">= 0"
1033
-
1034
- Gem::Specification.reset
1035
-
1036
- set = Gem::Deprecate.skip_during do
1037
- inst.find_gems_with_sources(dep)
1038
- end
1039
-
1040
- assert_kind_of Gem::AvailableSet, set
1041
-
1042
- s = set.set.first
1043
-
1044
- assert_equal @b1, s.spec
1045
- assert_equal Gem::Source.new(@gem_repo), s.source
1046
- end
1047
-
1048
- def test_find_gems_with_sources_local
1049
- util_setup_gems
1050
-
1051
- FileUtils.mv @a1_gem, @tempdir
1052
- inst = Gem::DependencyInstaller.new
1053
- dep = Gem::Dependency.new "a", ">= 0"
1054
- set = nil
1055
-
1056
- Dir.chdir @tempdir do
1057
- set = Gem::Deprecate.skip_during do
1058
- inst.find_gems_with_sources dep
1059
- end
1060
- end
1061
-
1062
- gems = set.sorted
1063
-
1064
- assert_equal 2, gems.length
1065
-
1066
- remote, local = gems
1067
-
1068
- assert_equal "a-1", local.spec.full_name, "local spec"
1069
- assert_equal File.join(@tempdir, @a1.file_name),
1070
- local.source.download(local.spec), "local path"
1071
-
1072
- assert_equal "a-1", remote.spec.full_name, "remote spec"
1073
- assert_equal Gem::Source.new(@gem_repo), remote.source, "remote path"
1074
- end
1075
-
1076
- def test_find_gems_with_sources_prerelease
1077
- util_setup_gems
1078
-
1079
- installer = Gem::DependencyInstaller.new
1080
-
1081
- dependency = Gem::Dependency.new("a", Gem::Requirement.default)
1082
-
1083
- set = Gem::Deprecate.skip_during do
1084
- installer.find_gems_with_sources(dependency)
1085
- end
1086
-
1087
- releases = set.all_specs
1088
-
1089
- assert releases.any? {|s| s.name == "a" && s.version.to_s == "1" }
1090
- refute releases.any? {|s| s.name == "a" && s.version.to_s == "1.a" }
1091
-
1092
- dependency.prerelease = true
1093
-
1094
- set = Gem::Deprecate.skip_during do
1095
- installer.find_gems_with_sources(dependency)
1096
- end
1097
-
1098
- prereleases = set.all_specs
1099
-
1100
- assert_equal [@a1_pre, @a1], prereleases
1101
- end
1102
-
1103
- def test_find_gems_with_sources_with_best_only_and_platform
1104
- util_setup_gems
1105
- a1_x86_mingw32, = util_gem "a", "1" do |s|
1106
- s.platform = "x86-mingw32"
1107
- end
1108
- util_setup_spec_fetcher @a1, a1_x86_mingw32
1109
- Gem.platforms << Gem::Platform.new("x86-mingw32")
1110
-
1111
- installer = Gem::DependencyInstaller.new
1112
-
1113
- dependency = Gem::Dependency.new("a", Gem::Requirement.default)
1114
-
1115
- set = Gem::Deprecate.skip_during do
1116
- installer.find_gems_with_sources(dependency, true)
1117
- end
1118
-
1119
- releases = set.all_specs
1120
-
1121
- assert_equal [a1_x86_mingw32], releases
1122
- end
1123
-
1124
- def test_find_gems_with_sources_with_bad_source
1125
- Gem.sources.replace ["http://not-there.nothing"]
1126
-
1127
- installer = Gem::DependencyInstaller.new
1128
-
1129
- dep = Gem::Dependency.new("a")
1130
-
1131
- out = Gem::Deprecate.skip_during do
1132
- installer.find_gems_with_sources(dep)
1133
- end
1134
-
1135
- assert out.empty?
1136
- assert_kind_of Gem::SourceFetchProblem, installer.errors.first
1137
- end
1138
-
1139
- def test_resolve_dependencies
1140
- util_setup_gems
1141
-
1142
- FileUtils.mv @a1_gem, @tempdir
1143
- FileUtils.mv @b1_gem, @tempdir
1144
-
1145
- inst = Gem::DependencyInstaller.new
1146
- request_set = inst.resolve_dependencies "b", req(">= 0")
1147
-
1148
- requests = request_set.sorted_requests.map {|req| req.full_name }
1149
-
1150
- assert_equal %w[a-1 b-1], requests
1151
- end
1152
-
1153
- def test_resolve_dependencies_ignore_dependencies
1154
- util_setup_gems
1155
-
1156
- FileUtils.mv @a1_gem, @tempdir
1157
- FileUtils.mv @b1_gem, @tempdir
1158
-
1159
- inst = Gem::DependencyInstaller.new :ignore_dependencies => true
1160
- request_set = inst.resolve_dependencies "b", req(">= 0")
1161
-
1162
- requests = request_set.sorted_requests.map {|req| req.full_name }
1163
-
1164
- assert request_set.ignore_dependencies
1165
-
1166
- assert_equal %w[b-1], requests
1167
- end
1168
-
1169
- def test_resolve_dependencies_local
1170
- util_setup_gems
1171
-
1172
- @a2, @a2_gem = util_gem "a", "2"
1173
- FileUtils.mv @a1_gem, @tempdir
1174
- FileUtils.mv @a2_gem, @tempdir
1175
-
1176
- inst = Gem::DependencyInstaller.new
1177
- request_set = inst.resolve_dependencies "a-1.gem", req(">= 0")
1178
-
1179
- requests = request_set.sorted_requests.map {|req| req.full_name }
1180
-
1181
- assert_equal %w[a-1], requests
1182
- end
1183
-
1184
- def util_setup_d
1185
- @d1, @d1_gem = util_gem "d", "1"
1186
- @d2, @d2_gem = util_gem "d", "2"
1187
-
1188
- util_setup_spec_fetcher(@d1, @d2)
1189
- end
1190
- end