rubygems-update 3.3.18 → 3.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +65 -0
  3. data/Manifest.txt +11 -0
  4. data/bin/gem +2 -2
  5. data/bin/update_rubygems +4 -4
  6. data/bundler/CHANGELOG.md +100 -0
  7. data/bundler/UPGRADING.md +11 -4
  8. data/bundler/bundler.gemspec +6 -8
  9. data/bundler/lib/bundler/build_metadata.rb +2 -2
  10. data/bundler/lib/bundler/cli/common.rb +1 -0
  11. data/bundler/lib/bundler/cli/install.rb +5 -2
  12. data/bundler/lib/bundler/cli/outdated.rb +12 -3
  13. data/bundler/lib/bundler/cli/platform.rb +1 -1
  14. data/bundler/lib/bundler/cli.rb +7 -4
  15. data/bundler/lib/bundler/current_ruby.rb +14 -5
  16. data/bundler/lib/bundler/definition.rb +102 -31
  17. data/bundler/lib/bundler/dependency.rb +18 -85
  18. data/bundler/lib/bundler/dsl.rb +2 -2
  19. data/bundler/lib/bundler/endpoint_specification.rb +2 -13
  20. data/bundler/lib/bundler/feature_flag.rb +0 -1
  21. data/bundler/lib/bundler/fetcher.rb +6 -6
  22. data/bundler/lib/bundler/gem_helpers.rb +7 -1
  23. data/bundler/lib/bundler/gem_version_promoter.rb +8 -18
  24. data/bundler/lib/bundler/index.rb +10 -12
  25. data/bundler/lib/bundler/injector.rb +2 -1
  26. data/bundler/lib/bundler/inline.rb +1 -1
  27. data/bundler/lib/bundler/installer/standalone.rb +1 -1
  28. data/bundler/lib/bundler/installer.rb +14 -12
  29. data/bundler/lib/bundler/lazy_specification.rb +30 -23
  30. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  31. data/bundler/lib/bundler/man/bundle-add.1 +6 -2
  32. data/bundler/lib/bundler/man/bundle-add.1.ronn +4 -1
  33. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  34. data/bundler/lib/bundler/man/bundle-cache.1 +7 -1
  35. data/bundler/lib/bundler/man/bundle-cache.1.ronn +7 -0
  36. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-config.1 +25 -6
  39. data/bundler/lib/bundler/man/bundle-config.1.ronn +16 -6
  40. data/bundler/lib/bundler/man/bundle-console.1 +53 -0
  41. data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
  42. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  43. data/bundler/lib/bundler/man/bundle-exec.1 +2 -2
  44. data/bundler/lib/bundler/man/bundle-exec.1.ronn +1 -1
  45. data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
  46. data/bundler/lib/bundler/man/bundle-help.1 +13 -0
  47. data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
  48. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  49. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  50. data/bundler/lib/bundler/man/bundle-inject.1 +5 -2
  51. data/bundler/lib/bundler/man/bundle-inject.1.ronn +3 -1
  52. data/bundler/lib/bundler/man/bundle-install.1 +5 -1
  53. data/bundler/lib/bundler/man/bundle-install.1.ronn +6 -0
  54. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  55. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  56. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  57. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  58. data/bundler/lib/bundler/man/bundle-platform.1 +16 -6
  59. data/bundler/lib/bundler/man/bundle-platform.1.ronn +14 -7
  60. data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
  61. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  62. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  63. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  64. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  65. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  66. data/bundler/lib/bundler/man/bundle-version.1 +35 -0
  67. data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
  68. data/bundler/lib/bundler/man/bundle-viz.1 +4 -1
  69. data/bundler/lib/bundler/man/bundle-viz.1.ronn +2 -0
  70. data/bundler/lib/bundler/man/bundle.1 +15 -10
  71. data/bundler/lib/bundler/man/bundle.1.ronn +12 -7
  72. data/bundler/lib/bundler/man/gemfile.5 +23 -47
  73. data/bundler/lib/bundler/man/gemfile.5.ronn +32 -43
  74. data/bundler/lib/bundler/man/index.txt +4 -0
  75. data/bundler/lib/bundler/match_metadata.rb +13 -0
  76. data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
  77. data/bundler/lib/bundler/plugin.rb +2 -0
  78. data/bundler/lib/bundler/remote_specification.rb +6 -11
  79. data/bundler/lib/bundler/resolver/base.rb +50 -0
  80. data/bundler/lib/bundler/resolver/spec_group.rb +11 -8
  81. data/bundler/lib/bundler/resolver.rb +95 -90
  82. data/bundler/lib/bundler/ruby_dsl.rb +1 -1
  83. data/bundler/lib/bundler/ruby_version.rb +5 -5
  84. data/bundler/lib/bundler/rubygems_ext.rb +52 -1
  85. data/bundler/lib/bundler/rubygems_gem_installer.rb +19 -12
  86. data/bundler/lib/bundler/settings.rb +1 -1
  87. data/bundler/lib/bundler/source/metadata.rb +1 -1
  88. data/bundler/lib/bundler/source_list.rb +4 -0
  89. data/bundler/lib/bundler/spec_set.rb +48 -33
  90. data/bundler/lib/bundler/version.rb +1 -1
  91. data/bundler/lib/bundler.rb +3 -3
  92. data/lib/rubygems/available_set.rb +3 -3
  93. data/lib/rubygems/basic_specification.rb +4 -4
  94. data/lib/rubygems/command.rb +25 -25
  95. data/lib/rubygems/command_manager.rb +9 -9
  96. data/lib/rubygems/commands/build_command.rb +8 -8
  97. data/lib/rubygems/commands/cert_command.rb +33 -33
  98. data/lib/rubygems/commands/check_command.rb +20 -20
  99. data/lib/rubygems/commands/cleanup_command.rb +17 -17
  100. data/lib/rubygems/commands/contents_command.rb +13 -13
  101. data/lib/rubygems/commands/dependency_command.rb +16 -16
  102. data/lib/rubygems/commands/environment_command.rb +5 -5
  103. data/lib/rubygems/commands/fetch_command.rb +8 -8
  104. data/lib/rubygems/commands/generate_index_command.rb +17 -17
  105. data/lib/rubygems/commands/help_command.rb +3 -3
  106. data/lib/rubygems/commands/info_command.rb +3 -3
  107. data/lib/rubygems/commands/install_command.rb +20 -20
  108. data/lib/rubygems/commands/list_command.rb +3 -3
  109. data/lib/rubygems/commands/lock_command.rb +4 -4
  110. data/lib/rubygems/commands/mirror_command.rb +3 -3
  111. data/lib/rubygems/commands/open_command.rb +9 -9
  112. data/lib/rubygems/commands/outdated_command.rb +5 -5
  113. data/lib/rubygems/commands/owner_command.rb +11 -11
  114. data/lib/rubygems/commands/pristine_command.rb +36 -36
  115. data/lib/rubygems/commands/push_command.rb +8 -8
  116. data/lib/rubygems/commands/query_command.rb +8 -8
  117. data/lib/rubygems/commands/rdoc_command.rb +17 -17
  118. data/lib/rubygems/commands/search_command.rb +3 -3
  119. data/lib/rubygems/commands/server_command.rb +3 -3
  120. data/lib/rubygems/commands/setup_command.rb +96 -106
  121. data/lib/rubygems/commands/signin_command.rb +9 -9
  122. data/lib/rubygems/commands/signout_command.rb +7 -7
  123. data/lib/rubygems/commands/sources_command.rb +21 -21
  124. data/lib/rubygems/commands/specification_command.rb +13 -13
  125. data/lib/rubygems/commands/stale_command.rb +2 -2
  126. data/lib/rubygems/commands/uninstall_command.rb +40 -40
  127. data/lib/rubygems/commands/unpack_command.rb +12 -12
  128. data/lib/rubygems/commands/update_command.rb +40 -56
  129. data/lib/rubygems/commands/which_command.rb +7 -7
  130. data/lib/rubygems/commands/yank_command.rb +11 -11
  131. data/lib/rubygems/config_file.rb +21 -21
  132. data/lib/rubygems/core_ext/kernel_gem.rb +1 -1
  133. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  134. data/lib/rubygems/core_ext/kernel_warn.rb +1 -1
  135. data/lib/rubygems/core_ext/tcpsocket_init.rb +1 -1
  136. data/lib/rubygems/defaults.rb +16 -16
  137. data/lib/rubygems/dependency.rb +9 -9
  138. data/lib/rubygems/dependency_installer.rb +13 -13
  139. data/lib/rubygems/dependency_list.rb +6 -6
  140. data/lib/rubygems/doctor.rb +18 -18
  141. data/lib/rubygems/errors.rb +2 -2
  142. data/lib/rubygems/exceptions.rb +5 -5
  143. data/lib/rubygems/ext/build_error.rb +1 -1
  144. data/lib/rubygems/ext/builder.rb +16 -16
  145. data/lib/rubygems/ext/cargo_builder.rb +7 -7
  146. data/lib/rubygems/ext/cmake_builder.rb +2 -2
  147. data/lib/rubygems/ext/configure_builder.rb +1 -1
  148. data/lib/rubygems/ext/ext_conf_builder.rb +8 -8
  149. data/lib/rubygems/ext/rake_builder.rb +3 -3
  150. data/lib/rubygems/ext.rb +7 -7
  151. data/lib/rubygems/gem_runner.rb +5 -5
  152. data/lib/rubygems/gemcutter_utilities.rb +31 -28
  153. data/lib/rubygems/indexer.rb +27 -27
  154. data/lib/rubygems/install_default_message.rb +2 -2
  155. data/lib/rubygems/install_message.rb +2 -2
  156. data/lib/rubygems/install_update_options.rb +55 -55
  157. data/lib/rubygems/installer.rb +32 -40
  158. data/lib/rubygems/installer_uninstaller_utils.rb +2 -2
  159. data/lib/rubygems/local_remote_options.rb +18 -20
  160. data/lib/rubygems/mock_gem_ui.rb +2 -2
  161. data/lib/rubygems/name_tuple.rb +4 -4
  162. data/lib/rubygems/optparse.rb +1 -1
  163. data/lib/rubygems/package/file_source.rb +2 -2
  164. data/lib/rubygems/package/old.rb +8 -8
  165. data/lib/rubygems/package/tar_header.rb +50 -50
  166. data/lib/rubygems/package/tar_reader/entry.rb +2 -2
  167. data/lib/rubygems/package/tar_reader.rb +1 -1
  168. data/lib/rubygems/package/tar_writer.rb +7 -7
  169. data/lib/rubygems/package.rb +54 -43
  170. data/lib/rubygems/package_task.rb +4 -4
  171. data/lib/rubygems/platform.rb +66 -55
  172. data/lib/rubygems/psych_tree.rb +1 -1
  173. data/lib/rubygems/query_utils.rb +35 -35
  174. data/lib/rubygems/rdoc.rb +2 -2
  175. data/lib/rubygems/remote_fetcher.rb +22 -22
  176. data/lib/rubygems/request/connection_pools.rb +4 -4
  177. data/lib/rubygems/request/http_pool.rb +1 -1
  178. data/lib/rubygems/request.rb +22 -22
  179. data/lib/rubygems/request_set/gem_dependency_api.rb +18 -18
  180. data/lib/rubygems/request_set/lockfile/parser.rb +26 -26
  181. data/lib/rubygems/request_set/lockfile/tokenizer.rb +4 -4
  182. data/lib/rubygems/request_set/lockfile.rb +5 -5
  183. data/lib/rubygems/request_set.rb +17 -17
  184. data/lib/rubygems/requirement.rb +6 -6
  185. data/lib/rubygems/resolver/activation_request.rb +3 -3
  186. data/lib/rubygems/resolver/api_set.rb +4 -4
  187. data/lib/rubygems/resolver/api_specification.rb +6 -6
  188. data/lib/rubygems/resolver/best_set.rb +5 -5
  189. data/lib/rubygems/resolver/conflict.rb +10 -10
  190. data/lib/rubygems/resolver/dependency_request.rb +2 -2
  191. data/lib/rubygems/resolver/git_set.rb +2 -2
  192. data/lib/rubygems/resolver/git_specification.rb +6 -6
  193. data/lib/rubygems/resolver/index_set.rb +3 -3
  194. data/lib/rubygems/resolver/index_specification.rb +6 -5
  195. data/lib/rubygems/resolver/installed_specification.rb +4 -4
  196. data/lib/rubygems/resolver/installer_set.rb +11 -16
  197. data/lib/rubygems/resolver/local_specification.rb +2 -2
  198. data/lib/rubygems/resolver/lock_set.rb +4 -4
  199. data/lib/rubygems/resolver/lock_specification.rb +4 -4
  200. data/lib/rubygems/resolver/molinillo.rb +1 -1
  201. data/lib/rubygems/resolver/specification.rb +1 -1
  202. data/lib/rubygems/resolver/vendor_set.rb +1 -1
  203. data/lib/rubygems/resolver/vendor_specification.rb +3 -3
  204. data/lib/rubygems/resolver.rb +39 -39
  205. data/lib/rubygems/s3_uri_signer.rb +6 -6
  206. data/lib/rubygems/safe_yaml.rb +2 -2
  207. data/lib/rubygems/security/policies.rb +11 -11
  208. data/lib/rubygems/security/policy.rb +18 -18
  209. data/lib/rubygems/security/signer.rb +5 -5
  210. data/lib/rubygems/security/trust_dir.rb +3 -3
  211. data/lib/rubygems/security.rb +28 -28
  212. data/lib/rubygems/security_option.rb +5 -5
  213. data/lib/rubygems/source/git.rb +21 -21
  214. data/lib/rubygems/source/installed.rb +1 -1
  215. data/lib/rubygems/source/local.rb +2 -2
  216. data/lib/rubygems/source/specific_file.rb +1 -1
  217. data/lib/rubygems/source.rb +16 -16
  218. data/lib/rubygems/spec_fetcher.rb +9 -9
  219. data/lib/rubygems/specification.rb +63 -62
  220. data/lib/rubygems/specification_policy.rb +15 -15
  221. data/lib/rubygems/stub_specification.rb +5 -5
  222. data/lib/rubygems/tsort.rb +1 -1
  223. data/lib/rubygems/uninstaller.rb +18 -18
  224. data/lib/rubygems/uri.rb +4 -4
  225. data/lib/rubygems/uri_formatter.rb +1 -1
  226. data/lib/rubygems/user_interaction.rb +33 -19
  227. data/lib/rubygems/util/licenses.rb +3 -3
  228. data/lib/rubygems/util.rb +10 -10
  229. data/lib/rubygems/validator.rb +5 -5
  230. data/lib/rubygems/version.rb +15 -9
  231. data/lib/rubygems/version_option.rb +3 -3
  232. data/lib/rubygems.rb +62 -61
  233. data/rubygems-update.gemspec +2 -2
  234. data/setup.rb +9 -9
  235. data/test/rubygems/helper.rb +132 -134
  236. data/test/rubygems/installer_test_case.rb +13 -13
  237. data/test/rubygems/package/tar_test_case.rb +2 -2
  238. data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
  239. data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
  240. data/test/rubygems/rubygems_plugin.rb +2 -2
  241. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +4 -4
  242. data/test/rubygems/test_bundled_ca.rb +10 -10
  243. data/test/rubygems/test_config.rb +3 -3
  244. data/test/rubygems/test_deprecate.rb +3 -3
  245. data/test/rubygems/test_exit.rb +2 -2
  246. data/test/rubygems/test_gem.rb +342 -342
  247. data/test/rubygems/test_gem_available_set.rb +21 -21
  248. data/test/rubygems/test_gem_bundler_version_finder.rb +1 -1
  249. data/test/rubygems/test_gem_command.rb +44 -44
  250. data/test/rubygems/test_gem_command_manager.rb +29 -29
  251. data/test/rubygems/test_gem_commands_build_command.rb +63 -63
  252. data/test/rubygems/test_gem_commands_cert_command.rb +97 -99
  253. data/test/rubygems/test_gem_commands_check_command.rb +4 -4
  254. data/test/rubygems/test_gem_commands_cleanup_command.rb +40 -40
  255. data/test/rubygems/test_gem_commands_contents_command.rb +27 -27
  256. data/test/rubygems/test_gem_commands_dependency_command.rb +36 -36
  257. data/test/rubygems/test_gem_commands_environment_command.rb +16 -16
  258. data/test/rubygems/test_gem_commands_fetch_command.rb +37 -37
  259. data/test/rubygems/test_gem_commands_generate_index_command.rb +7 -7
  260. data/test/rubygems/test_gem_commands_help_command.rb +13 -13
  261. data/test/rubygems/test_gem_commands_info_command.rb +28 -2
  262. data/test/rubygems/test_gem_commands_install_command.rb +131 -131
  263. data/test/rubygems/test_gem_commands_list_command.rb +4 -4
  264. data/test/rubygems/test_gem_commands_lock_command.rb +10 -10
  265. data/test/rubygems/test_gem_commands_mirror.rb +2 -2
  266. data/test/rubygems/test_gem_commands_open_command.rb +4 -4
  267. data/test/rubygems/test_gem_commands_outdated_command.rb +9 -9
  268. data/test/rubygems/test_gem_commands_owner_command.rb +41 -41
  269. data/test/rubygems/test_gem_commands_pristine_command.rb +92 -92
  270. data/test/rubygems/test_gem_commands_push_command.rb +54 -54
  271. data/test/rubygems/test_gem_commands_query_command.rb +73 -73
  272. data/test/rubygems/test_gem_commands_search_command.rb +2 -2
  273. data/test/rubygems/test_gem_commands_server_command.rb +2 -2
  274. data/test/rubygems/test_gem_commands_setup_command.rb +119 -85
  275. data/test/rubygems/test_gem_commands_signin_command.rb +45 -31
  276. data/test/rubygems/test_gem_commands_signout_command.rb +3 -3
  277. data/test/rubygems/test_gem_commands_sources_command.rb +28 -29
  278. data/test/rubygems/test_gem_commands_specification_command.rb +32 -32
  279. data/test/rubygems/test_gem_commands_stale_command.rb +4 -4
  280. data/test/rubygems/test_gem_commands_uninstall_command.rb +75 -75
  281. data/test/rubygems/test_gem_commands_unpack_command.rb +31 -31
  282. data/test/rubygems/test_gem_commands_update_command.rb +89 -89
  283. data/test/rubygems/test_gem_commands_which_command.rb +6 -6
  284. data/test/rubygems/test_gem_commands_yank_command.rb +40 -40
  285. data/test/rubygems/test_gem_config_file.rb +93 -81
  286. data/test/rubygems/test_gem_dependency.rb +73 -73
  287. data/test/rubygems/test_gem_dependency_installer.rb +165 -165
  288. data/test/rubygems/test_gem_dependency_list.rb +47 -47
  289. data/test/rubygems/test_gem_dependency_resolution_error.rb +4 -4
  290. data/test/rubygems/test_gem_doctor.rb +26 -26
  291. data/test/rubygems/test_gem_ext_builder.rb +59 -59
  292. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +6 -6
  293. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
  294. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +8 -8
  295. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +1 -1
  296. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +6 -6
  297. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
  298. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +8 -8
  299. data/test/rubygems/test_gem_ext_cargo_builder.rb +26 -26
  300. data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +3 -3
  301. data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +23 -23
  302. data/test/rubygems/test_gem_ext_cmake_builder.rb +15 -15
  303. data/test/rubygems/test_gem_ext_configure_builder.rb +13 -13
  304. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +51 -52
  305. data/test/rubygems/test_gem_ext_rake_builder.rb +15 -15
  306. data/test/rubygems/test_gem_gem_runner.rb +7 -7
  307. data/test/rubygems/test_gem_gemcutter_utilities.rb +66 -66
  308. data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -4
  309. data/test/rubygems/test_gem_indexer.rb +48 -48
  310. data/test/rubygems/test_gem_install_update_options.rb +16 -16
  311. data/test/rubygems/test_gem_installer.rb +303 -300
  312. data/test/rubygems/test_gem_local_remote_options.rb +10 -10
  313. data/test/rubygems/test_gem_name_tuple.rb +4 -4
  314. data/test/rubygems/test_gem_package.rb +228 -206
  315. data/test/rubygems/test_gem_package_old.rb +13 -13
  316. data/test/rubygems/test_gem_package_tar_header.rb +42 -42
  317. data/test/rubygems/test_gem_package_tar_reader.rb +8 -8
  318. data/test/rubygems/test_gem_package_tar_reader_entry.rb +10 -10
  319. data/test/rubygems/test_gem_package_tar_writer.rb +76 -76
  320. data/test/rubygems/test_gem_package_task.rb +18 -18
  321. data/test/rubygems/test_gem_path_support.rb +14 -14
  322. data/test/rubygems/test_gem_platform.rb +298 -227
  323. data/test/rubygems/test_gem_rdoc.rb +14 -14
  324. data/test/rubygems/test_gem_remote_fetcher.rb +149 -149
  325. data/test/rubygems/test_gem_request.rb +55 -55
  326. data/test/rubygems/test_gem_request_connection_pools.rb +29 -29
  327. data/test/rubygems/test_gem_request_set.rb +99 -99
  328. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +204 -206
  329. data/test/rubygems/test_gem_request_set_lockfile.rb +86 -86
  330. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +56 -56
  331. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +62 -62
  332. data/test/rubygems/test_gem_requirement.rb +47 -41
  333. data/test/rubygems/test_gem_resolver.rb +133 -99
  334. data/test/rubygems/test_gem_resolver_activation_request.rb +6 -6
  335. data/test/rubygems/test_gem_resolver_api_set.rb +33 -33
  336. data/test/rubygems/test_gem_resolver_api_specification.rb +47 -47
  337. data/test/rubygems/test_gem_resolver_best_set.rb +22 -22
  338. data/test/rubygems/test_gem_resolver_composed_set.rb +1 -1
  339. data/test/rubygems/test_gem_resolver_conflict.rb +12 -12
  340. data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -15
  341. data/test/rubygems/test_gem_resolver_git_set.rb +21 -21
  342. data/test/rubygems/test_gem_resolver_git_specification.rb +21 -21
  343. data/test/rubygems/test_gem_resolver_index_set.rb +12 -12
  344. data/test/rubygems/test_gem_resolver_index_specification.rb +16 -16
  345. data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -5
  346. data/test/rubygems/test_gem_resolver_installer_set.rb +78 -34
  347. data/test/rubygems/test_gem_resolver_local_specification.rb +7 -7
  348. data/test/rubygems/test_gem_resolver_lock_set.rb +12 -12
  349. data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -17
  350. data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -1
  351. data/test/rubygems/test_gem_resolver_specification.rb +8 -8
  352. data/test/rubygems/test_gem_resolver_vendor_set.rb +6 -6
  353. data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -10
  354. data/test/rubygems/test_gem_security.rb +67 -67
  355. data/test/rubygems/test_gem_security_policy.rb +62 -62
  356. data/test/rubygems/test_gem_security_signer.rb +28 -28
  357. data/test/rubygems/test_gem_security_trust_dir.rb +4 -4
  358. data/test/rubygems/test_gem_silent_ui.rb +38 -32
  359. data/test/rubygems/test_gem_source.rb +44 -44
  360. data/test/rubygems/test_gem_source_fetch_problem.rb +9 -9
  361. data/test/rubygems/test_gem_source_git.rb +59 -59
  362. data/test/rubygems/test_gem_source_installed.rb +16 -16
  363. data/test/rubygems/test_gem_source_list.rb +5 -5
  364. data/test/rubygems/test_gem_source_local.rb +14 -14
  365. data/test/rubygems/test_gem_source_lock.rb +31 -31
  366. data/test/rubygems/test_gem_source_specific_file.rb +17 -17
  367. data/test/rubygems/test_gem_source_subpath_problem.rb +7 -7
  368. data/test/rubygems/test_gem_source_vendor.rb +13 -13
  369. data/test/rubygems/test_gem_spec_fetcher.rb +72 -72
  370. data/test/rubygems/test_gem_specification.rb +444 -436
  371. data/test/rubygems/test_gem_stream_ui.rb +19 -19
  372. data/test/rubygems/test_gem_stub_specification.rb +32 -32
  373. data/test/rubygems/test_gem_text.rb +1 -1
  374. data/test/rubygems/test_gem_uninstaller.rb +112 -112
  375. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -3
  376. data/test/rubygems/test_gem_uri.rb +4 -4
  377. data/test/rubygems/test_gem_uri_formatter.rb +14 -14
  378. data/test/rubygems/test_gem_util.rb +23 -23
  379. data/test/rubygems/test_gem_validator.rb +8 -8
  380. data/test/rubygems/test_gem_version.rb +22 -15
  381. data/test/rubygems/test_gem_version_option.rb +15 -15
  382. data/test/rubygems/test_kernel.rb +31 -31
  383. data/test/rubygems/test_project_sanity.rb +1 -1
  384. data/test/rubygems/test_remote_fetch_error.rb +6 -6
  385. data/test/rubygems/test_require.rb +43 -43
  386. data/test/rubygems/test_rubygems.rb +8 -8
  387. data/test/rubygems/utilities.rb +19 -19
  388. metadata +14 -3
@@ -12,7 +12,7 @@ class Gem::Platform
12
12
  attr_accessor :cpu, :os, :version
13
13
 
14
14
  def self.local
15
- arch = RbConfig::CONFIG['arch']
15
+ arch = RbConfig::CONFIG["arch"]
16
16
  arch = "#{arch}_60" if arch =~ /mswin(?:32|64)$/
17
17
  @local ||= new(arch)
18
18
  end
@@ -23,9 +23,9 @@ class Gem::Platform
23
23
 
24
24
  def self.match_platforms?(platform, platforms)
25
25
  platforms.any? do |local_platform|
26
- platform.nil? or
27
- local_platform == platform or
28
- (local_platform != Gem::Platform::RUBY and local_platform =~ platform)
26
+ platform.nil? ||
27
+ local_platform == platform ||
28
+ (local_platform != Gem::Platform::RUBY && platform =~ local_platform)
29
29
  end
30
30
  end
31
31
  private_class_method :match_platforms?
@@ -56,7 +56,7 @@ class Gem::Platform
56
56
  case arch
57
57
  when Gem::Platform::CURRENT then
58
58
  Gem::Platform.local
59
- when Gem::Platform::RUBY, nil, '' then
59
+ when Gem::Platform::RUBY, nil, "" then
60
60
  Gem::Platform::RUBY
61
61
  else
62
62
  super
@@ -68,9 +68,9 @@ class Gem::Platform
68
68
  when Array then
69
69
  @cpu, @os, @version = arch
70
70
  when String then
71
- arch = arch.split '-'
71
+ arch = arch.split "-"
72
72
 
73
- if arch.length > 2 and arch.last !~ /\d/ # reassemble x86-linux-gnu
73
+ if arch.length > 2 && arch.last !~ /\d+(\.\d+)?$/ # reassemble x86-linux-{libc}
74
74
  extra = arch.pop
75
75
  arch.last << "-#{extra}"
76
76
  end
@@ -78,11 +78,11 @@ class Gem::Platform
78
78
  cpu = arch.shift
79
79
 
80
80
  @cpu = case cpu
81
- when /i\d86/ then 'x86'
81
+ when /i\d86/ then "x86"
82
82
  else cpu
83
83
  end
84
84
 
85
- if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/ # for command-line
85
+ if arch.length == 2 && arch.last =~ /^\d+(\.\d+)?$/ # for command-line
86
86
  @os, @version = arch
87
87
  return
88
88
  end
@@ -91,31 +91,31 @@ class Gem::Platform
91
91
  @cpu, os = nil, cpu if os.nil? # legacy jruby
92
92
 
93
93
  @os, @version = case os
94
- when /aix(\d+)?/ then [ 'aix', $1 ]
95
- when /cygwin/ then [ 'cygwin', nil ]
96
- when /darwin(\d+)?/ then [ 'darwin', $1 ]
97
- when /^macruby$/ then [ 'macruby', nil ]
98
- when /freebsd(\d+)?/ then [ 'freebsd', $1 ]
99
- when /hpux(\d+)?/ then [ 'hpux', $1 ]
100
- when /^java$/, /^jruby$/ then [ 'java', nil ]
101
- when /^java([\d.]*)/ then [ 'java', $1 ]
102
- when /^dalvik(\d+)?$/ then [ 'dalvik', $1 ]
103
- when /^dotnet$/ then [ 'dotnet', nil ]
104
- when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
105
- when /linux-?((?!gnu)\w+)?/ then [ 'linux', $1 ]
106
- when /mingw32/ then [ 'mingw32', nil ]
107
- when /mingw-?(\w+)?/ then [ 'mingw', $1 ]
94
+ when /aix(\d+)?/ then [ "aix", $1 ]
95
+ when /cygwin/ then [ "cygwin", nil ]
96
+ when /darwin(\d+)?/ then [ "darwin", $1 ]
97
+ when /^macruby$/ then [ "macruby", nil ]
98
+ when /freebsd(\d+)?/ then [ "freebsd", $1 ]
99
+ when /hpux(\d+)?/ then [ "hpux", $1 ]
100
+ when /^java$/, /^jruby$/ then [ "java", nil ]
101
+ when /^java([\d.]*)/ then [ "java", $1 ]
102
+ when /^dalvik(\d+)?$/ then [ "dalvik", $1 ]
103
+ when /^dotnet$/ then [ "dotnet", nil ]
104
+ when /^dotnet([\d.]*)/ then [ "dotnet", $1 ]
105
+ when /linux-?(\w+)?/ then [ "linux", $1 ]
106
+ when /mingw32/ then [ "mingw32", nil ]
107
+ when /mingw-?(\w+)?/ then [ "mingw", $1 ]
108
108
  when /(mswin\d+)(\_(\d+))?/ then
109
109
  os, version = $1, $3
110
- @cpu = 'x86' if @cpu.nil? and os =~ /32$/
110
+ @cpu = "x86" if @cpu.nil? && os =~ /32$/
111
111
  [os, version]
112
- when /netbsdelf/ then [ 'netbsdelf', nil ]
113
- when /openbsd(\d+\.\d+)?/ then [ 'openbsd', $1 ]
114
- when /bitrig(\d+\.\d+)?/ then [ 'bitrig', $1 ]
115
- when /solaris(\d+\.\d+)?/ then [ 'solaris', $1 ]
112
+ when /netbsdelf/ then [ "netbsdelf", nil ]
113
+ when /openbsd(\d+\.\d+)?/ then [ "openbsd", $1 ]
114
+ when /bitrig(\d+\.\d+)?/ then [ "bitrig", $1 ]
115
+ when /solaris(\d+\.\d+)?/ then [ "solaris", $1 ]
116
116
  # test
117
117
  when /^(\w+_platform)(\d+)?/ then [ $1, $2 ]
118
- else [ 'unknown', nil ]
118
+ else [ "unknown", nil ]
119
119
  end
120
120
  when Gem::Platform then
121
121
  @cpu = arch.cpu
@@ -131,7 +131,7 @@ class Gem::Platform
131
131
  end
132
132
 
133
133
  def to_s
134
- to_a.compact.join '-'
134
+ to_a.compact.join "-"
135
135
  end
136
136
 
137
137
  ##
@@ -139,7 +139,7 @@ class Gem::Platform
139
139
  # the same CPU, OS and version.
140
140
 
141
141
  def ==(other)
142
- self.class === other and to_a == other.to_a
142
+ self.class === other && to_a == other.to_a
143
143
  end
144
144
 
145
145
  alias :eql? :==
@@ -151,27 +151,38 @@ class Gem::Platform
151
151
  ##
152
152
  # Does +other+ match this platform? Two platforms match if they have the
153
153
  # same CPU, or either has a CPU of 'universal', they have the same OS, and
154
- # they have the same version, or either has no version.
154
+ # they have the same version, or either one has no version
155
155
  #
156
156
  # Additionally, the platform will match if the local CPU is 'arm' and the
157
157
  # other CPU starts with "arm" (for generic ARM family support).
158
+ #
159
+ # Of note, this method is not commutative. Indeed the OS 'linux' has a
160
+ # special case: the version is the libc name, yet while "no version" stands
161
+ # as a wildcard for a binary gem platform (as for other OSes), for the
162
+ # runtime platform "no version" stands for 'gnu'. To be able to disinguish
163
+ # these, the method receiver is the gem platform, while the argument is
164
+ # the runtime platform.
158
165
 
159
166
  def ===(other)
160
167
  return nil unless Gem::Platform === other
161
168
 
162
169
  # universal-mingw32 matches x64-mingw-ucrt
163
- return true if (@cpu == 'universal' or other.cpu == 'universal') and
164
- @os.start_with?('mingw') and other.os.start_with?('mingw')
170
+ return true if (@cpu == "universal" || other.cpu == "universal") &&
171
+ @os.start_with?("mingw") && other.os.start_with?("mingw")
165
172
 
166
173
  # cpu
167
- ([nil,'universal'].include?(@cpu) or [nil, 'universal'].include?(other.cpu) or @cpu == other.cpu or
168
- (@cpu == 'arm' and other.cpu.start_with?("arm"))) and
169
-
170
- # os
171
- @os == other.os and
172
-
173
- # version
174
- (@version.nil? or other.version.nil? or @version == other.version)
174
+ ([nil,"universal"].include?(@cpu) || [nil, "universal"].include?(other.cpu) || @cpu == other.cpu ||
175
+ (@cpu == "arm" && other.cpu.start_with?("arm"))) &&
176
+
177
+ # os
178
+ @os == other.os &&
179
+
180
+ # version
181
+ (
182
+ (@os != "linux" && (@version.nil? || other.version.nil?)) ||
183
+ (@os == "linux" && (other.version == "gnu#{@version}" || other.version == "musl#{@version}" || @version == "gnu#{other.version}")) ||
184
+ @version == other.version
185
+ )
175
186
  end
176
187
 
177
188
  ##
@@ -184,17 +195,17 @@ class Gem::Platform
184
195
  when String then
185
196
  # This data is from http://gems.rubyforge.org/gems/yaml on 19 Aug 2007
186
197
  other = case other
187
- when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ]
188
- when /^i\d86-linux/ then ['x86', 'linux', nil ]
189
- when 'java', 'jruby' then [nil, 'java', nil ]
190
- when /^dalvik(\d+)?$/ then [nil, 'dalvik', $1 ]
191
- when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ]
192
- when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ]
193
- when /mswin64(\_(\d+))?/ then ['x64', 'mswin64', $2 ]
194
- when 'powerpc-darwin' then ['powerpc', 'darwin', nil ]
195
- when /powerpc-darwin(\d)/ then ['powerpc', 'darwin', $1 ]
196
- when /sparc-solaris2.8/ then ['sparc', 'solaris', '2.8' ]
197
- when /universal-darwin(\d)/ then ['universal', 'darwin', $1 ]
198
+ when /^i686-darwin(\d)/ then ["x86", "darwin", $1 ]
199
+ when /^i\d86-linux/ then ["x86", "linux", nil ]
200
+ when "java", "jruby" then [nil, "java", nil ]
201
+ when /^dalvik(\d+)?$/ then [nil, "dalvik", $1 ]
202
+ when /dotnet(\-(\d+\.\d+))?/ then ["universal","dotnet", $2 ]
203
+ when /mswin32(\_(\d+))?/ then ["x86", "mswin32", $2 ]
204
+ when /mswin64(\_(\d+))?/ then ["x64", "mswin64", $2 ]
205
+ when "powerpc-darwin" then ["powerpc", "darwin", nil ]
206
+ when /powerpc-darwin(\d)/ then ["powerpc", "darwin", $1 ]
207
+ when /sparc-solaris2.8/ then ["sparc", "solaris", "2.8" ]
208
+ when /universal-darwin(\d)/ then ["universal", "darwin", $1 ]
198
209
  else other
199
210
  end
200
211
 
@@ -210,11 +221,11 @@ class Gem::Platform
210
221
  # A pure-Ruby gem that may use Gem::Specification#extensions to build
211
222
  # binary files.
212
223
 
213
- RUBY = 'ruby'.freeze
224
+ RUBY = "ruby".freeze
214
225
 
215
226
  ##
216
227
  # A platform-specific gem that is built for the packaging Ruby's platform.
217
228
  # This will be replaced with Gem::Platform::local.
218
229
 
219
- CURRENT = 'current'.freeze
230
+ CURRENT = "current".freeze
220
231
  end
@@ -7,7 +7,7 @@ module Gem
7
7
  end unless respond_to? :create
8
8
 
9
9
  def visit_String(str)
10
- return super unless str == '=' # or whatever you want
10
+ return super unless str == "=" # or whatever you want
11
11
 
12
12
  quote = Psych::Nodes::Scalar::SINGLE_QUOTED
13
13
  @emitter.scalar str, nil, nil, false, true, quote
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'local_remote_options'
4
- require_relative 'spec_fetcher'
5
- require_relative 'version_option'
6
- require_relative 'text'
3
+ require_relative "local_remote_options"
4
+ require_relative "spec_fetcher"
5
+ require_relative "version_option"
6
+ require_relative "text"
7
7
 
8
8
  module Gem::QueryUtils
9
9
 
@@ -12,41 +12,41 @@ module Gem::QueryUtils
12
12
  include Gem::VersionOption
13
13
 
14
14
  def add_query_options
15
- add_option('-i', '--[no-]installed',
16
- 'Check for installed gem') do |value, options|
15
+ add_option("-i", "--[no-]installed",
16
+ "Check for installed gem") do |value, options|
17
17
  options[:installed] = value
18
18
  end
19
19
 
20
- add_option('-I', 'Equivalent to --no-installed') do |value, options|
20
+ add_option("-I", "Equivalent to --no-installed") do |value, options|
21
21
  options[:installed] = false
22
22
  end
23
23
 
24
24
  add_version_option command, "for use with --installed"
25
25
 
26
- add_option('-d', '--[no-]details',
27
- 'Display detailed information of gem(s)') do |value, options|
26
+ add_option("-d", "--[no-]details",
27
+ "Display detailed information of gem(s)") do |value, options|
28
28
  options[:details] = value
29
29
  end
30
30
 
31
- add_option('--[no-]versions',
32
- 'Display only gem names') do |value, options|
31
+ add_option("--[no-]versions",
32
+ "Display only gem names") do |value, options|
33
33
  options[:versions] = value
34
34
  options[:details] = false unless value
35
35
  end
36
36
 
37
- add_option('-a', '--all',
38
- 'Display all gem versions') do |value, options|
37
+ add_option("-a", "--all",
38
+ "Display all gem versions") do |value, options|
39
39
  options[:all] = value
40
40
  end
41
41
 
42
- add_option('-e', '--exact',
43
- 'Name of gem(s) to query on matches the',
44
- 'provided STRING') do |value, options|
42
+ add_option("-e", "--exact",
43
+ "Name of gem(s) to query on matches the",
44
+ "provided STRING") do |value, options|
45
45
  options[:exact] = value
46
46
  end
47
47
 
48
- add_option('--[no-]prerelease',
49
- 'Display prerelease versions') do |value, options|
48
+ add_option("--[no-]prerelease",
49
+ "Display prerelease versions") do |value, options|
50
50
  options[:prerelease] = value
51
51
  end
52
52
 
@@ -112,7 +112,7 @@ module Gem::QueryUtils
112
112
  end
113
113
 
114
114
  def display_header(type)
115
- if (ui.outs.tty? and Gem.configuration.verbose) or both?
115
+ if (ui.outs.tty? && Gem.configuration.verbose) || both?
116
116
  say
117
117
  say "*** #{type} GEMS ***"
118
118
  say
@@ -132,7 +132,7 @@ module Gem::QueryUtils
132
132
  name_matches = name ? s.name =~ name : true
133
133
  version_matches = show_prereleases? || !s.version.prerelease?
134
134
 
135
- name_matches and version_matches
135
+ name_matches && version_matches
136
136
  end
137
137
 
138
138
  spec_tuples = specs.map do |spec|
@@ -151,7 +151,7 @@ module Gem::QueryUtils
151
151
  fetcher.detect(specs_type) { true }
152
152
  else
153
153
  fetcher.detect(specs_type) do |name_tuple|
154
- name === name_tuple.name
154
+ name === name_tuple.name && options[:version].satisfied_by?(name_tuple.version)
155
155
  end
156
156
  end
157
157
 
@@ -159,7 +159,7 @@ module Gem::QueryUtils
159
159
  end
160
160
 
161
161
  def specs_type
162
- if options[:all]
162
+ if options[:all] || options[:version].specific?
163
163
  if options[:prerelease]
164
164
  :complete
165
165
  else
@@ -176,7 +176,7 @@ module Gem::QueryUtils
176
176
  # Check if gem +name+ version +version+ is installed.
177
177
 
178
178
  def installed?(name, req = Gem::Requirement.default)
179
- Gem::Specification.any? {|s| s.name =~ name and req =~ s.version }
179
+ Gem::Specification.any? {|s| s.name =~ name && req =~ s.version }
180
180
  end
181
181
 
182
182
  def output_query_results(spec_tuples)
@@ -242,7 +242,7 @@ module Gem::QueryUtils
242
242
  return unless options[:versions]
243
243
 
244
244
  list =
245
- if platforms.empty? or options[:details]
245
+ if platforms.empty? || options[:details]
246
246
  name_tuples.map {|n| n.version }.uniq
247
247
  else
248
248
  platforms.sort.reverse.map do |version, pls|
@@ -257,7 +257,7 @@ module Gem::QueryUtils
257
257
 
258
258
  if pls != [Gem::Platform::RUBY]
259
259
  platform_list = [pls.delete(Gem::Platform::RUBY), *pls.sort].compact
260
- out = platform_list.unshift(out).join(' ')
260
+ out = platform_list.unshift(out).join(" ")
261
261
  end
262
262
 
263
263
  out
@@ -284,21 +284,21 @@ module Gem::QueryUtils
284
284
 
285
285
  def spec_authors(entry, spec)
286
286
  authors = "Author#{spec.authors.length > 1 ? 's' : ''}: ".dup
287
- authors << spec.authors.join(', ')
287
+ authors << spec.authors.join(", ")
288
288
  entry << format_text(authors, 68, 4)
289
289
  end
290
290
 
291
291
  def spec_homepage(entry, spec)
292
- return if spec.homepage.nil? or spec.homepage.empty?
292
+ return if spec.homepage.nil? || spec.homepage.empty?
293
293
 
294
294
  entry << "\n" << format_text("Homepage: #{spec.homepage}", 68, 4)
295
295
  end
296
296
 
297
297
  def spec_license(entry, spec)
298
- return if spec.license.nil? or spec.license.empty?
298
+ return if spec.license.nil? || spec.license.empty?
299
299
 
300
300
  licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: ".dup
301
- licenses << spec.licenses.join(', ')
301
+ licenses << spec.licenses.join(", ")
302
302
  entry << "\n" << format_text(licenses, 68, 4)
303
303
  end
304
304
 
@@ -306,15 +306,15 @@ module Gem::QueryUtils
306
306
  return unless spec.loaded_from
307
307
 
308
308
  if specs.length == 1
309
- default = spec.default_gem? ? ' (default)' : nil
309
+ default = spec.default_gem? ? " (default)" : nil
310
310
  entry << "\n" << " Installed at#{default}: #{spec.base_dir}"
311
311
  else
312
- label = 'Installed at'
312
+ label = "Installed at"
313
313
  specs.each do |s|
314
314
  version = s.version.to_s
315
- version << ', default' if s.default_gem?
315
+ version << ", default" if s.default_gem?
316
316
  entry << "\n" << " #{label} (#{version}): #{s.base_dir}"
317
- label = ' ' * label.length
317
+ label = " " * label.length
318
318
  end
319
319
  end
320
320
  end
@@ -327,7 +327,7 @@ module Gem::QueryUtils
327
327
  return unless non_ruby
328
328
 
329
329
  if platforms.length == 1
330
- title = platforms.values.length == 1 ? 'Platform' : 'Platforms'
330
+ title = platforms.values.length == 1 ? "Platform" : "Platforms"
331
331
  entry << " #{title}: #{platforms.values.sort.join(', ')}\n"
332
332
  else
333
333
  entry << " Platforms:\n"
@@ -336,7 +336,7 @@ module Gem::QueryUtils
336
336
 
337
337
  sorted_platforms.each do |version, pls|
338
338
  label = " #{version}: "
339
- data = format_text pls.sort.join(', '), 68, label.length
339
+ data = format_text pls.sort.join(", "), 68, label.length
340
340
  data[0, label.length] = label
341
341
  entry << data << "\n"
342
342
  end
data/lib/rubygems/rdoc.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
- require_relative '../rubygems'
2
+ require_relative "../rubygems"
3
3
 
4
4
  begin
5
- require 'rdoc/rubygems_hook'
5
+ require "rdoc/rubygems_hook"
6
6
  module Gem
7
7
  RDoc = ::RDoc::RubygemsHook
8
8
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
- require_relative '../rubygems'
3
- require_relative 'request'
4
- require_relative 'request/connection_pools'
5
- require_relative 's3_uri_signer'
6
- require_relative 'uri_formatter'
7
- require_relative 'uri'
8
- require_relative 'user_interaction'
2
+ require_relative "../rubygems"
3
+ require_relative "request"
4
+ require_relative "request/connection_pools"
5
+ require_relative "s3_uri_signer"
6
+ require_relative "uri_formatter"
7
+ require_relative "uri"
8
+ require_relative "user_interaction"
9
9
 
10
10
  ##
11
11
  # RemoteFetcher handles the details of fetching gems and gem information from
@@ -72,10 +72,10 @@ class Gem::RemoteFetcher
72
72
  # fetching the gem.
73
73
 
74
74
  def initialize(proxy=nil, dns=nil, headers={})
75
- require_relative 'core_ext/tcpsocket_init' if Gem.configuration.ipv4_fallback_enabled
76
- require 'net/http'
77
- require 'stringio'
78
- require 'uri'
75
+ require_relative "core_ext/tcpsocket_init" if Gem.configuration.ipv4_fallback_enabled
76
+ require "net/http"
77
+ require "stringio"
78
+ require "uri"
79
79
 
80
80
  Socket.do_not_reverse_lookup = true
81
81
 
@@ -114,7 +114,7 @@ class Gem::RemoteFetcher
114
114
  cache_dir =
115
115
  if Dir.pwd == install_dir # see fetch_command
116
116
  install_dir
117
- elsif File.writable?(install_cache_dir) || (File.writable?(install_dir) && (not File.exist?(install_cache_dir)))
117
+ elsif File.writable?(install_cache_dir) || (File.writable?(install_dir) && (!File.exist?(install_cache_dir)))
118
118
  install_cache_dir
119
119
  else
120
120
  File.join Gem.user_dir, "cache"
@@ -136,7 +136,7 @@ class Gem::RemoteFetcher
136
136
  # REFACTOR: split this up and dispatch on scheme (eg download_http)
137
137
  # REFACTOR: be sure to clean up fake fetcher when you do this... cleaner
138
138
  case scheme
139
- when 'http', 'https', 's3' then
139
+ when "http", "https", "s3" then
140
140
  unless File.exist? local_gem_path
141
141
  begin
142
142
  verbose "Downloading gem #{gem_file_name}"
@@ -156,12 +156,12 @@ class Gem::RemoteFetcher
156
156
  self.cache_update_path remote_gem_path, local_gem_path
157
157
  end
158
158
  end
159
- when 'file' then
159
+ when "file" then
160
160
  begin
161
161
  path = source_uri.path
162
- path = File.dirname(path) if File.extname(path) == '.gem'
162
+ path = File.dirname(path) if File.extname(path) == ".gem"
163
163
 
164
- remote_gem_path = Gem::Util.correct_for_windows_path(File.join(path, 'gems', gem_file_name))
164
+ remote_gem_path = Gem::Util.correct_for_windows_path(File.join(path, "gems", gem_file_name))
165
165
 
166
166
  FileUtils.cp(remote_gem_path, local_gem_path)
167
167
  rescue Errno::EACCES
@@ -171,7 +171,7 @@ class Gem::RemoteFetcher
171
171
  verbose "Using local gem #{local_gem_path}"
172
172
  when nil then # TODO test for local overriding cache
173
173
  source_path = if Gem.win_platform? && source_uri.scheme &&
174
- !source_uri.path.include?(':')
174
+ !source_uri.path.include?(":")
175
175
  "#{source_uri.scheme}:#{source_uri.path}"
176
176
  else
177
177
  source_uri.path
@@ -216,9 +216,9 @@ class Gem::RemoteFetcher
216
216
  head ? response : response.body
217
217
  when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther,
218
218
  Net::HTTPTemporaryRedirect then
219
- raise FetchError.new('too many redirects', uri) if depth > 10
219
+ raise FetchError.new("too many redirects", uri) if depth > 10
220
220
 
221
- unless location = response['Location']
221
+ unless location = response["Location"]
222
222
  raise FetchError.new("redirecting but no redirect location was given", uri)
223
223
  end
224
224
  location = Gem::Uri.new location
@@ -247,7 +247,7 @@ class Gem::RemoteFetcher
247
247
 
248
248
  data = send "fetch_#{uri.scheme}", uri, mtime, head
249
249
 
250
- if data and !head and uri.to_s.end_with?(".gz")
250
+ if data && !head && uri.to_s.end_with?(".gz")
251
251
  begin
252
252
  data = Gem::Util.gunzip data
253
253
  rescue Zlib::GzipFile::Error
@@ -288,7 +288,7 @@ class Gem::RemoteFetcher
288
288
  return Gem.read_binary(path)
289
289
  end
290
290
 
291
- if update and path
291
+ if update && path
292
292
  Gem.write_binary(path, data)
293
293
  end
294
294
 
@@ -312,7 +312,7 @@ class Gem::RemoteFetcher
312
312
  end
313
313
 
314
314
  def https?(uri)
315
- uri.scheme.downcase == 'https'
315
+ uri.scheme.downcase == "https"
316
316
  end
317
317
 
318
318
  def close_all
@@ -37,15 +37,15 @@ class Gem::Request::ConnectionPools # :nodoc:
37
37
  # Returns list of no_proxy entries (if any) from the environment
38
38
 
39
39
  def get_no_proxy_from_env
40
- env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
40
+ env_no_proxy = ENV["no_proxy"] || ENV["NO_PROXY"]
41
41
 
42
- return [] if env_no_proxy.nil? or env_no_proxy.empty?
42
+ return [] if env_no_proxy.nil? || env_no_proxy.empty?
43
43
 
44
44
  env_no_proxy.split(/\s*,\s*/)
45
45
  end
46
46
 
47
47
  def https?(uri)
48
- uri.scheme.downcase == 'https'
48
+ uri.scheme.downcase == "https"
49
49
  end
50
50
 
51
51
  def no_proxy?(host, env_no_proxy)
@@ -78,7 +78,7 @@ class Gem::Request::ConnectionPools # :nodoc:
78
78
 
79
79
  no_proxy = get_no_proxy_from_env
80
80
 
81
- if proxy_uri and not no_proxy?(hostname, no_proxy)
81
+ if proxy_uri && !no_proxy?(hostname, no_proxy)
82
82
  proxy_hostname = proxy_uri.respond_to?(:hostname) ? proxy_uri.hostname : proxy_uri.host
83
83
  net_http_args + [
84
84
  proxy_hostname,
@@ -26,7 +26,7 @@ class Gem::Request::HTTPPool # :nodoc:
26
26
 
27
27
  def close_all
28
28
  until @queue.empty?
29
- if connection = @queue.pop(true) and connection.started?
29
+ if (connection = @queue.pop(true)) && connection.started?
30
30
  connection.finish
31
31
  end
32
32
  end