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,1573 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "helper"
4
- require_relative "test_gem_update_suggestion"
5
- require "rubygems/commands/install_command"
6
- require "rubygems/request_set"
7
- require "rubygems/rdoc"
8
-
9
- class TestGemCommandsInstallCommand < Gem::TestCase
10
- def setup
11
- @orig_args = Gem::Command.build_args
12
- super
13
- common_installer_setup
14
-
15
- @cmd = Gem::Commands::InstallCommand.new
16
- @cmd.options[:document] = []
17
-
18
- @gemdeps = "tmp_install_gemdeps"
19
-
20
- common_installer_setup
21
- end
22
-
23
- def teardown
24
- super
25
-
26
- common_installer_teardown
27
-
28
- Gem::Command.build_args = @orig_args
29
- File.unlink @gemdeps if File.file? @gemdeps
30
- File.unlink "#{@gemdeps}.lock" if File.file? "#{@gemdeps}.lock"
31
- end
32
-
33
- def test_execute_exclude_prerelease
34
- spec_fetcher do |fetcher|
35
- fetcher.gem "a", 2
36
- fetcher.gem "a", "2.pre"
37
- end
38
-
39
- @cmd.options[:args] = %w[a]
40
-
41
- use_ui @ui do
42
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
43
- @cmd.execute
44
- end
45
- end
46
-
47
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
48
- end
49
-
50
- def test_execute_explicit_version_includes_prerelease
51
- specs = spec_fetcher do |fetcher|
52
- fetcher.gem "a", 2
53
- fetcher.gem "a", "2.a"
54
- end
55
-
56
- a2_pre = specs["a-2.a"]
57
-
58
- @cmd.handle_options [a2_pre.name, "--version", a2_pre.version.to_s,
59
- "--no-document"]
60
- assert @cmd.options[:prerelease]
61
- assert @cmd.options[:version].satisfied_by?(a2_pre.version)
62
-
63
- use_ui @ui do
64
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
65
- @cmd.execute
66
- end
67
- end
68
-
69
- assert_equal %w[a-2.a], @cmd.installed_specs.map {|spec| spec.full_name }
70
- end
71
-
72
- def test_execute_local
73
- specs = spec_fetcher do |fetcher|
74
- fetcher.gem "a", 2
75
- end
76
-
77
- @cmd.options[:domain] = :local
78
-
79
- FileUtils.mv specs["a-2"].cache_file, @tempdir
80
-
81
- @cmd.options[:args] = %w[a]
82
-
83
- use_ui @ui do
84
- orig_dir = Dir.pwd
85
- begin
86
- Dir.chdir @tempdir
87
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
88
- @cmd.execute
89
- end
90
- ensure
91
- Dir.chdir orig_dir
92
- end
93
- end
94
-
95
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
96
-
97
- assert_match "1 gem installed", @ui.output
98
- end
99
-
100
- def test_execute_local_dependency_nonexistent
101
- specs = spec_fetcher do |fetcher|
102
- fetcher.gem "foo", 2, "bar" => "0.5"
103
- end
104
-
105
- @cmd.options[:domain] = :local
106
-
107
- FileUtils.mv specs["foo-2"].cache_file, @tempdir
108
-
109
- @cmd.options[:args] = ["foo"]
110
-
111
- use_ui @ui do
112
- orig_dir = Dir.pwd
113
- begin
114
- Dir.chdir @tempdir
115
- e = assert_raise Gem::MockGemUi::TermError do
116
- @cmd.execute
117
- end
118
- assert_equal 2, e.exit_code
119
- ensure
120
- Dir.chdir orig_dir
121
- end
122
- end
123
-
124
- expected = <<-EXPECTED
125
- ERROR: Could not find a valid gem 'bar' (= 0.5) (required by 'foo' (>= 0)) in any repository
126
- EXPECTED
127
-
128
- assert_equal expected, @ui.error
129
- end
130
-
131
- def test_execute_local_dependency_nonexistent_ignore_dependencies
132
- specs = spec_fetcher do |fetcher|
133
- fetcher.gem "foo", 2, "bar" => "0.5"
134
- end
135
-
136
- @cmd.options[:domain] = :local
137
- @cmd.options[:ignore_dependencies] = true
138
-
139
- FileUtils.mv specs["foo-2"].cache_file, @tempdir
140
-
141
- @cmd.options[:args] = ["foo"]
142
-
143
- use_ui @ui do
144
- orig_dir = Dir.pwd
145
- begin
146
- Dir.chdir orig_dir
147
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
148
- @cmd.execute
149
- end
150
- ensure
151
- Dir.chdir orig_dir
152
- end
153
- end
154
-
155
- assert_match "1 gem installed", @ui.output
156
- end
157
-
158
- def test_execute_local_transitive_prerelease
159
- specs = spec_fetcher do |fetcher|
160
- fetcher.download "a", 2, "b" => "2.a", "c" => "3"
161
- fetcher.download "b", "2.a"
162
- fetcher.download "c", "3"
163
- end
164
-
165
- @cmd.options[:domain] = :local
166
-
167
- FileUtils.mv specs["a-2"].cache_file, @tempdir
168
- FileUtils.mv specs["b-2.a"].cache_file, @tempdir
169
- FileUtils.mv specs["c-3"].cache_file, @tempdir
170
-
171
- @cmd.options[:args] = %w[a]
172
-
173
- use_ui @ui do
174
- orig_dir = Dir.pwd
175
- begin
176
- Dir.chdir @tempdir
177
- FileUtils.rm_r [@gemhome, "gems"]
178
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
179
- @cmd.execute
180
- end
181
- ensure
182
- Dir.chdir orig_dir
183
- end
184
- end
185
-
186
- assert_equal %w[a-2 b-2.a c-3], @cmd.installed_specs.map {|spec| spec.full_name }.sort
187
-
188
- assert_match "3 gems installed", @ui.output
189
- end
190
-
191
- def test_execute_no_user_install
192
- pend "skipped on MS Windows (chmod has no effect)" if win_platform?
193
- pend "skipped in root privilege" if Process.uid.zero?
194
-
195
- specs = spec_fetcher do |fetcher|
196
- fetcher.gem "a", 2
197
- end
198
-
199
- @cmd.options[:user_install] = false
200
-
201
- FileUtils.mv specs["a-2"].cache_file, @tempdir
202
-
203
- @cmd.options[:args] = %w[a]
204
-
205
- use_ui @ui do
206
- orig_dir = Dir.pwd
207
- begin
208
- FileUtils.chmod 0o755, @userhome
209
- FileUtils.chmod 0o555, @gemhome
210
-
211
- Dir.chdir @tempdir
212
- assert_raise Gem::FilePermissionError do
213
- @cmd.execute
214
- end
215
- ensure
216
- Dir.chdir orig_dir
217
- FileUtils.chmod 0o755, @gemhome
218
- end
219
- end
220
- end
221
-
222
- def test_execute_local_missing
223
- spec_fetcher
224
-
225
- @cmd.options[:domain] = :local
226
-
227
- @cmd.options[:args] = %w[no_such_gem]
228
-
229
- use_ui @ui do
230
- e = assert_raise Gem::MockGemUi::TermError do
231
- @cmd.execute
232
- end
233
- assert_equal 2, e.exit_code
234
- end
235
-
236
- # HACK: no repository was checked
237
- assert_match(/ould not find a valid gem 'no_such_gem'/, @ui.error)
238
- end
239
-
240
- def test_execute_local_missing_ignore_dependencies
241
- spec_fetcher
242
-
243
- @cmd.options[:domain] = :local
244
- @cmd.options[:ignore_dependencies] = true
245
-
246
- @cmd.options[:args] = %w[no_such_gem]
247
-
248
- use_ui @ui do
249
- e = assert_raise Gem::MockGemUi::TermError do
250
- @cmd.execute
251
- end
252
- assert_equal 2, e.exit_code
253
- end
254
-
255
- # HACK: no repository was checked
256
- assert_match(/ould not find a valid gem 'no_such_gem'/, @ui.error)
257
- end
258
-
259
- def test_execute_no_gem
260
- @cmd.options[:args] = %w[]
261
-
262
- assert_raise Gem::CommandLineError do
263
- @cmd.execute
264
- end
265
- end
266
-
267
- def test_execute_nonexistent
268
- spec_fetcher
269
-
270
- @cmd.options[:args] = %w[nonexistent]
271
-
272
- use_ui @ui do
273
- e = assert_raise Gem::MockGemUi::TermError do
274
- @cmd.execute
275
- end
276
- assert_equal 2, e.exit_code
277
- end
278
-
279
- assert_match(/ould not find a valid gem 'nonexistent'/, @ui.error)
280
- end
281
-
282
- def test_execute_nonexistent_force
283
- spec_fetcher
284
-
285
- @cmd.options[:args] = %w[nonexistent]
286
- @cmd.options[:force] = true
287
-
288
- use_ui @ui do
289
- e = assert_raise Gem::MockGemUi::TermError do
290
- @cmd.execute
291
- end
292
- assert_equal 2, e.exit_code
293
- end
294
-
295
- assert_match(/ould not find a valid gem 'nonexistent'/, @ui.error)
296
- end
297
-
298
- def test_execute_dependency_nonexistent
299
- spec_fetcher do |fetcher|
300
- fetcher.spec "foo", 2, "bar" => "0.5"
301
- end
302
-
303
- @cmd.options[:args] = ["foo"]
304
-
305
- use_ui @ui do
306
- e = assert_raise Gem::MockGemUi::TermError do
307
- @cmd.execute
308
- end
309
-
310
- assert_equal 2, e.exit_code
311
- end
312
-
313
- expected = <<-EXPECTED
314
- ERROR: Could not find a valid gem 'bar' (= 0.5) (required by 'foo' (>= 0)) in any repository
315
- EXPECTED
316
-
317
- assert_equal expected, @ui.error
318
- end
319
-
320
- def test_execute_http_proxy
321
- use_ui @ui do
322
- e = assert_raise ArgumentError, @ui.error do
323
- @cmd.handle_options %w[-p=foo.bar.com]
324
- end
325
-
326
- assert_match "Invalid uri scheme for =foo.bar.com\nPreface URLs with one of [\"http://\", \"https://\", \"file://\", \"s3://\"]", e.message
327
- end
328
- end
329
-
330
- def test_execute_bad_source
331
- spec_fetcher
332
-
333
- # This is needed because we need to exercise the cache path
334
- # within SpecFetcher
335
- path = File.join Gem.spec_cache_dir, "not-there.nothing%80", "latest_specs.4.8"
336
-
337
- FileUtils.mkdir_p File.dirname(path)
338
-
339
- File.open path, "w" do |f|
340
- f.write Marshal.dump([])
341
- end
342
-
343
- Gem.sources.replace ["http://not-there.nothing"]
344
-
345
- @cmd.options[:args] = %w[nonexistent]
346
-
347
- use_ui @ui do
348
- e = assert_raise Gem::MockGemUi::TermError do
349
- @cmd.execute
350
- end
351
- assert_equal 2, e.exit_code
352
- end
353
-
354
- errs = @ui.error.split("\n")
355
-
356
- assert_match(/ould not find a valid gem 'nonexistent'/, errs.shift)
357
- assert_match(%r{Unable to download data from http://not-there.nothing}, errs.shift)
358
- end
359
-
360
- def test_execute_nonexistent_hint_disabled
361
- misspelled = "nonexistent_with_hint"
362
- correctly_spelled = "non_existent_with_hint"
363
-
364
- spec_fetcher do |fetcher|
365
- fetcher.spec correctly_spelled, 2
366
- end
367
-
368
- @cmd.options[:args] = [misspelled]
369
- @cmd.options[:suggest_alternate] = false
370
-
371
- use_ui @ui do
372
- e = assert_raise Gem::MockGemUi::TermError do
373
- @cmd.execute
374
- end
375
-
376
- assert_equal 2, e.exit_code
377
- end
378
-
379
- expected = <<-EXPECTED
380
- ERROR: Could not find a valid gem 'nonexistent_with_hint' (>= 0) in any repository
381
- EXPECTED
382
-
383
- assert_equal expected, @ui.error
384
- end
385
-
386
- def test_execute_nonexistent_with_hint
387
- misspelled = "nonexistent_with_hint"
388
- correctly_spelled = "non_existent_with_hint"
389
-
390
- spec_fetcher do |fetcher|
391
- fetcher.spec correctly_spelled, 2
392
- end
393
-
394
- @cmd.options[:args] = [misspelled]
395
-
396
- use_ui @ui do
397
- e = assert_raise Gem::MockGemUi::TermError do
398
- @cmd.execute
399
- end
400
-
401
- assert_equal 2, e.exit_code
402
- end
403
-
404
- expected = "ERROR: Could not find a valid gem 'nonexistent_with_hint' (>= 0) in any repository
405
- ERROR: Possible alternatives: non_existent_with_hint
406
- "
407
-
408
- assert_equal expected, @ui.error
409
- end
410
-
411
- def test_execute_nonexistent_with_dashes
412
- misspelled = "non-existent_with-hint"
413
- correctly_spelled = "nonexistent-with_hint"
414
-
415
- spec_fetcher do |fetcher|
416
- fetcher.download correctly_spelled, 2
417
- end
418
-
419
- @cmd.options[:args] = [misspelled]
420
-
421
- use_ui @ui do
422
- e = assert_raise Gem::MockGemUi::TermError do
423
- @cmd.execute
424
- end
425
-
426
- assert_equal 2, e.exit_code
427
- end
428
-
429
- expected = [
430
- "ERROR: Could not find a valid gem 'non-existent_with-hint' (>= 0) in any repository",
431
- "ERROR: Possible alternatives: nonexistent-with_hint",
432
- ]
433
-
434
- output = @ui.error.split "\n"
435
-
436
- assert_equal expected, output
437
- end
438
-
439
- def test_execute_conflicting_install_options
440
- @cmd.options[:user_install] = true
441
- @cmd.options[:install_dir] = "whatever"
442
-
443
- use_ui @ui do
444
- assert_raise Gem::MockGemUi::TermError do
445
- @cmd.execute
446
- end
447
- end
448
-
449
- expected = "ERROR: Use --install-dir or --user-install but not both\n"
450
-
451
- assert_equal expected, @ui.error
452
- end
453
-
454
- def test_execute_prerelease_skipped_when_no_flag_set
455
- spec_fetcher do |fetcher|
456
- fetcher.gem "a", 1
457
- fetcher.gem "a", "3.a"
458
- end
459
-
460
- @cmd.options[:prerelease] = false
461
- @cmd.options[:args] = %w[a]
462
-
463
- use_ui @ui do
464
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
465
- @cmd.execute
466
- end
467
- end
468
-
469
- assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
470
- end
471
-
472
- def test_execute_prerelease_wins_over_previous_ver
473
- spec_fetcher do |fetcher|
474
- fetcher.download "a", 1
475
- fetcher.download "a", "2.a"
476
- end
477
-
478
- @cmd.options[:prerelease] = true
479
- @cmd.options[:args] = %w[a]
480
-
481
- use_ui @ui do
482
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
483
- @cmd.execute
484
- end
485
- end
486
-
487
- assert_equal %w[a-2.a], @cmd.installed_specs.map {|spec| spec.full_name }
488
- end
489
-
490
- def test_execute_with_version_specified_by_colon
491
- spec_fetcher do |fetcher|
492
- fetcher.download "a", 1
493
- fetcher.download "a", 2
494
- end
495
-
496
- @cmd.options[:args] = %w[a:1]
497
-
498
- use_ui @ui do
499
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
500
- @cmd.execute
501
- end
502
- end
503
-
504
- assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
505
- end
506
-
507
- def test_execute_prerelease_skipped_when_non_pre_available
508
- spec_fetcher do |fetcher|
509
- fetcher.gem "a", "2.pre"
510
- fetcher.gem "a", 2
511
- end
512
-
513
- @cmd.options[:prerelease] = true
514
- @cmd.options[:args] = %w[a]
515
-
516
- use_ui @ui do
517
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
518
- @cmd.execute
519
- end
520
- end
521
-
522
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
523
- end
524
-
525
- def test_execute_required_ruby_version
526
- next_ruby = Gem.ruby_version.segments.map.with_index {|n, i| i == 1 ? n + 1 : n }.join(".")
527
-
528
- local = Gem::Platform.local
529
- spec_fetcher do |fetcher|
530
- fetcher.download "a", 2
531
- fetcher.download "a", 2 do |s|
532
- s.required_ruby_version = "< #{RUBY_VERSION}.a"
533
- s.platform = local
534
- end
535
- fetcher.download "a", 3 do |s|
536
- s.required_ruby_version = ">= #{next_ruby}"
537
- end
538
- fetcher.download "a", 3 do |s|
539
- s.required_ruby_version = ">= #{next_ruby}"
540
- s.platform = local
541
- end
542
- end
543
-
544
- @cmd.options[:args] = %w[a]
545
-
546
- use_ui @ui do
547
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
548
- @cmd.execute
549
- end
550
- end
551
-
552
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
553
- end
554
-
555
- def test_execute_required_ruby_version_upper_bound
556
- local = Gem::Platform.local
557
- spec_fetcher do |fetcher|
558
- fetcher.gem "a", 2.0
559
- fetcher.gem "a", 2.0 do |s|
560
- s.required_ruby_version = "< #{RUBY_VERSION}.a"
561
- s.platform = local
562
- end
563
- end
564
-
565
- @cmd.options[:args] = %w[a]
566
-
567
- use_ui @ui do
568
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
569
- @cmd.execute
570
- end
571
- end
572
-
573
- assert_equal %w[a-2.0], @cmd.installed_specs.map {|spec| spec.full_name }
574
- end
575
-
576
- def test_execute_required_ruby_version_specific_not_met
577
- spec_fetcher do |fetcher|
578
- fetcher.gem "a", "1.0" do |s|
579
- s.required_ruby_version = "= 1.4.6"
580
- end
581
- end
582
-
583
- @cmd.options[:args] = %w[a]
584
-
585
- use_ui @ui do
586
- assert_raise Gem::MockGemUi::TermError do
587
- @cmd.execute
588
- end
589
- end
590
-
591
- errs = @ui.error.split("\n")
592
- assert_equal "ERROR: Error installing a:", errs.shift
593
- assert_equal "\ta-1.0 requires Ruby version = 1.4.6. The current ruby version is #{Gem.ruby_version}.", errs.shift
594
- end
595
-
596
- def test_execute_required_ruby_version_specific_prerelease_met
597
- spec_fetcher do |fetcher|
598
- fetcher.gem "a", "1.0" do |s|
599
- s.required_ruby_version = ">= 1.4.6.preview2"
600
- end
601
- end
602
-
603
- @cmd.options[:args] = %w[a]
604
-
605
- use_ui @ui do
606
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
607
- @cmd.execute
608
- end
609
- end
610
-
611
- assert_equal %w[a-1.0], @cmd.installed_specs.map {|spec| spec.full_name }
612
- end
613
-
614
- def test_execute_required_ruby_version_specific_prerelease_not_met
615
- next_ruby_pre = Gem.ruby_version.segments.map.with_index {|n, i| i == 1 ? n + 1 : n }.join(".") + ".a"
616
-
617
- spec_fetcher do |fetcher|
618
- fetcher.gem "a", "1.0" do |s|
619
- s.required_ruby_version = "> #{next_ruby_pre}"
620
- end
621
- end
622
-
623
- @cmd.options[:args] = %w[a]
624
-
625
- use_ui @ui do
626
- assert_raise Gem::MockGemUi::TermError do
627
- @cmd.execute
628
- end
629
- end
630
-
631
- errs = @ui.error.split("\n")
632
- assert_equal "ERROR: Error installing a:", errs.shift
633
- assert_equal "\ta-1.0 requires Ruby version > #{next_ruby_pre}. The current ruby version is #{Gem.ruby_version}.", errs.shift
634
- end
635
-
636
- def test_execute_required_rubygems_version_wrong
637
- spec_fetcher do |fetcher|
638
- fetcher.gem "a", "1.0" do |s|
639
- s.required_rubygems_version = "< 0"
640
- end
641
- end
642
-
643
- @cmd.options[:args] = %w[a]
644
-
645
- use_ui @ui do
646
- assert_raise Gem::MockGemUi::TermError do
647
- @cmd.execute
648
- end
649
- end
650
-
651
- errs = @ui.error.split("\n")
652
- assert_equal "ERROR: Error installing a:", errs.shift
653
- assert_equal "\ta-1.0 requires RubyGems version < 0. The current RubyGems version is #{Gem.rubygems_version}. Try 'gem update --system' to update RubyGems itself.", errs.shift
654
- end
655
-
656
- def test_execute_rdoc
657
- specs = spec_fetcher do |fetcher|
658
- fetcher.gem "a", 2
659
- end
660
-
661
- Gem.done_installing(&Gem::RDoc.method(:generation_hook))
662
-
663
- @cmd.options[:document] = %w[rdoc ri]
664
- @cmd.options[:domain] = :local
665
-
666
- a2 = specs["a-2"]
667
- FileUtils.mv a2.cache_file, @tempdir
668
-
669
- @cmd.options[:args] = %w[a]
670
-
671
- use_ui @ui do
672
- # Don't use Dir.chdir with a block, it warnings a lot because
673
- # of a downstream Dir.chdir with a block
674
- old = Dir.getwd
675
-
676
- begin
677
- Dir.chdir @tempdir
678
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
679
- @cmd.execute
680
- end
681
- ensure
682
- Dir.chdir old
683
- end
684
- end
685
-
686
- wait_for_child_process_to_exit
687
-
688
- assert_path_exist File.join(a2.doc_dir, "ri")
689
- assert_path_exist File.join(a2.doc_dir, "rdoc")
690
- end
691
-
692
- def test_execute_rdoc_with_path
693
- specs = spec_fetcher do |fetcher|
694
- fetcher.gem "a", 2
695
- end
696
-
697
- Gem.done_installing(&Gem::RDoc.method(:generation_hook))
698
-
699
- @cmd.options[:document] = %w[rdoc ri]
700
- @cmd.options[:domain] = :local
701
- @cmd.options[:install_dir] = "whatever"
702
-
703
- a2 = specs["a-2"]
704
- FileUtils.mv a2.cache_file, @tempdir
705
-
706
- @cmd.options[:args] = %w[a]
707
-
708
- use_ui @ui do
709
- # Don't use Dir.chdir with a block, it warnings a lot because
710
- # of a downstream Dir.chdir with a block
711
- old = Dir.getwd
712
-
713
- begin
714
- Dir.chdir @tempdir
715
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
716
- @cmd.execute
717
- end
718
- ensure
719
- Dir.chdir old
720
- end
721
- end
722
-
723
- wait_for_child_process_to_exit
724
-
725
- assert_path_exist "whatever/doc/a-2", "documentation not installed"
726
- end
727
-
728
- def test_execute_saves_build_args
729
- specs = spec_fetcher do |fetcher|
730
- fetcher.gem "a", 2
731
- end
732
-
733
- args = %w[--with-awesome=true --more-awesome=yes]
734
-
735
- Gem::Command.build_args = args
736
-
737
- a2 = specs["a-2"]
738
- FileUtils.mv a2.cache_file, @tempdir
739
-
740
- @cmd.options[:domain] = :local
741
-
742
- @cmd.options[:args] = %w[a]
743
-
744
- use_ui @ui do
745
- # Don't use Dir.chdir with a block, it warnings a lot because
746
- # of a downstream Dir.chdir with a block
747
- old = Dir.getwd
748
-
749
- begin
750
- Dir.chdir @tempdir
751
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
752
- @cmd.execute
753
- end
754
- ensure
755
- Dir.chdir old
756
- end
757
- end
758
-
759
- path = a2.build_info_file
760
- assert_path_exist path
761
-
762
- assert_equal args, a2.build_args
763
- end
764
-
765
- def test_execute_remote
766
- spec_fetcher do |fetcher|
767
- fetcher.gem "a", 2
768
- end
769
-
770
- @cmd.options[:args] = %w[a]
771
-
772
- use_ui @ui do
773
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
774
- @cmd.execute
775
- end
776
- end
777
-
778
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
779
-
780
- assert_match "1 gem installed", @ui.output
781
- end
782
-
783
- def test_execute_with_invalid_gem_file
784
- FileUtils.touch("a.gem")
785
-
786
- spec_fetcher do |fetcher|
787
- fetcher.gem "a", 2
788
- end
789
-
790
- @cmd.options[:args] = %w[a]
791
-
792
- use_ui @ui do
793
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
794
- @cmd.execute
795
- end
796
- end
797
-
798
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
799
-
800
- assert_match "1 gem installed", @ui.output
801
- end
802
-
803
- def test_execute_remote_truncates_existing_gemspecs
804
- spec_fetcher do |fetcher|
805
- fetcher.gem "a", 1
806
- end
807
-
808
- @cmd.options[:domain] = :remote
809
-
810
- @cmd.options[:args] = %w[a]
811
-
812
- use_ui @ui do
813
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
814
- @cmd.execute
815
- end
816
- end
817
-
818
- assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
819
- assert_match "1 gem installed", @ui.output
820
-
821
- a1_gemspec = File.join(@gemhome, "specifications", "a-1.gemspec")
822
-
823
- initial_a1_gemspec_content = File.read(a1_gemspec)
824
- modified_a1_gemspec_content = initial_a1_gemspec_content + "\n # AAAAAAA\n"
825
- File.write(a1_gemspec, modified_a1_gemspec_content)
826
-
827
- use_ui @ui do
828
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
829
- @cmd.execute
830
- end
831
- end
832
-
833
- assert_equal initial_a1_gemspec_content, File.read(a1_gemspec)
834
- end
835
-
836
- def test_execute_remote_ignores_files
837
- specs = spec_fetcher do |fetcher|
838
- fetcher.gem "a", 1
839
- fetcher.gem "a", 2
840
- end
841
-
842
- @cmd.options[:domain] = :remote
843
-
844
- a1 = specs["a-1"]
845
- a2 = specs["a-2"]
846
-
847
- FileUtils.mv a2.cache_file, @tempdir
848
-
849
- @fetcher.data["#{@gem_repo}gems/#{a2.file_name}"] =
850
- read_binary(a1.cache_file)
851
-
852
- @cmd.options[:args] = [a2.name]
853
-
854
- gemdir = File.join @gemhome, "specifications"
855
-
856
- a2_gemspec = File.join(gemdir, "a-2.gemspec")
857
- a1_gemspec = File.join(gemdir, "a-1.gemspec")
858
-
859
- FileUtils.rm_rf a1_gemspec
860
- FileUtils.rm_rf a2_gemspec
861
-
862
- start = Dir["#{gemdir}/*"]
863
-
864
- use_ui @ui do
865
- Dir.chdir @tempdir do
866
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
867
- @cmd.execute
868
- end
869
- end
870
- end
871
-
872
- assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
873
-
874
- assert_match "1 gem installed", @ui.output
875
-
876
- fin = Dir["#{gemdir}/*"]
877
-
878
- assert_equal [a1_gemspec], fin - start
879
- end
880
-
881
- def test_execute_two
882
- specs = spec_fetcher do |fetcher|
883
- fetcher.gem "a", 2
884
- fetcher.gem "b", 2
885
- end
886
-
887
- FileUtils.mv specs["a-2"].cache_file, @tempdir
888
- FileUtils.mv specs["b-2"].cache_file, @tempdir
889
-
890
- @cmd.options[:domain] = :local
891
-
892
- @cmd.options[:args] = %w[a b]
893
-
894
- use_ui @ui do
895
- orig_dir = Dir.pwd
896
- begin
897
- Dir.chdir @tempdir
898
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
899
- @cmd.execute
900
- end
901
- ensure
902
- Dir.chdir orig_dir
903
- end
904
- end
905
-
906
- assert_equal %w[a-2 b-2], @cmd.installed_specs.map {|spec| spec.full_name }
907
-
908
- assert_match "2 gems installed", @ui.output
909
- end
910
-
911
- def test_execute_two_version
912
- @cmd.options[:args] = %w[a b]
913
- @cmd.options[:version] = Gem::Requirement.new("> 1")
914
-
915
- use_ui @ui do
916
- e = assert_raise Gem::MockGemUi::TermError do
917
- @cmd.execute
918
- end
919
-
920
- assert_equal 1, e.exit_code
921
- end
922
-
923
- assert_empty @cmd.installed_specs
924
-
925
- msg = "ERROR: Can't use --version with multiple gems. You can specify multiple gems with" \
926
- " version requirements using `gem install 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
927
-
928
- assert_empty @ui.output
929
- assert_equal msg, @ui.error.chomp
930
- end
931
-
932
- def test_execute_two_version_specified_by_colon
933
- spec_fetcher do |fetcher|
934
- fetcher.gem "a", 1
935
- fetcher.gem "a", 2
936
- fetcher.gem "b", 1
937
- fetcher.gem "b", 2
938
- end
939
-
940
- @cmd.options[:args] = %w[a:1 b:1]
941
-
942
- use_ui @ui do
943
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
944
- @cmd.execute
945
- end
946
- end
947
-
948
- assert_equal %w[a-1 b-1], @cmd.installed_specs.map {|spec| spec.full_name }
949
- end
950
-
951
- def test_execute_conservative
952
- spec_fetcher do |fetcher|
953
- fetcher.download "b", 2
954
-
955
- fetcher.gem "a", 2
956
- end
957
-
958
- @cmd.options[:conservative] = true
959
-
960
- @cmd.options[:args] = %w[a b]
961
-
962
- use_ui @ui do
963
- orig_dir = Dir.pwd
964
- begin
965
- Dir.chdir @tempdir
966
- assert_raise Gem::MockGemUi::SystemExitException do
967
- @cmd.execute
968
- end
969
- ensure
970
- Dir.chdir orig_dir
971
- end
972
- end
973
-
974
- assert_equal %w[b-2], @cmd.installed_specs.map {|spec| spec.full_name }
975
-
976
- assert_equal "", @ui.error
977
- assert_match "1 gem installed", @ui.output
978
- end
979
-
980
- def test_install_gem_ignore_dependencies_both
981
- done_installing = false
982
- Gem.done_installing do
983
- done_installing = true
984
- end
985
-
986
- spec = util_spec "a", 2
987
-
988
- util_build_gem spec
989
-
990
- FileUtils.mv spec.cache_file, @tempdir
991
-
992
- @cmd.options[:ignore_dependencies] = true
993
-
994
- @cmd.install_gem "a", ">= 0"
995
-
996
- assert_equal %w[a-2], @cmd.installed_specs.map {|s| s.full_name }
997
-
998
- assert done_installing, "documentation was not generated"
999
- end
1000
-
1001
- def test_install_gem_ignore_dependencies_remote
1002
- spec_fetcher do |fetcher|
1003
- fetcher.gem "a", 2
1004
- end
1005
-
1006
- @cmd.options[:ignore_dependencies] = true
1007
-
1008
- @cmd.install_gem "a", ">= 0"
1009
-
1010
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
1011
- end
1012
-
1013
- def test_install_gem_ignore_dependencies_remote_platform_local
1014
- local = Gem::Platform.local
1015
- spec_fetcher do |fetcher|
1016
- fetcher.gem "a", 3
1017
-
1018
- fetcher.gem "a", 3 do |s|
1019
- s.platform = local
1020
- end
1021
- end
1022
-
1023
- @cmd.options[:ignore_dependencies] = true
1024
-
1025
- @cmd.install_gem "a", ">= 0"
1026
-
1027
- assert_equal %W[a-3-#{local}], @cmd.installed_specs.map {|spec| spec.full_name }
1028
- end
1029
-
1030
- def test_install_gem_ignore_dependencies_specific_file
1031
- spec = util_spec "a", 2
1032
-
1033
- util_build_gem spec
1034
-
1035
- FileUtils.mv spec.cache_file, @tempdir
1036
-
1037
- @cmd.options[:ignore_dependencies] = true
1038
-
1039
- @cmd.install_gem File.join(@tempdir, spec.file_name), nil
1040
-
1041
- assert_equal %w[a-2], @cmd.installed_specs.map {|s| s.full_name }
1042
- end
1043
-
1044
- def test_parses_requirement_from_gemname
1045
- spec_fetcher do |fetcher|
1046
- fetcher.gem "a", 2
1047
- fetcher.gem "b", 2
1048
- end
1049
-
1050
- @cmd.options[:domain] = :local
1051
-
1052
- req = "a:10.0"
1053
-
1054
- @cmd.options[:args] = [req]
1055
-
1056
- e = nil
1057
- use_ui @ui do
1058
- orig_dir = Dir.pwd
1059
- begin
1060
- Dir.chdir @tempdir
1061
- e = assert_raise Gem::MockGemUi::TermError do
1062
- @cmd.execute
1063
- end
1064
- ensure
1065
- Dir.chdir orig_dir
1066
- end
1067
- end
1068
-
1069
- assert_equal 2, e.exit_code
1070
- assert_match %r{Could not find a valid gem 'a' \(= 10.0\)}, @ui.error
1071
- end
1072
-
1073
- def test_show_errors_on_failure
1074
- Gem.sources.replace ["http://not-there.nothing"]
1075
-
1076
- @cmd.options[:args] = ["blah"]
1077
-
1078
- e = nil
1079
- use_ui @ui do
1080
- orig_dir = Dir.pwd
1081
- begin
1082
- Dir.chdir @tempdir
1083
- e = assert_raise Gem::MockGemUi::TermError do
1084
- @cmd.execute
1085
- end
1086
- ensure
1087
- Dir.chdir orig_dir
1088
- end
1089
- end
1090
-
1091
- assert_equal 2, e.exit_code
1092
-
1093
- assert_match "Unable to download data", @ui.error
1094
- end
1095
-
1096
- def test_show_source_problems_even_on_success
1097
- spec_fetcher do |fetcher|
1098
- fetcher.download "a", 2
1099
- end
1100
-
1101
- Gem.sources << "http://nonexistent.example"
1102
-
1103
- @cmd.options[:args] = %w[a]
1104
-
1105
- use_ui @ui do
1106
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1107
- @cmd.execute
1108
- end
1109
- end
1110
-
1111
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
1112
-
1113
- assert_match "1 gem installed", @ui.output
1114
-
1115
- e = @ui.error
1116
-
1117
- x = "WARNING: Unable to pull data from 'http://nonexistent.example': no data for http://nonexistent.example/specs.4.8.gz (http://nonexistent.example/specs.4.8.gz)\n"
1118
- assert_equal x, e
1119
- end
1120
-
1121
- def test_redact_credentials_from_uri_on_warning
1122
- spec_fetcher do |fetcher|
1123
- fetcher.download "a", 2
1124
- end
1125
-
1126
- Gem.sources << "http://username:SECURE_TOKEN@nonexistent.example"
1127
-
1128
- @cmd.options[:args] = %w[a]
1129
-
1130
- use_ui @ui do
1131
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1132
- @cmd.execute
1133
- end
1134
- end
1135
-
1136
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
1137
-
1138
- assert_match "1 gem installed", @ui.output
1139
-
1140
- e = @ui.error
1141
-
1142
- x = "WARNING: Unable to pull data from 'http://username:REDACTED@nonexistent.example': no data for http://username:REDACTED@nonexistent.example/specs.4.8.gz (http://username:REDACTED@nonexistent.example/specs.4.8.gz)\n"
1143
- assert_equal x, e
1144
- end
1145
-
1146
- def test_execute_uses_from_a_gemdeps
1147
- spec_fetcher do |fetcher|
1148
- fetcher.gem "a", 2
1149
- end
1150
-
1151
- File.open @gemdeps, "w" do |f|
1152
- f << "gem 'a'"
1153
- end
1154
-
1155
- @cmd.options[:gemdeps] = @gemdeps
1156
-
1157
- use_ui @ui do
1158
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1159
- @cmd.execute
1160
- end
1161
- end
1162
-
1163
- assert_equal %w[], @cmd.installed_specs.map {|spec| spec.full_name }
1164
-
1165
- assert_match "Using a (2)", @ui.output
1166
- assert File.exist?("#{@gemdeps}.lock")
1167
- end
1168
-
1169
- def test_execute_uses_from_a_gemdeps_with_no_lock
1170
- spec_fetcher do |fetcher|
1171
- fetcher.gem "a", 2
1172
- end
1173
-
1174
- File.open @gemdeps, "w" do |f|
1175
- f << "gem 'a'"
1176
- end
1177
-
1178
- @cmd.handle_options %w[--no-lock]
1179
- @cmd.options[:gemdeps] = @gemdeps
1180
-
1181
- use_ui @ui do
1182
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1183
- @cmd.execute
1184
- end
1185
- end
1186
-
1187
- assert_equal %w[], @cmd.installed_specs.map {|spec| spec.full_name }
1188
-
1189
- assert_match "Using a (2)", @ui.output
1190
- assert !File.exist?("#{@gemdeps}.lock")
1191
- end
1192
-
1193
- def test_execute_installs_from_a_gemdeps_with_conservative
1194
- spec_fetcher do |fetcher|
1195
- fetcher.download "a", 2
1196
- fetcher.gem "a", 1
1197
- end
1198
-
1199
- File.open @gemdeps, "w" do |f|
1200
- f << "gem 'a'"
1201
- end
1202
-
1203
- @cmd.handle_options %w[--conservative]
1204
- @cmd.options[:gemdeps] = @gemdeps
1205
-
1206
- use_ui @ui do
1207
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1208
- @cmd.execute
1209
- end
1210
- end
1211
-
1212
- assert_equal %w[], @cmd.installed_specs.map {|spec| spec.full_name }
1213
-
1214
- assert_match "Using a (1)", @ui.output
1215
- end
1216
-
1217
- def test_execute_installs_from_a_gemdeps
1218
- spec_fetcher do |fetcher|
1219
- fetcher.download "a", 2
1220
- end
1221
-
1222
- File.open @gemdeps, "w" do |f|
1223
- f << "gem 'a'"
1224
- end
1225
-
1226
- @cmd.options[:gemdeps] = @gemdeps
1227
-
1228
- use_ui @ui do
1229
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1230
- @cmd.execute
1231
- end
1232
- end
1233
-
1234
- assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
1235
-
1236
- assert_match "Installing a (2)", @ui.output
1237
- end
1238
-
1239
- def test_execute_installs_deps_a_gemdeps
1240
- spec_fetcher do |fetcher|
1241
- fetcher.download "q", "1.0"
1242
- fetcher.download "r", "2.0", "q" => nil
1243
- end
1244
-
1245
- File.open @gemdeps, "w" do |f|
1246
- f << "gem 'r'"
1247
- end
1248
-
1249
- @cmd.options[:gemdeps] = @gemdeps
1250
-
1251
- use_ui @ui do
1252
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1253
- @cmd.execute
1254
- end
1255
- end
1256
-
1257
- names = @cmd.installed_specs.map {|spec| spec.full_name }
1258
-
1259
- assert_equal %w[q-1.0 r-2.0], names
1260
-
1261
- assert_match "Installing q (1.0)", @ui.output
1262
- assert_match "Installing r (2.0)", @ui.output
1263
- end
1264
-
1265
- def test_execute_uses_deps_a_gemdeps
1266
- spec_fetcher do |fetcher|
1267
- fetcher.download "r", "2.0", "q" => nil
1268
-
1269
- fetcher.spec "q", "1.0"
1270
- end
1271
-
1272
- File.open @gemdeps, "w" do |f|
1273
- f << "gem 'r'"
1274
- end
1275
-
1276
- @cmd.options[:gemdeps] = @gemdeps
1277
-
1278
- use_ui @ui do
1279
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1280
- @cmd.execute
1281
- end
1282
- end
1283
-
1284
- names = @cmd.installed_specs.map {|spec| spec.full_name }
1285
-
1286
- assert_equal %w[r-2.0], names
1287
-
1288
- assert_match "Using q (1.0)", @ui.output
1289
- assert_match "Installing r (2.0)", @ui.output
1290
- end
1291
-
1292
- def test_execute_installs_deps_a_gemdeps_into_a_path
1293
- spec_fetcher do |fetcher|
1294
- fetcher.download "q", "1.0"
1295
- fetcher.download "r", "2.0", "q" => nil
1296
- end
1297
-
1298
- File.open @gemdeps, "w" do |f|
1299
- f << "gem 'r'"
1300
- end
1301
-
1302
- @cmd.options[:install_dir] = "gf-path"
1303
- @cmd.options[:gemdeps] = @gemdeps
1304
-
1305
- use_ui @ui do
1306
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1307
- @cmd.execute
1308
- end
1309
- end
1310
-
1311
- names = @cmd.installed_specs.map {|spec| spec.full_name }
1312
-
1313
- assert_equal %w[q-1.0 r-2.0], names
1314
-
1315
- assert_match "Installing q (1.0)", @ui.output
1316
- assert_match "Installing r (2.0)", @ui.output
1317
-
1318
- assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
1319
- assert File.file?("gf-path/specifications/r-2.0.gemspec"), "not installed"
1320
- end
1321
-
1322
- def test_execute_with_gemdeps_path_ignores_system
1323
- specs = spec_fetcher do |fetcher|
1324
- fetcher.download "q", "1.0"
1325
- fetcher.download "r", "2.0", "q" => nil
1326
- end
1327
-
1328
- install_specs specs["q-1.0"]
1329
-
1330
- File.open @gemdeps, "w" do |f|
1331
- f << "gem 'r'"
1332
- end
1333
-
1334
- @cmd.options[:install_dir] = "gf-path"
1335
- @cmd.options[:gemdeps] = @gemdeps
1336
-
1337
- use_ui @ui do
1338
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1339
- @cmd.execute
1340
- end
1341
- end
1342
-
1343
- names = @cmd.installed_specs.map {|spec| spec.full_name }
1344
-
1345
- assert_equal %w[q-1.0 r-2.0], names
1346
-
1347
- assert_match "Installing q (1.0)", @ui.output
1348
- assert_match "Installing r (2.0)", @ui.output
1349
-
1350
- assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
1351
- assert File.file?("gf-path/specifications/r-2.0.gemspec"), "not installed"
1352
- end
1353
-
1354
- def test_execute_uses_deps_a_gemdeps_with_a_path
1355
- specs = spec_fetcher do |fetcher|
1356
- fetcher.gem "q", "1.0"
1357
- fetcher.gem "r", "2.0", "q" => nil
1358
- end
1359
-
1360
- i = Gem::Installer.at specs["q-1.0"].cache_file, :install_dir => "gf-path"
1361
- i.install
1362
-
1363
- assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
1364
-
1365
- File.open @gemdeps, "w" do |f|
1366
- f << "gem 'r'"
1367
- end
1368
-
1369
- @cmd.options[:install_dir] = "gf-path"
1370
- @cmd.options[:gemdeps] = @gemdeps
1371
-
1372
- use_ui @ui do
1373
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1374
- @cmd.execute
1375
- end
1376
- end
1377
-
1378
- names = @cmd.installed_specs.map {|spec| spec.full_name }
1379
-
1380
- assert_equal %w[r-2.0], names
1381
-
1382
- assert_match "Using q (1.0)", @ui.output
1383
- assert_match "Installing r (2.0)", @ui.output
1384
- end
1385
-
1386
- def test_handle_options_file
1387
- FileUtils.touch "Gemfile"
1388
-
1389
- @cmd.handle_options %w[-g Gemfile]
1390
-
1391
- assert_equal "Gemfile", @cmd.options[:gemdeps]
1392
-
1393
- FileUtils.rm "Gemfile"
1394
-
1395
- FileUtils.touch "gem.deps.rb"
1396
-
1397
- @cmd.handle_options %w[--file gem.deps.rb]
1398
-
1399
- assert_equal "gem.deps.rb", @cmd.options[:gemdeps]
1400
-
1401
- FileUtils.rm "gem.deps.rb"
1402
-
1403
- FileUtils.touch "Isolate"
1404
-
1405
- @cmd.handle_options %w[-g]
1406
-
1407
- assert_equal "Isolate", @cmd.options[:gemdeps]
1408
-
1409
- FileUtils.touch "Gemfile"
1410
-
1411
- @cmd.handle_options %w[-g]
1412
-
1413
- assert_equal "Gemfile", @cmd.options[:gemdeps]
1414
-
1415
- FileUtils.touch "gem.deps.rb"
1416
-
1417
- @cmd.handle_options %w[-g]
1418
-
1419
- assert_equal "gem.deps.rb", @cmd.options[:gemdeps]
1420
- end
1421
-
1422
- def test_handle_options_suggest
1423
- assert @cmd.options[:suggest_alternate]
1424
-
1425
- @cmd.handle_options %w[--no-suggestions]
1426
-
1427
- refute @cmd.options[:suggest_alternate]
1428
-
1429
- @cmd.handle_options %w[--suggestions]
1430
-
1431
- assert @cmd.options[:suggest_alternate]
1432
- end
1433
-
1434
- def test_handle_options_without
1435
- @cmd.handle_options %w[--without test]
1436
-
1437
- assert_equal [:test], @cmd.options[:without_groups]
1438
-
1439
- @cmd.handle_options %w[--without test,development]
1440
-
1441
- assert_equal [:test, :development], @cmd.options[:without_groups]
1442
- end
1443
-
1444
- def test_explain_platform_local
1445
- local = Gem::Platform.local
1446
- spec_fetcher do |fetcher|
1447
- fetcher.spec "a", 2
1448
-
1449
- fetcher.spec "a", 2 do |s|
1450
- s.platform = local
1451
- end
1452
- end
1453
-
1454
- @cmd.options[:explain] = true
1455
- @cmd.options[:args] = %w[a]
1456
-
1457
- use_ui @ui do
1458
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1459
- @cmd.execute
1460
- end
1461
- end
1462
-
1463
- out = @ui.output.split "\n"
1464
-
1465
- assert_equal "Gems to install:", out.shift
1466
- assert_equal " a-2-#{local}", out.shift
1467
- assert_empty out
1468
- end
1469
-
1470
- def test_explain_platform_local_ignore_dependencies
1471
- local = Gem::Platform.local
1472
- spec_fetcher do |fetcher|
1473
- fetcher.spec "a", 3
1474
-
1475
- fetcher.spec "a", 3 do |s|
1476
- s.platform = local
1477
- end
1478
- end
1479
-
1480
- @cmd.options[:ignore_dependencies] = true
1481
- @cmd.options[:explain] = true
1482
- @cmd.options[:args] = %w[a]
1483
-
1484
- use_ui @ui do
1485
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1486
- @cmd.execute
1487
- end
1488
- end
1489
-
1490
- out = @ui.output.split "\n"
1491
-
1492
- assert_equal "Gems to install:", out.shift
1493
- assert_equal " a-3-#{local}", out.shift
1494
- assert_empty out
1495
- end
1496
-
1497
- def test_explain_platform_ruby
1498
- local = Gem::Platform.local
1499
- spec_fetcher do |fetcher|
1500
- fetcher.spec "a", 2
1501
-
1502
- fetcher.spec "a", 2 do |s|
1503
- s.platform = local
1504
- end
1505
- end
1506
-
1507
- # equivalent to --platform=ruby
1508
- Gem.platforms = [Gem::Platform::RUBY]
1509
-
1510
- @cmd.options[:explain] = true
1511
- @cmd.options[:args] = %w[a]
1512
-
1513
- use_ui @ui do
1514
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1515
- @cmd.execute
1516
- end
1517
- end
1518
-
1519
- out = @ui.output.split "\n"
1520
-
1521
- assert_equal "Gems to install:", out.shift
1522
- assert_equal " a-2", out.shift
1523
- assert_empty out
1524
- end
1525
-
1526
- def test_explain_platform_ruby_ignore_dependencies
1527
- local = Gem::Platform.local
1528
- spec_fetcher do |fetcher|
1529
- fetcher.spec "a", 3
1530
-
1531
- fetcher.spec "a", 3 do |s|
1532
- s.platform = local
1533
- end
1534
- end
1535
-
1536
- # equivalent to --platform=ruby
1537
- Gem.platforms = [Gem::Platform::RUBY]
1538
-
1539
- @cmd.options[:ignore_dependencies] = true
1540
- @cmd.options[:explain] = true
1541
- @cmd.options[:args] = %w[a]
1542
-
1543
- use_ui @ui do
1544
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1545
- @cmd.execute
1546
- end
1547
- end
1548
-
1549
- out = @ui.output.split "\n"
1550
-
1551
- assert_equal "Gems to install:", out.shift
1552
- assert_equal " a-3", out.shift
1553
- assert_empty out
1554
- end
1555
-
1556
- def test_suggest_update_if_enabled
1557
- TestUpdateSuggestion.with_eglible_environment(cmd: @cmd) do
1558
- spec_fetcher do |fetcher|
1559
- fetcher.gem "a", 2
1560
- end
1561
-
1562
- @cmd.options[:args] = %w[a]
1563
-
1564
- use_ui @ui do
1565
- assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
1566
- @cmd.execute
1567
- end
1568
- end
1569
-
1570
- assert_includes @ui.output, "A new release of RubyGems is available: 1.2.3 → 2.0.0!"
1571
- end
1572
- end
1573
- end