rubygems-update 3.3.18 → 3.3.22

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -70,6 +70,7 @@ module Bundler
70
70
  @unlock = unlock
71
71
  @optional_groups = optional_groups
72
72
  @remote = false
73
+ @prefer_local = false
73
74
  @specs = nil
74
75
  @ruby_version = ruby_version
75
76
  @gemfiles = gemfiles
@@ -138,14 +139,12 @@ module Bundler
138
139
  @unlock[:gems] ||= @dependencies.map(&:name)
139
140
  else
140
141
  eager_unlock = expand_dependencies(@unlock[:gems] || [], true)
141
- @unlock[:gems] = @locked_specs.for(eager_unlock, false, false).map(&:name)
142
+ @unlock[:gems] = @locked_specs.for(eager_unlock, false, platforms).map(&:name)
142
143
  end
143
144
 
144
145
  @dependency_changes = converge_dependencies
145
146
  @local_changes = converge_locals
146
147
 
147
- @locked_specs_incomplete_for_platform = !@locked_specs.for(requested_dependencies & expand_dependencies(locked_dependencies), true, true)
148
-
149
148
  @requires = compute_requires
150
149
  end
151
150
 
@@ -170,6 +169,13 @@ module Bundler
170
169
  resolve
171
170
  end
172
171
 
172
+ def resolve_prefering_local!
173
+ @prefer_local = true
174
+ @remote = true
175
+ sources.remote!
176
+ resolve
177
+ end
178
+
173
179
  def resolve_with_cache!
174
180
  sources.cached!
175
181
  resolve
@@ -210,6 +216,7 @@ module Bundler
210
216
  true
211
217
  rescue BundlerError => e
212
218
  @resolve = nil
219
+ @resolver = nil
213
220
  @specs = nil
214
221
  @gem_version_promoter = nil
215
222
 
@@ -279,11 +286,8 @@ module Bundler
279
286
  end
280
287
  end
281
288
  else
282
- last_resolve = converge_locked_specs
283
- # Run a resolve against the locally available gems
284
289
  Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
285
- expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
286
- Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
290
+ resolver.start(expanded_dependencies)
287
291
  end
288
292
  end
289
293
 
@@ -468,7 +472,7 @@ module Bundler
468
472
  private :sources
469
473
 
470
474
  def nothing_changed?
471
- !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@locked_specs_incomplete_for_platform
475
+ !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes
472
476
  end
473
477
 
474
478
  def unlocking?
@@ -477,8 +481,20 @@ module Bundler
477
481
 
478
482
  private
479
483
 
484
+ def resolver
485
+ @resolver ||= begin
486
+ last_resolve = converge_locked_specs
487
+ remove_ruby_from_platforms_if_necessary!(dependencies)
488
+ Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve(last_resolve), platforms)
489
+ end
490
+ end
491
+
492
+ def expanded_dependencies
493
+ @expanded_dependencies ||= expand_dependencies(dependencies + metadata_dependencies, true)
494
+ end
495
+
480
496
  def filter_specs(specs, deps)
481
- SpecSet.new(specs).for(expand_dependencies(deps, true), false, false)
497
+ SpecSet.new(specs).for(expand_dependencies(deps, true), false, platforms)
482
498
  end
483
499
 
484
500
  def materialize(dependencies)
@@ -495,14 +511,25 @@ module Bundler
495
511
  "removed in order to install."
496
512
  end
497
513
 
498
- raise GemNotFound, "Could not find #{missing_specs.map(&:full_name).join(", ")} in any of the sources"
514
+ missing_specs_list = missing_specs.group_by(&:source).map do |source, missing_specs_for_source|
515
+ "#{missing_specs_for_source.map(&:full_name).join(", ")} in #{source}"
516
+ end
517
+
518
+ raise GemNotFound, "Could not find #{missing_specs_list.join(" nor ")}"
499
519
  end
500
520
 
501
- unless specs["bundler"].any?
502
- bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
503
- specs["bundler"] = bundler
521
+ loop do
522
+ incomplete_specs = specs.incomplete_specs
523
+ break if incomplete_specs.empty?
524
+
525
+ Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
526
+ @resolve = resolver.start(expanded_dependencies, :exclude_specs => incomplete_specs)
527
+ specs = resolve.materialize(dependencies)
504
528
  end
505
529
 
530
+ bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
531
+ specs["bundler"] = bundler
532
+
506
533
  specs
507
534
  end
508
535
 
@@ -510,6 +537,19 @@ module Bundler
510
537
  @remote && sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
511
538
  end
512
539
 
540
+ def pin_locally_available_names(source_requirements)
541
+ source_requirements.each_with_object({}) do |(name, original_source), new_source_requirements|
542
+ local_source = original_source.dup
543
+ local_source.local_only!
544
+
545
+ new_source_requirements[name] = if local_source.specs.search(name).any?
546
+ local_source
547
+ else
548
+ original_source
549
+ end
550
+ end
551
+ end
552
+
513
553
  def current_ruby_platform_locked?
514
554
  return false unless generic_local_platform == Gem::Platform::RUBY
515
555
  return false if Bundler.settings[:force_ruby_platform] && !@platforms.include?(Gem::Platform::RUBY)
@@ -545,7 +585,6 @@ module Bundler
545
585
  [@new_platform, "you added a new platform to your gemfile"],
546
586
  [@path_changes, "the gemspecs for path gems changed"],
547
587
  [@local_changes, "the gemspecs for git local gems changed"],
548
- [@locked_specs_incomplete_for_platform, "the lockfile does not have all gems needed for the current platform"],
549
588
  ].select(&:first).map(&:last).join(", ")
550
589
  end
551
590
 
@@ -678,7 +717,9 @@ module Bundler
678
717
  # commonly happen if the Gemfile has changed since the lockfile was last
679
718
  # generated
680
719
  def converge_locked_specs
681
- resolve = converge_specs(@locked_specs)
720
+ converged = converge_specs(@locked_specs)
721
+
722
+ resolve = SpecSet.new(converged.reject {|s| @unlock[:gems].include?(s.name) })
682
723
 
683
724
  diff = nil
684
725
 
@@ -702,16 +743,24 @@ module Bundler
702
743
  specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
703
744
  end
704
745
 
746
+ @specs_that_changed_sources = []
747
+
705
748
  specs.each do |s|
706
- # Replace the locked dependency's source with the equivalent source from the Gemfile
707
749
  dep = @dependencies.find {|d| s.satisfies?(d) }
708
750
 
709
- s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source
751
+ # Replace the locked dependency's source with the equivalent source from the Gemfile
752
+ s.source = if dep && dep.source
753
+ gemfile_source = dep.source
754
+ lockfile_source = s.source
710
755
 
711
- next if @unlock[:sources].include?(s.source.name)
756
+ @specs_that_changed_sources << s if gemfile_source != lockfile_source
757
+
758
+ gemfile_source
759
+ else
760
+ sources.get_with_fallback(s.source)
761
+ end
712
762
 
713
- # If the spec is from a path source and it doesn't exist anymore
714
- # then we unlock it.
763
+ next if @unlock[:sources].include?(s.source.name)
715
764
 
716
765
  # Path sources have special logic
717
766
  if s.source.instance_of?(Source::Path) || s.source.instance_of?(Source::Gemspec)
@@ -721,7 +770,7 @@ module Bundler
721
770
  # if we won't need the source (according to the lockfile),
722
771
  # don't error if the path/git source isn't available
723
772
  next if specs.
724
- for(requested_dependencies, false, true).
773
+ for(requested_dependencies, false).
725
774
  none? {|locked_spec| locked_spec.source == s.source }
726
775
 
727
776
  raise
@@ -743,12 +792,12 @@ module Bundler
743
792
  end
744
793
  end
745
794
 
746
- SpecSet.new(filter_specs(converged, deps).reject {|s| @unlock[:gems].include?(s.name) })
795
+ filter_specs(converged, deps)
747
796
  end
748
797
 
749
798
  def metadata_dependencies
750
799
  @metadata_dependencies ||= [
751
- Dependency.new("Ruby\0", RubyVersion.system.gem_version),
800
+ Dependency.new("Ruby\0", Gem.ruby_version),
752
801
  Dependency.new("RubyGems\0", Gem::VERSION),
753
802
  ]
754
803
  end
@@ -775,7 +824,9 @@ module Bundler
775
824
  # specs will be available later when the resolver knows where to
776
825
  # look for that gemspec (or its dependencies)
777
826
  source_requirements = if precompute_source_requirements_for_indirect_dependencies?
778
- { :default => sources.default_source }.merge(source_map.all_requirements)
827
+ all_requirements = source_map.all_requirements
828
+ all_requirements = pin_locally_available_names(all_requirements) if @prefer_local
829
+ { :default => sources.default_source }.merge(all_requirements)
779
830
  else
780
831
  { :default => Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
781
832
  end
@@ -785,11 +836,22 @@ module Bundler
785
836
  end
786
837
  source_requirements[:default_bundler] = source_requirements["bundler"] || sources.default_source
787
838
  source_requirements["bundler"] = sources.metadata_source # needs to come last to override
839
+ verify_changed_sources!
788
840
  source_requirements
789
841
  end
790
842
 
843
+ def verify_changed_sources!
844
+ @specs_that_changed_sources.each do |s|
845
+ if s.source.specs.search(s.name).empty?
846
+ raise GemNotFound, "Could not find gem '#{s.name}' in #{s.source}"
847
+ end
848
+ end
849
+ end
850
+
791
851
  def requested_groups
792
- groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
852
+ values = groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
853
+ values &= Bundler.settings[:only] unless Bundler.settings[:only].empty?
854
+ values
793
855
  end
794
856
 
795
857
  def lockfiles_equal?(current, proposed, preserve_unknown_sections)
@@ -816,13 +878,22 @@ module Bundler
816
878
  end
817
879
  end
818
880
 
819
- def additional_base_requirements_for_resolve
881
+ def additional_base_requirements_for_resolve(last_resolve)
820
882
  return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
821
- converge_specs(@originally_locked_specs).map do |locked_spec|
822
- name = locked_spec.name
823
- dep = Dependency.new(name, ">= #{locked_spec.version}")
824
- DepProxy.get_proxy(dep, locked_spec.platform)
825
- end
883
+ converge_specs(@originally_locked_specs - last_resolve).map do |locked_spec|
884
+ Dependency.new(locked_spec.name, ">= #{locked_spec.version}")
885
+ end.uniq
886
+ end
887
+
888
+ def remove_ruby_from_platforms_if_necessary!(dependencies)
889
+ return if Bundler.frozen_bundle? ||
890
+ Bundler.local_platform == Gem::Platform::RUBY ||
891
+ !platforms.include?(Gem::Platform::RUBY) ||
892
+ (@new_platform && platforms.last == Gem::Platform::RUBY) ||
893
+ !@originally_locked_specs.incomplete_ruby_specs?(expand_dependencies(dependencies))
894
+
895
+ remove_platform(Gem::Platform::RUBY)
896
+ add_current_platform
826
897
  end
827
898
 
828
899
  def source_map
@@ -7,92 +7,24 @@ require_relative "rubygems_ext"
7
7
  module Bundler
8
8
  class Dependency < Gem::Dependency
9
9
  attr_reader :autorequire
10
- attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref, :force_ruby_platform
10
+ attr_reader :groups, :platforms, :gemfile, :path, :git, :github, :branch, :ref, :force_ruby_platform
11
11
 
12
- # rubocop:disable Naming/VariableNumber
12
+ ALL_RUBY_VERSIONS = ((18..27).to_a + (30..31).to_a).freeze
13
13
  PLATFORM_MAP = {
14
- :ruby => Gem::Platform::RUBY,
15
- :ruby_18 => Gem::Platform::RUBY,
16
- :ruby_19 => Gem::Platform::RUBY,
17
- :ruby_20 => Gem::Platform::RUBY,
18
- :ruby_21 => Gem::Platform::RUBY,
19
- :ruby_22 => Gem::Platform::RUBY,
20
- :ruby_23 => Gem::Platform::RUBY,
21
- :ruby_24 => Gem::Platform::RUBY,
22
- :ruby_25 => Gem::Platform::RUBY,
23
- :ruby_26 => Gem::Platform::RUBY,
24
- :ruby_27 => Gem::Platform::RUBY,
25
- :ruby_30 => Gem::Platform::RUBY,
26
- :ruby_31 => Gem::Platform::RUBY,
27
- :mri => Gem::Platform::RUBY,
28
- :mri_18 => Gem::Platform::RUBY,
29
- :mri_19 => Gem::Platform::RUBY,
30
- :mri_20 => Gem::Platform::RUBY,
31
- :mri_21 => Gem::Platform::RUBY,
32
- :mri_22 => Gem::Platform::RUBY,
33
- :mri_23 => Gem::Platform::RUBY,
34
- :mri_24 => Gem::Platform::RUBY,
35
- :mri_25 => Gem::Platform::RUBY,
36
- :mri_26 => Gem::Platform::RUBY,
37
- :mri_27 => Gem::Platform::RUBY,
38
- :mri_30 => Gem::Platform::RUBY,
39
- :mri_31 => Gem::Platform::RUBY,
40
- :rbx => Gem::Platform::RUBY,
41
- :truffleruby => Gem::Platform::RUBY,
42
- :jruby => Gem::Platform::JAVA,
43
- :jruby_18 => Gem::Platform::JAVA,
44
- :jruby_19 => Gem::Platform::JAVA,
45
- :mswin => Gem::Platform::MSWIN,
46
- :mswin_18 => Gem::Platform::MSWIN,
47
- :mswin_19 => Gem::Platform::MSWIN,
48
- :mswin_20 => Gem::Platform::MSWIN,
49
- :mswin_21 => Gem::Platform::MSWIN,
50
- :mswin_22 => Gem::Platform::MSWIN,
51
- :mswin_23 => Gem::Platform::MSWIN,
52
- :mswin_24 => Gem::Platform::MSWIN,
53
- :mswin_25 => Gem::Platform::MSWIN,
54
- :mswin_26 => Gem::Platform::MSWIN,
55
- :mswin_27 => Gem::Platform::MSWIN,
56
- :mswin_30 => Gem::Platform::MSWIN,
57
- :mswin_31 => Gem::Platform::MSWIN,
58
- :mswin64 => Gem::Platform::MSWIN64,
59
- :mswin64_19 => Gem::Platform::MSWIN64,
60
- :mswin64_20 => Gem::Platform::MSWIN64,
61
- :mswin64_21 => Gem::Platform::MSWIN64,
62
- :mswin64_22 => Gem::Platform::MSWIN64,
63
- :mswin64_23 => Gem::Platform::MSWIN64,
64
- :mswin64_24 => Gem::Platform::MSWIN64,
65
- :mswin64_25 => Gem::Platform::MSWIN64,
66
- :mswin64_26 => Gem::Platform::MSWIN64,
67
- :mswin64_27 => Gem::Platform::MSWIN64,
68
- :mswin64_30 => Gem::Platform::MSWIN64,
69
- :mswin64_31 => Gem::Platform::MSWIN64,
70
- :mingw => Gem::Platform::MINGW,
71
- :mingw_18 => Gem::Platform::MINGW,
72
- :mingw_19 => Gem::Platform::MINGW,
73
- :mingw_20 => Gem::Platform::MINGW,
74
- :mingw_21 => Gem::Platform::MINGW,
75
- :mingw_22 => Gem::Platform::MINGW,
76
- :mingw_23 => Gem::Platform::MINGW,
77
- :mingw_24 => Gem::Platform::MINGW,
78
- :mingw_25 => Gem::Platform::MINGW,
79
- :mingw_26 => Gem::Platform::MINGW,
80
- :mingw_27 => Gem::Platform::MINGW,
81
- :mingw_30 => Gem::Platform::MINGW,
82
- :mingw_31 => Gem::Platform::MINGW,
83
- :x64_mingw => Gem::Platform::X64_MINGW,
84
- :x64_mingw_20 => Gem::Platform::X64_MINGW,
85
- :x64_mingw_21 => Gem::Platform::X64_MINGW,
86
- :x64_mingw_22 => Gem::Platform::X64_MINGW,
87
- :x64_mingw_23 => Gem::Platform::X64_MINGW,
88
- :x64_mingw_24 => Gem::Platform::X64_MINGW,
89
- :x64_mingw_25 => Gem::Platform::X64_MINGW,
90
- :x64_mingw_26 => Gem::Platform::X64_MINGW,
91
- :x64_mingw_27 => Gem::Platform::X64_MINGW,
92
- :x64_mingw_30 => Gem::Platform::X64_MINGW,
93
- :x64_mingw_31 => Gem::Platform::X64_MINGW,
94
- }.freeze
95
- # rubocop:enable Naming/VariableNumber
14
+ :ruby => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
15
+ :mri => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
16
+ :rbx => [Gem::Platform::RUBY],
17
+ :truffleruby => [Gem::Platform::RUBY],
18
+ :jruby => [Gem::Platform::JAVA, [18, 19]],
19
+ :windows => [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS],
20
+ :mswin => [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS],
21
+ :mswin64 => [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]],
22
+ :mingw => [Gem::Platform::MINGW, ALL_RUBY_VERSIONS],
23
+ :x64_mingw => [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]],
24
+ }.each_with_object({}) do |(platform, spec), hash|
25
+ hash[platform] = spec[0]
26
+ spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] }
27
+ end.freeze
96
28
 
97
29
  def initialize(name, version, options = {}, &blk)
98
30
  type = options["type"] || :runtime
@@ -101,6 +33,7 @@ module Bundler
101
33
  @autorequire = nil
102
34
  @groups = Array(options["group"] || :default).map(&:to_sym)
103
35
  @source = options["source"]
36
+ @path = options["path"]
104
37
  @git = options["git"]
105
38
  @github = options["github"]
106
39
  @branch = options["branch"]
@@ -151,7 +84,7 @@ module Bundler
151
84
  def to_lock
152
85
  out = super
153
86
  out << "!" if source
154
- out << "\n"
87
+ out
155
88
  end
156
89
 
157
90
  def specific?
@@ -465,12 +465,12 @@ module Bundler
465
465
 
466
466
  def multiple_global_source_warning
467
467
  if Bundler.feature_flag.bundler_3_mode?
468
- msg = "This Gemfile contains multiple primary sources. " \
468
+ msg = "This Gemfile contains multiple global sources. " \
469
469
  "Each source after the first must include a block to indicate which gems " \
470
470
  "should come from that source"
471
471
  raise GemfileEvalError, msg
472
472
  else
473
- Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
473
+ Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple global sources. " \
474
474
  "Using `source` more than once without a block is a security risk, and " \
475
475
  "may result in installing unexpected gems. To resolve this warning, use " \
476
476
  "a block to indicate which gems should come from the secondary source."
@@ -3,7 +3,7 @@
3
3
  module Bundler
4
4
  # used for Creating Specifications from the Gemcutter Endpoint
5
5
  class EndpointSpecification < Gem::Specification
6
- include MatchPlatform
6
+ include MatchRemoteMetadata
7
7
 
8
8
  attr_reader :name, :version, :platform, :checksum
9
9
  attr_accessor :source, :remote, :dependencies
@@ -12,7 +12,7 @@ module Bundler
12
12
  super()
13
13
  @name = name
14
14
  @version = Gem::Version.create version
15
- @platform = platform
15
+ @platform = Gem::Platform.new(platform)
16
16
  @spec_fetcher = spec_fetcher
17
17
  @dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) }
18
18
 
@@ -22,17 +22,6 @@ module Bundler
22
22
  parse_metadata(metadata)
23
23
  end
24
24
 
25
- def required_ruby_version
26
- @required_ruby_version ||= _remote_specification.required_ruby_version
27
- end
28
-
29
- # A fallback is included because the original version of the specification
30
- # API didn't include that field, so some marshalled specs in the index have it
31
- # set to +nil+.
32
- def required_rubygems_version
33
- @required_rubygems_version ||= _remote_specification.required_rubygems_version || Gem::Requirement.default
34
- end
35
-
36
25
  def fetch_platform
37
26
  @platform
38
27
  end
@@ -39,7 +39,6 @@ module Bundler
39
39
  settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
40
40
  settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
41
41
  settings_flag(:update_requires_all_flag) { bundler_4_mode? }
42
- settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? }
43
42
 
44
43
  settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }
45
44
 
@@ -240,8 +240,8 @@ module Bundler
240
240
  def connection
241
241
  @connection ||= begin
242
242
  needs_ssl = remote_uri.scheme == "https" ||
243
- Bundler.settings[:ssl_verify_mode] ||
244
- Bundler.settings[:ssl_client_cert]
243
+ Bundler.settings[:ssl_verify_mode] ||
244
+ Bundler.settings[:ssl_client_cert]
245
245
  raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
246
246
 
247
247
  con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
@@ -256,8 +256,8 @@ module Bundler
256
256
  end
257
257
 
258
258
  ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
259
- (Gem.configuration.ssl_client_cert if
260
- Gem.configuration.respond_to?(:ssl_client_cert))
259
+ (Gem.configuration.ssl_client_cert if
260
+ Gem.configuration.respond_to?(:ssl_client_cert))
261
261
  if ssl_client_cert
262
262
  pem = File.read(ssl_client_cert)
263
263
  con.cert = OpenSSL::X509::Certificate.new(pem)
@@ -288,8 +288,8 @@ module Bundler
288
288
  def bundler_cert_store
289
289
  store = OpenSSL::X509::Store.new
290
290
  ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
291
- (Gem.configuration.ssl_ca_cert if
292
- Gem.configuration.respond_to?(:ssl_ca_cert))
291
+ (Gem.configuration.ssl_ca_cert if
292
+ Gem.configuration.respond_to?(:ssl_ca_cert))
293
293
  if ssl_ca_cert
294
294
  if File.directory? ssl_ca_cert
295
295
  store.add_path ssl_ca_cert
@@ -44,6 +44,12 @@ module Bundler
44
44
 
45
45
  def select_best_platform_match(specs, platform)
46
46
  matching = specs.select {|spec| spec.match_platform(platform) }
47
+
48
+ sort_best_platform_match(matching, platform)
49
+ end
50
+ module_function :select_best_platform_match
51
+
52
+ def sort_best_platform_match(matching, platform)
47
53
  exact = matching.select {|spec| spec.platform == platform }
48
54
  return exact if exact.any?
49
55
 
@@ -52,7 +58,7 @@ module Bundler
52
58
 
53
59
  sorted_matching.take_while {|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
54
60
  end
55
- module_function :select_best_platform_match
61
+ module_function :sort_best_platform_match
56
62
 
57
63
  class PlatformMatch
58
64
  def self.specificity_score(spec_platform, user_platform)
@@ -55,19 +55,17 @@ module Bundler
55
55
  @level = v
56
56
  end
57
57
 
58
- # Given a Dependency and an Array of SpecGroups of available versions for a
59
- # gem, this method will return the Array of SpecGroups sorted (and possibly
58
+ # Given a Dependency and an Array of Specifications of available versions for a
59
+ # gem, this method will return the Array of Specifications sorted (and possibly
60
60
  # truncated if strict is true) in an order to give preference to the current
61
61
  # level (:major, :minor or :patch) when resolution is deciding what versions
62
62
  # best resolve all dependencies in the bundle.
63
63
  # @param dep [Dependency] The Dependency of the gem.
64
- # @param spec_groups [SpecGroup] An array of SpecGroups for the same gem
64
+ # @param spec_groups [Specification] An array of Specifications for the same gem
65
65
  # named in the @dep param.
66
- # @return [SpecGroup] A new instance of the SpecGroup Array sorted and
66
+ # @return [Specification] A new instance of the Specification Array sorted and
67
67
  # possibly filtered.
68
68
  def sort_versions(dep, spec_groups)
69
- before_result = "before sort_versions: #{debug_format_result(dep, spec_groups).inspect}" if DEBUG
70
-
71
69
  @sort_versions[dep] ||= begin
72
70
  gem_name = dep.name
73
71
 
@@ -79,15 +77,14 @@ module Bundler
79
77
  filter_dep_specs(spec_groups, locked_spec)
80
78
  else
81
79
  sort_dep_specs(spec_groups, locked_spec)
82
- end.tap do |specs|
83
- if DEBUG
84
- puts before_result
85
- puts " after sort_versions: #{debug_format_result(dep, specs).inspect}"
86
- end
87
80
  end
88
81
  end
89
82
  end
90
83
 
84
+ def reset
85
+ @sort_versions = {}
86
+ end
87
+
91
88
  # @return [bool] Convenience method for testing value of level variable.
92
89
  def major?
93
90
  level == :major
@@ -179,12 +176,5 @@ module Bundler
179
176
  move, keep = result.partition {|s| s.version.to_s == version.to_s }
180
177
  keep.concat(move)
181
178
  end
182
-
183
- def debug_format_result(dep, spec_groups)
184
- a = [dep.to_s,
185
- spec_groups.map {|sg| [sg.version, sg.dependencies_for_activated_platforms.map {|dp| [dp.name, dp.requirement.to_s] }] }]
186
- last_map = a.last.map {|sg_data| [sg_data.first.version, sg_data.last.map {|aa| aa.join(" ") }] }
187
- [a.first, last_map, level, strict ? :strict : :not_strict]
188
- end
189
179
  end
190
180
  end
@@ -56,17 +56,17 @@ module Bundler
56
56
 
57
57
  # Search this index's specs, and any source indexes that this index knows
58
58
  # about, returning all of the results.
59
- def search(query, base = nil)
60
- sort_specs(unsorted_search(query, base))
59
+ def search(query)
60
+ sort_specs(unsorted_search(query))
61
61
  end
62
62
 
63
- def unsorted_search(query, base)
64
- results = local_search(query, base)
63
+ def unsorted_search(query)
64
+ results = local_search(query)
65
65
 
66
66
  seen = results.map(&:full_name).uniq unless @sources.empty?
67
67
 
68
68
  @sources.each do |source|
69
- source.unsorted_search(query, base).each do |spec|
69
+ source.unsorted_search(query).each do |spec|
70
70
  next if seen.include?(spec.full_name)
71
71
 
72
72
  seen << spec.full_name
@@ -89,12 +89,12 @@ module Bundler
89
89
  self.class.sort_specs(specs)
90
90
  end
91
91
 
92
- def local_search(query, base = nil)
92
+ def local_search(query)
93
93
  case query
94
94
  when Gem::Specification, RemoteSpecification, LazySpecification, EndpointSpecification then search_by_spec(query)
95
95
  when String then specs_by_name(query)
96
- when Gem::Dependency then search_by_dependency(query, base)
97
- when DepProxy then search_by_dependency(query.dep, base)
96
+ when Gem::Dependency then search_by_dependency(query)
97
+ when DepProxy then search_by_dependency(query.dep)
98
98
  else
99
99
  raise "You can't search for a #{query.inspect}."
100
100
  end
@@ -185,11 +185,9 @@ module Bundler
185
185
  @specs[name].values
186
186
  end
187
187
 
188
- def search_by_dependency(dependency, base = nil)
189
- @cache[base || false] ||= {}
190
- @cache[base || false][dependency] ||= begin
188
+ def search_by_dependency(dependency)
189
+ @cache[dependency] ||= begin
191
190
  specs = specs_by_name(dependency.name)
192
- specs += base if base
193
191
  found = specs.select do |spec|
194
192
  next true if spec.source.is_a?(Source::Gemspec)
195
193
  dependency.matches_spec?(spec)
@@ -115,13 +115,14 @@ module Bundler
115
115
  end
116
116
 
117
117
  source = ", :source => \"#{d.source}\"" unless d.source.nil?
118
+ path = ", :path => \"#{d.path}\"" unless d.path.nil?
118
119
  git = ", :git => \"#{d.git}\"" unless d.git.nil?
119
120
  github = ", :github => \"#{d.github}\"" unless d.github.nil?
120
121
  branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil?
121
122
  ref = ", :ref => \"#{d.ref}\"" unless d.ref.nil?
122
123
  require_path = ", :require => #{convert_autorequire(d.autorequire)}" unless d.autorequire.nil?
123
124
 
124
- %(gem #{name}#{requirement}#{group}#{source}#{git}#{github}#{branch}#{ref}#{require_path})
125
+ %(gem #{name}#{requirement}#{group}#{source}#{path}#{git}#{github}#{branch}#{ref}#{require_path})
125
126
  end.join("\n")
126
127
  end
127
128
 
@@ -54,7 +54,7 @@ def gemfile(install = false, options = {}, &gemfile)
54
54
 
55
55
  Bundler.ui = install ? ui : Bundler::UI::Silent.new
56
56
  if install || definition.missing_specs?
57
- Bundler.settings.temporary(:inline => true) do
57
+ Bundler.settings.temporary(:inline => true, :no_install => false) do
58
58
  installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
59
59
  installer.post_install_messages.each do |name, message|
60
60
  Bundler.ui.info "Post-install message from #{name}:\n#{message}"
@@ -47,7 +47,7 @@ module Bundler
47
47
  end
48
48
 
49
49
  def bundler_path
50
- Bundler.root.join(Bundler.settings[:path], "bundler")
50
+ Bundler.root.join(Bundler.settings[:path].to_s, "bundler")
51
51
  end
52
52
 
53
53
  def gem_path(path, spec)