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,9 +12,9 @@ class Gem::Source
12
12
  include Gem::Text
13
13
 
14
14
  FILES = { # :nodoc:
15
- :released => 'specs',
16
- :latest => 'latest_specs',
17
- :prerelease => 'prerelease_specs',
15
+ :released => "specs",
16
+ :latest => "latest_specs",
17
+ :prerelease => "prerelease_specs",
18
18
  }.freeze
19
19
 
20
20
  ##
@@ -62,7 +62,7 @@ class Gem::Source
62
62
  end
63
63
 
64
64
  def ==(other) # :nodoc:
65
- self.class === other and @uri == other.uri
65
+ self.class === other && @uri == other.uri
66
66
  end
67
67
 
68
68
  alias_method :eql?, :== # :nodoc:
@@ -71,7 +71,7 @@ class Gem::Source
71
71
  # Returns a Set that can fetch specifications from this source.
72
72
 
73
73
  def dependency_resolver_set # :nodoc:
74
- return Gem::Resolver::IndexSet.new self if 'file' == uri.scheme
74
+ return Gem::Resolver::IndexSet.new self if "file" == uri.scheme
75
75
 
76
76
  fetch_uri = if uri.host == "rubygems.org"
77
77
  index_uri = uri.dup
@@ -141,7 +141,7 @@ class Gem::Source
141
141
  return spec if spec
142
142
  end
143
143
 
144
- source_uri.path << '.rz'
144
+ source_uri.path << ".rz"
145
145
 
146
146
  spec = fetcher.fetch_path source_uri
147
147
  spec = Gem::Util.inflate spec
@@ -150,7 +150,7 @@ class Gem::Source
150
150
  require "fileutils"
151
151
  FileUtils.mkdir_p cache_dir
152
152
 
153
- File.open local_spec, 'wb' do |io|
153
+ File.open local_spec, "wb" do |io|
154
154
  io.write spec
155
155
  end
156
156
  end
@@ -209,13 +209,13 @@ class Gem::Source
209
209
  end
210
210
 
211
211
  def pretty_print(q) # :nodoc:
212
- q.group 2, '[Remote:', ']' do
212
+ q.group 2, "[Remote:", "]" do
213
213
  q.breakable
214
214
  q.text @uri.to_s
215
215
 
216
216
  if api = uri
217
217
  q.breakable
218
- q.text 'API URI: '
218
+ q.text "API URI: "
219
219
  q.text api.to_s
220
220
  end
221
221
  end
@@ -229,13 +229,13 @@ class Gem::Source
229
229
  private
230
230
 
231
231
  def enforce_trailing_slash(uri)
232
- uri.merge(uri.path.gsub(/\/+$/, '') + '/')
232
+ uri.merge(uri.path.gsub(/\/+$/, "") + "/")
233
233
  end
234
234
  end
235
235
 
236
- require_relative 'source/git'
237
- require_relative 'source/installed'
238
- require_relative 'source/specific_file'
239
- require_relative 'source/local'
240
- require_relative 'source/lock'
241
- require_relative 'source/vendor'
236
+ require_relative "source/git"
237
+ require_relative "source/installed"
238
+ require_relative "source/specific_file"
239
+ require_relative "source/local"
240
+ require_relative "source/lock"
241
+ require_relative "source/vendor"
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'remote_fetcher'
3
- require_relative 'user_interaction'
4
- require_relative 'errors'
5
- require_relative 'text'
6
- require_relative 'name_tuple'
2
+ require_relative "remote_fetcher"
3
+ require_relative "user_interaction"
4
+ require_relative "errors"
5
+ require_relative "text"
6
+ require_relative "name_tuple"
7
7
 
8
8
  ##
9
9
  # SpecFetcher handles metadata updates from remote gem repositories.
@@ -98,7 +98,7 @@ class Gem::SpecFetcher
98
98
 
99
99
  found[source] = specs.select do |tup|
100
100
  if dependency.match?(tup)
101
- if matching_platform and !Gem::Platform.match_gem?(tup.platform, tup.name)
101
+ if matching_platform && !Gem::Platform.match_gem?(tup.platform, tup.name)
102
102
  pm = (
103
103
  rejected_specs[dependency] ||= \
104
104
  Gem::PlatformMismatch.new(tup.name, tup.version))
@@ -171,19 +171,19 @@ class Gem::SpecFetcher
171
171
  # alternative gem names.
172
172
 
173
173
  def suggest_gems_from_name(gem_name, type = :latest, num_results = 5)
174
- gem_name = gem_name.downcase.tr('_-', '')
174
+ gem_name = gem_name.downcase.tr("_-", "")
175
175
  max = gem_name.size / 2
176
176
  names = available_specs(type).first.values.flatten(1)
177
177
 
178
178
  matches = names.map do |n|
179
179
  next unless n.match_platform?
180
- [n.name, 0] if n.name.downcase.tr('_-', '').include?(gem_name)
180
+ [n.name, 0] if n.name.downcase.tr("_-", "").include?(gem_name)
181
181
  end.compact
182
182
 
183
183
  if matches.length < num_results
184
184
  matches += names.map do |n|
185
185
  next unless n.match_platform?
186
- distance = levenshtein_distance gem_name, n.name.downcase.tr('_-', '')
186
+ distance = levenshtein_distance gem_name, n.name.downcase.tr("_-", "")
187
187
  next if distance >= max
188
188
  return [n.name] if distance == 0
189
189
  [n.name, distance]
@@ -6,12 +6,11 @@
6
6
  # See LICENSE.txt for permissions.
7
7
  #++
8
8
 
9
- require_relative 'deprecate'
10
- require_relative 'basic_specification'
11
- require_relative 'stub_specification'
12
- require_relative 'platform'
13
- require_relative 'requirement'
14
- require_relative 'util/list'
9
+ require_relative "deprecate"
10
+ require_relative "basic_specification"
11
+ require_relative "stub_specification"
12
+ require_relative "platform"
13
+ require_relative "util/list"
15
14
 
16
15
  ##
17
16
  # The Specification class contains the information for a gem. Typically
@@ -75,20 +74,20 @@ class Gem::Specification < Gem::BasicSpecification
75
74
  # key should be equal to the CURRENT_SPECIFICATION_VERSION.
76
75
 
77
76
  SPECIFICATION_VERSION_HISTORY = { # :nodoc:
78
- -1 => ['(RubyGems versions up to and including 0.7 did not have versioned specifications)'],
77
+ -1 => ["(RubyGems versions up to and including 0.7 did not have versioned specifications)"],
79
78
  1 => [
80
79
  'Deprecated "test_suite_file" in favor of the new, but equivalent, "test_files"',
81
80
  '"test_file=x" is a shortcut for "test_files=[x]"',
82
81
  ],
83
82
  2 => [
84
83
  'Added "required_rubygems_version"',
85
- 'Now forward-compatible with future versions',
84
+ "Now forward-compatible with future versions",
86
85
  ],
87
86
  3 => [
88
- 'Added Fixnum validation to the specification_version',
87
+ "Added Fixnum validation to the specification_version",
89
88
  ],
90
89
  4 => [
91
- 'Added sandboxed freeform metadata to the specification version.',
90
+ "Added sandboxed freeform metadata to the specification version.",
92
91
  ],
93
92
  }.freeze
94
93
 
@@ -127,7 +126,7 @@ class Gem::Specification < Gem::BasicSpecification
127
126
  @@default_value = {
128
127
  :authors => [],
129
128
  :autorequire => nil,
130
- :bindir => 'bin',
129
+ :bindir => "bin",
131
130
  :cert_chain => [],
132
131
  :date => nil,
133
132
  :dependencies => [],
@@ -144,7 +143,7 @@ class Gem::Specification < Gem::BasicSpecification
144
143
  :platform => Gem::Platform::RUBY,
145
144
  :post_install_message => nil,
146
145
  :rdoc_options => [],
147
- :require_paths => ['lib'],
146
+ :require_paths => ["lib"],
148
147
  :required_ruby_version => Gem::Requirement.default,
149
148
  :required_rubygems_version => Gem::Requirement.default,
150
149
  :requirements => [],
@@ -474,7 +473,7 @@ class Gem::Specification < Gem::BasicSpecification
474
473
  # spec.platform = Gem::Platform.local
475
474
 
476
475
  def platform=(platform)
477
- if @original_platform.nil? or
476
+ if @original_platform.nil? ||
478
477
  @original_platform == Gem::Platform::RUBY
479
478
  @original_platform = platform
480
479
  end
@@ -490,12 +489,12 @@ class Gem::Specification < Gem::BasicSpecification
490
489
  # legacy constants
491
490
  when nil, Gem::Platform::RUBY then
492
491
  @new_platform = Gem::Platform::RUBY
493
- when 'mswin32' then # was Gem::Platform::WIN32
494
- @new_platform = Gem::Platform.new 'x86-mswin32'
495
- when 'i586-linux' then # was Gem::Platform::LINUX_586
496
- @new_platform = Gem::Platform.new 'x86-linux'
497
- when 'powerpc-darwin' then # was Gem::Platform::DARWIN
498
- @new_platform = Gem::Platform.new 'ppc-darwin'
492
+ when "mswin32" then # was Gem::Platform::WIN32
493
+ @new_platform = Gem::Platform.new "x86-mswin32"
494
+ when "i586-linux" then # was Gem::Platform::LINUX_586
495
+ @new_platform = Gem::Platform.new "x86-linux"
496
+ when "powerpc-darwin" then # was Gem::Platform::DARWIN
497
+ @new_platform = Gem::Platform.new "ppc-darwin"
499
498
  else
500
499
  @new_platform = Gem::Platform.new platform
501
500
  end
@@ -1047,7 +1046,7 @@ class Gem::Specification < Gem::BasicSpecification
1047
1046
 
1048
1047
  def self.find_active_stub_by_path(path)
1049
1048
  stub = @@active_stub_with_requirable_file[path] ||= (stubs.find do |s|
1050
- s.activated? and s.contains_requirable_file? path
1049
+ s.activated? && s.contains_requirable_file?(path)
1051
1050
  end || NOT_FOUND)
1052
1051
  stub.this
1053
1052
  end
@@ -1150,7 +1149,7 @@ class Gem::Specification < Gem::BasicSpecification
1150
1149
  file = file.dup.tap(&Gem::UNTAINT)
1151
1150
  return unless File.file?(file)
1152
1151
 
1153
- code = Gem.open_file(file, 'r:UTF-8:-', &:read)
1152
+ code = Gem.open_file(file, "r:UTF-8:-", &:read)
1154
1153
 
1155
1154
  code.tap(&Gem::UNTAINT)
1156
1155
 
@@ -1235,7 +1234,7 @@ class Gem::Specification < Gem::BasicSpecification
1235
1234
  latest_remote = remotes.sort.last
1236
1235
 
1237
1236
  yield [local_spec, latest_remote] if
1238
- latest_remote and local_spec.version < latest_remote
1237
+ latest_remote && local_spec.version < latest_remote
1239
1238
  end
1240
1239
 
1241
1240
  nil
@@ -1392,7 +1391,7 @@ class Gem::Specification < Gem::BasicSpecification
1392
1391
  @required_rubygems_version,
1393
1392
  @original_platform,
1394
1393
  @dependencies,
1395
- '', # rubyforge_project
1394
+ "", # rubyforge_project
1396
1395
  @email,
1397
1396
  @authors,
1398
1397
  @description,
@@ -1558,7 +1557,7 @@ class Gem::Specification < Gem::BasicSpecification
1558
1557
  # Singular reader for #authors. Returns the first author in the list
1559
1558
 
1560
1559
  def author
1561
- val = authors and val.first
1560
+ (val = authors) && val.first
1562
1561
  end
1563
1562
 
1564
1563
  ##
@@ -1610,7 +1609,7 @@ class Gem::Specification < Gem::BasicSpecification
1610
1609
  return if default_gem?
1611
1610
  return if File.exist? gem_build_complete_path
1612
1611
  return if !File.writable?(base_dir)
1613
- return if !File.exist?(File.join(base_dir, 'extensions'))
1612
+ return if !File.exist?(File.join(base_dir, "extensions"))
1614
1613
 
1615
1614
  begin
1616
1615
  # We need to require things in $LOAD_PATH without looking for the
@@ -1618,9 +1617,9 @@ class Gem::Specification < Gem::BasicSpecification
1618
1617
  unresolved_deps = Gem::Specification.unresolved_deps.dup
1619
1618
  Gem::Specification.unresolved_deps.clear
1620
1619
 
1621
- require_relative 'config_file'
1622
- require_relative 'ext'
1623
- require_relative 'user_interaction'
1620
+ require_relative "config_file"
1621
+ require_relative "ext"
1622
+ require_relative "user_interaction"
1624
1623
 
1625
1624
  ui = Gem::SilentUI.new
1626
1625
  Gem::DefaultUserInteraction.use_ui ui do
@@ -1670,7 +1669,7 @@ class Gem::Specification < Gem::BasicSpecification
1670
1669
  conflicts = {}
1671
1670
  self.runtime_dependencies.each do |dep|
1672
1671
  spec = Gem.loaded_specs[dep.name]
1673
- if spec and not spec.satisfies_requirement? dep
1672
+ if spec && !spec.satisfies_requirement?(dep)
1674
1673
  (conflicts[spec] ||= []) << dep
1675
1674
  end
1676
1675
  end
@@ -1697,7 +1696,7 @@ class Gem::Specification < Gem::BasicSpecification
1697
1696
  self.dependencies.any? do |dep|
1698
1697
  if dep.runtime?
1699
1698
  spec = Gem.loaded_specs[dep.name]
1700
- spec and not spec.satisfies_requirement? dep
1699
+ spec && !spec.satisfies_requirement?(dep)
1701
1700
  else
1702
1701
  false
1703
1702
  end
@@ -1718,7 +1717,7 @@ class Gem::Specification < Gem::BasicSpecification
1718
1717
 
1719
1718
  DateLike = Object.new # :nodoc:
1720
1719
  def DateLike.===(obj) # :nodoc:
1721
- defined?(::Date) and Date === obj
1720
+ defined?(::Date) && Date === obj
1722
1721
  end
1723
1722
 
1724
1723
  DateTimeFormat = # :nodoc:
@@ -1758,9 +1757,9 @@ class Gem::Specification < Gem::BasicSpecification
1758
1757
  # executable now. See Gem.bin_path.
1759
1758
 
1760
1759
  def default_executable # :nodoc:
1761
- if defined?(@default_executable) and @default_executable
1760
+ if defined?(@default_executable) && @default_executable
1762
1761
  result = @default_executable
1763
- elsif @executables and @executables.size == 1
1762
+ elsif @executables && @executables.size == 1
1764
1763
  result = Array(@executables).first
1765
1764
  else
1766
1765
  result = nil
@@ -1839,7 +1838,7 @@ class Gem::Specification < Gem::BasicSpecification
1839
1838
  # spec.doc_dir 'ri' # => "/path/to/gem_repo/doc/a-1/ri"
1840
1839
 
1841
1840
  def doc_dir(type = nil)
1842
- @doc_dir ||= File.join base_dir, 'doc', full_name
1841
+ @doc_dir ||= File.join base_dir, "doc", full_name
1843
1842
 
1844
1843
  if type
1845
1844
  File.join @doc_dir, type
@@ -1851,17 +1850,17 @@ class Gem::Specification < Gem::BasicSpecification
1851
1850
  def encode_with(coder) # :nodoc:
1852
1851
  mark_version
1853
1852
 
1854
- coder.add 'name', @name
1855
- coder.add 'version', @version
1853
+ coder.add "name", @name
1854
+ coder.add "version", @version
1856
1855
  platform = case @original_platform
1857
- when nil, '' then
1858
- 'ruby'
1856
+ when nil, "" then
1857
+ "ruby"
1859
1858
  when String then
1860
1859
  @original_platform
1861
1860
  else
1862
1861
  @original_platform.to_s
1863
1862
  end
1864
- coder.add 'platform', platform
1863
+ coder.add "platform", platform
1865
1864
 
1866
1865
  attributes = @@attributes.map(&:to_s) - %w[name version platform]
1867
1866
  attributes.each do |name|
@@ -1877,7 +1876,7 @@ class Gem::Specification < Gem::BasicSpecification
1877
1876
  # Singular accessor for #executables
1878
1877
 
1879
1878
  def executable
1880
- val = executables and val.first
1879
+ (val = executables) && val.first
1881
1880
  end
1882
1881
 
1883
1882
  ##
@@ -1989,7 +1988,7 @@ class Gem::Specification < Gem::BasicSpecification
1989
1988
  # True if this gem has files in test_files
1990
1989
 
1991
1990
  def has_unit_tests? # :nodoc:
1992
- not test_files.empty?
1991
+ !test_files.empty?
1993
1992
  end
1994
1993
 
1995
1994
  # :stopdoc:
@@ -2042,7 +2041,7 @@ class Gem::Specification < Gem::BasicSpecification
2042
2041
  self.name = name if name
2043
2042
  self.version = version if version
2044
2043
 
2045
- if platform = Gem.platforms.last and platform != Gem::Platform::RUBY and platform != Gem::Platform.local
2044
+ if (platform = Gem.platforms.last) && platform != Gem::Platform::RUBY && platform != Gem::Platform.local
2046
2045
  self.platform = platform
2047
2046
  end
2048
2047
 
@@ -2157,8 +2156,8 @@ class Gem::Specification < Gem::BasicSpecification
2157
2156
  return
2158
2157
  end
2159
2158
 
2160
- if @specification_version > CURRENT_SPECIFICATION_VERSION and
2161
- sym.to_s.end_with?("=")
2159
+ if @specification_version > CURRENT_SPECIFICATION_VERSION &&
2160
+ sym.to_s.end_with?("=")
2162
2161
  warn "ignoring #{sym} loading #{full_name}" if $DEBUG
2163
2162
  else
2164
2163
  super
@@ -2184,7 +2183,7 @@ class Gem::Specification < Gem::BasicSpecification
2184
2183
  # file list.
2185
2184
 
2186
2185
  def normalize
2187
- if defined?(@extra_rdoc_files) and @extra_rdoc_files
2186
+ if defined?(@extra_rdoc_files) && @extra_rdoc_files
2188
2187
  @extra_rdoc_files.uniq!
2189
2188
  @files ||= []
2190
2189
  @files.concat(@extra_rdoc_files)
@@ -2209,7 +2208,7 @@ class Gem::Specification < Gem::BasicSpecification
2209
2208
  # platform. For use with legacy gems.
2210
2209
 
2211
2210
  def original_name # :nodoc:
2212
- if platform == Gem::Platform::RUBY or platform.nil?
2211
+ if platform == Gem::Platform::RUBY || platform.nil?
2213
2212
  "#{@name}-#{@version}"
2214
2213
  else
2215
2214
  "#{@name}-#{@version}-#{@original_platform}"
@@ -2231,7 +2230,7 @@ class Gem::Specification < Gem::BasicSpecification
2231
2230
  end
2232
2231
 
2233
2232
  def pretty_print(q) # :nodoc:
2234
- q.group 2, 'Gem::Specification.new do |s|', 'end' do
2233
+ q.group 2, "Gem::Specification.new do |s|", "end" do
2235
2234
  q.breakable
2236
2235
 
2237
2236
  attributes = @@attributes - [:name, :version]
@@ -2242,8 +2241,8 @@ class Gem::Specification < Gem::BasicSpecification
2242
2241
  attributes.each do |attr_name|
2243
2242
  current_value = self.send attr_name
2244
2243
  current_value = current_value.sort if %i[files test_files].include? attr_name
2245
- if current_value != default_value(attr_name) or
2246
- self.class.required_attribute? attr_name
2244
+ if current_value != default_value(attr_name) ||
2245
+ self.class.required_attribute?(attr_name)
2247
2246
 
2248
2247
  q.text "s.#{attr_name} = "
2249
2248
 
@@ -2301,7 +2300,7 @@ class Gem::Specification < Gem::BasicSpecification
2301
2300
  # Singular accessor for #require_paths
2302
2301
 
2303
2302
  def require_path
2304
- val = require_paths and val.first
2303
+ (val = require_paths) && val.first
2305
2304
  end
2306
2305
 
2307
2306
  ##
@@ -2326,7 +2325,7 @@ class Gem::Specification < Gem::BasicSpecification
2326
2325
  # Returns the full path to this spec's ri directory.
2327
2326
 
2328
2327
  def ri_dir
2329
- @ri_dir ||= File.join base_dir, 'ri', full_name
2328
+ @ri_dir ||= File.join base_dir, "ri", full_name
2330
2329
  end
2331
2330
 
2332
2331
  ##
@@ -2336,13 +2335,13 @@ class Gem::Specification < Gem::BasicSpecification
2336
2335
  def ruby_code(obj)
2337
2336
  case obj
2338
2337
  when String then obj.dump + ".freeze"
2339
- when Array then '[' + obj.map {|x| ruby_code x }.join(", ") + ']'
2338
+ when Array then "[" + obj.map {|x| ruby_code x }.join(", ") + "]"
2340
2339
  when Hash then
2341
2340
  seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
2342
2341
  "{ #{seg.join(', ')} }"
2343
2342
  when Gem::Version then obj.to_s.dump
2344
- when DateLike then obj.strftime('%Y-%m-%d').dump
2345
- when Time then obj.strftime('%Y-%m-%d').dump
2343
+ when DateLike then obj.strftime("%Y-%m-%d").dump
2344
+ when Time then obj.strftime("%Y-%m-%d").dump
2346
2345
  when Numeric then obj.inspect
2347
2346
  when true, false, nil then obj.inspect
2348
2347
  when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
@@ -2376,7 +2375,7 @@ class Gem::Specification < Gem::BasicSpecification
2376
2375
 
2377
2376
  def satisfies_requirement?(dependency)
2378
2377
  return @name == dependency.name &&
2379
- dependency.requirement.satisfied_by?(@version)
2378
+ dependency.requirement.satisfied_by?(@version)
2380
2379
  end
2381
2380
 
2382
2381
  ##
@@ -2430,7 +2429,7 @@ class Gem::Specification < Gem::BasicSpecification
2430
2429
  # Singular accessor for #test_files
2431
2430
 
2432
2431
  def test_file # :nodoc:
2433
- val = test_files and val.first
2432
+ (val = test_files) && val.first
2434
2433
  end
2435
2434
 
2436
2435
  ##
@@ -2452,7 +2451,7 @@ class Gem::Specification < Gem::BasicSpecification
2452
2451
  @test_files = [@test_suite_file].flatten
2453
2452
  @test_suite_file = nil
2454
2453
  end
2455
- if defined?(@test_files) and @test_files
2454
+ if defined?(@test_files) && @test_files
2456
2455
  @test_files
2457
2456
  else
2458
2457
  @test_files = []
@@ -2476,13 +2475,13 @@ class Gem::Specification < Gem::BasicSpecification
2476
2475
 
2477
2476
  result << " s.name = #{ruby_code name}"
2478
2477
  result << " s.version = #{ruby_code version}"
2479
- unless platform.nil? or platform == Gem::Platform::RUBY
2478
+ unless platform.nil? || platform == Gem::Platform::RUBY
2480
2479
  result << " s.platform = #{ruby_code original_platform}"
2481
2480
  end
2482
2481
  result << ""
2483
2482
  result << " s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version="
2484
2483
 
2485
- if metadata and !metadata.empty?
2484
+ if metadata && !metadata.empty?
2486
2485
  result << " s.metadata = #{ruby_code metadata} if s.respond_to? :metadata="
2487
2486
  end
2488
2487
  result << " s.require_paths = #{ruby_code raw_require_paths}"
@@ -2575,14 +2574,14 @@ class Gem::Specification < Gem::BasicSpecification
2575
2574
  # back, we have to check again here to make sure that our
2576
2575
  # psych code was properly loaded, and load it if not.
2577
2576
  unless Gem.const_defined?(:NoAliasYAMLTree)
2578
- require_relative 'psych_tree'
2577
+ require_relative "psych_tree"
2579
2578
  end
2580
2579
 
2581
2580
  builder = Gem::NoAliasYAMLTree.create
2582
2581
  builder << self
2583
2582
  ast = builder.tree
2584
2583
 
2585
- require 'stringio'
2584
+ require "stringio"
2586
2585
  io = StringIO.new
2587
2586
  io.set_encoding Encoding::UTF_8
2588
2587
 
@@ -2666,10 +2665,12 @@ class Gem::Specification < Gem::BasicSpecification
2666
2665
 
2667
2666
  def version=(version)
2668
2667
  @version = Gem::Version.create(version)
2668
+ return if @version.nil?
2669
+
2669
2670
  # skip to set required_ruby_version when pre-released rubygems.
2670
2671
  # It caused to raise CircularDependencyError
2671
2672
  if @version.prerelease? && (@name.nil? || @name.strip != "rubygems")
2672
- self.required_rubygems_version = '> 1.3.1'
2673
+ self.required_rubygems_version = "> 1.3.1"
2673
2674
  end
2674
2675
  invalidate_memoized_attributes
2675
2676
 
@@ -1,4 +1,4 @@
1
- require_relative 'user_interaction'
1
+ require_relative "user_interaction"
2
2
 
3
3
  class Gem::SpecificationPolicy
4
4
  include Gem::UserInteraction
@@ -120,7 +120,7 @@ class Gem::SpecificationPolicy
120
120
  metadata = @specification.metadata
121
121
 
122
122
  unless Hash === metadata
123
- error 'metadata must be a hash'
123
+ error "metadata must be a hash"
124
124
  end
125
125
 
126
126
  metadata.each do |key, value|
@@ -188,7 +188,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
188
188
  prerelease_dep && !@specification.version.prerelease?
189
189
 
190
190
  open_ended = dep.requirement.requirements.all? do |op, version|
191
- not version.prerelease? and (op == '>' or op == '>=')
191
+ !version.prerelease? && (op == ">" || op == ">=")
192
192
  end
193
193
 
194
194
  if open_ended
@@ -198,12 +198,12 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
198
198
 
199
199
  base = segments.first 2
200
200
 
201
- recommendation = if (op == '>' || op == '>=') && segments == [0]
201
+ recommendation = if (op == ">" || op == ">=") && segments == [0]
202
202
  " use a bounded requirement, such as '~> x.y'"
203
203
  else
204
- bugfix = if op == '>'
204
+ bugfix = if op == ">"
205
205
  ", '> #{dep_version}'"
206
- elsif op == '>=' and base != segments
206
+ elsif op == ">=" && base != segments
207
207
  ", '>= #{dep_version}'"
208
208
  end
209
209
 
@@ -286,7 +286,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
286
286
  def validate_require_paths
287
287
  return unless @specification.raw_require_paths.empty?
288
288
 
289
- error 'specification must have at least one require_path'
289
+ error "specification must have at least one require_path"
290
290
  end
291
291
 
292
292
  def validate_non_files
@@ -310,7 +310,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
310
310
  def validate_specification_version
311
311
  return if @specification.specification_version.is_a?(Integer)
312
312
 
313
- error 'specification_version must be an Integer (did you mean version?)'
313
+ error "specification_version must be an Integer (did you mean version?)"
314
314
  end
315
315
 
316
316
  def validate_platform
@@ -338,7 +338,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
338
338
  String
339
339
  end
340
340
 
341
- unless Array === val and val.all? {|x| x.kind_of?(klass) }
341
+ unless Array === val && val.all? {|x| x.kind_of?(klass) }
342
342
  error "#{field} must be an Array of #{klass}"
343
343
  end
344
344
  end
@@ -380,7 +380,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
380
380
  WARNING
381
381
  end
382
382
 
383
- LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '')
383
+ LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, "")
384
384
  LAZY_PATTERN = /\AFI XME|\ATO DO/x.freeze
385
385
  HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i.freeze
386
386
 
@@ -404,8 +404,8 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
404
404
  homepage = @specification.homepage
405
405
 
406
406
  # Make sure a homepage is valid HTTP/HTTPS URI
407
- if homepage and not homepage.empty?
408
- require 'uri'
407
+ if homepage && !homepage.empty?
408
+ require "uri"
409
409
  begin
410
410
  homepage_uri = URI.parse(homepage)
411
411
  unless [URI::HTTP, URI::HTTPS].member? homepage_uri.class
@@ -445,7 +445,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
445
445
 
446
446
  def validate_shebang_line_in(executable)
447
447
  executable_path = File.join(@specification.bindir, executable)
448
- return if File.read(executable_path, 2) == '#!'
448
+ return if File.read(executable_path, 2) == "#!"
449
449
 
450
450
  warning "#{executable_path} is missing #! line"
451
451
  end
@@ -457,11 +457,11 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
457
457
  end
458
458
 
459
459
  def validate_extensions # :nodoc:
460
- require_relative 'ext'
460
+ require_relative "ext"
461
461
  builder = Gem::Ext::Builder.new(@specification)
462
462
 
463
463
  rake_extension = @specification.extensions.any? {|s| builder.builder_for(s) == Gem::Ext::RakeBuilder }
464
- rake_dependency = @specification.dependencies.any? {|d| d.name == 'rake' }
464
+ rake_dependency = @specification.dependencies.any? {|d| d.name == "rake" }
465
465
 
466
466
  warning <<-WARNING if rake_extension && !rake_dependency
467
467
  You have specified rake based extension, but rake is not added as dependency. It is recommended to add rake as a dependency in gemspec since there's no guarantee rake will be already installed.
@@ -9,7 +9,7 @@ class Gem::StubSpecification < Gem::BasicSpecification
9
9
  PREFIX = "# stub: ".freeze
10
10
 
11
11
  # :nodoc:
12
- OPEN_MODE = 'r:UTF-8:-'.freeze
12
+ OPEN_MODE = "r:UTF-8:-".freeze
13
13
 
14
14
  class StubLine # :nodoc: all
15
15
  attr_reader :name, :version, :platform, :require_paths, :extensions,
@@ -19,9 +19,9 @@ class Gem::StubSpecification < Gem::BasicSpecification
19
19
 
20
20
  # These are common require paths.
21
21
  REQUIRE_PATHS = { # :nodoc:
22
- 'lib' => 'lib'.freeze,
23
- 'test' => 'test'.freeze,
24
- 'ext' => 'ext'.freeze,
22
+ "lib" => "lib".freeze,
23
+ "test" => "test".freeze,
24
+ "ext" => "ext".freeze,
25
25
  }.freeze
26
26
 
27
27
  # These are common require path lists. This hash is used to optimize
@@ -29,7 +29,7 @@ class Gem::StubSpecification < Gem::BasicSpecification
29
29
  # in their require paths, so lets take advantage of that by pre-allocating
30
30
  # a require path list for that case.
31
31
  REQUIRE_PATH_LIST = { # :nodoc:
32
- 'lib' => ['lib'].freeze,
32
+ "lib" => ["lib"].freeze,
33
33
  }.freeze
34
34
 
35
35
  def initialize(data, extensions)