bundler 2.3.12 → 2.4.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +535 -1
  3. data/README.md +3 -6
  4. data/bundler.gemspec +8 -10
  5. data/exe/bundle +5 -16
  6. data/lib/bundler/build_metadata.rb +2 -2
  7. data/lib/bundler/cli/add.rb +1 -1
  8. data/lib/bundler/cli/binstubs.rb +5 -1
  9. data/lib/bundler/cli/check.rb +1 -1
  10. data/lib/bundler/cli/common.rb +3 -1
  11. data/lib/bundler/cli/console.rb +2 -2
  12. data/lib/bundler/cli/doctor.rb +4 -6
  13. data/lib/bundler/cli/gem.rb +62 -40
  14. data/lib/bundler/cli/init.rb +6 -2
  15. data/lib/bundler/cli/install.rb +7 -5
  16. data/lib/bundler/cli/lock.rb +8 -5
  17. data/lib/bundler/cli/open.rb +6 -4
  18. data/lib/bundler/cli/outdated.rb +13 -6
  19. data/lib/bundler/cli/platform.rb +1 -1
  20. data/lib/bundler/cli/viz.rb +1 -1
  21. data/lib/bundler/cli.rb +53 -7
  22. data/lib/bundler/compact_index_client/cache.rb +1 -1
  23. data/lib/bundler/compact_index_client/updater.rb +53 -39
  24. data/lib/bundler/constants.rb +1 -1
  25. data/lib/bundler/current_ruby.rb +17 -6
  26. data/lib/bundler/definition.rb +277 -139
  27. data/lib/bundler/dependency.rb +21 -84
  28. data/lib/bundler/digest.rb +1 -1
  29. data/lib/bundler/dsl.rb +13 -18
  30. data/lib/bundler/endpoint_specification.rb +2 -10
  31. data/lib/bundler/env.rb +1 -1
  32. data/lib/bundler/environment_preserver.rb +3 -2
  33. data/lib/bundler/errors.rb +15 -15
  34. data/lib/bundler/feature_flag.rb +0 -2
  35. data/lib/bundler/fetcher/base.rb +6 -8
  36. data/lib/bundler/fetcher/compact_index.rb +9 -11
  37. data/lib/bundler/fetcher/dependency.rb +2 -6
  38. data/lib/bundler/fetcher/downloader.rb +2 -5
  39. data/lib/bundler/fetcher.rb +14 -14
  40. data/lib/bundler/force_platform.rb +18 -0
  41. data/lib/bundler/friendly_errors.rb +21 -7
  42. data/lib/bundler/gem_helpers.rb +9 -2
  43. data/lib/bundler/gem_version_promoter.rb +53 -98
  44. data/lib/bundler/graph.rb +3 -3
  45. data/lib/bundler/index.rb +13 -51
  46. data/lib/bundler/injector.rb +9 -4
  47. data/lib/bundler/inline.rb +9 -21
  48. data/lib/bundler/installer/gem_installer.rb +14 -1
  49. data/lib/bundler/installer/parallel_installer.rb +3 -33
  50. data/lib/bundler/installer/standalone.rb +42 -11
  51. data/lib/bundler/installer.rb +19 -40
  52. data/lib/bundler/lazy_specification.rb +55 -54
  53. data/lib/bundler/lockfile_generator.rb +3 -3
  54. data/lib/bundler/lockfile_parser.rb +21 -16
  55. data/lib/bundler/man/bundle-add.1 +13 -5
  56. data/lib/bundler/man/bundle-add.1.ronn +10 -4
  57. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  58. data/lib/bundler/man/bundle-cache.1 +9 -3
  59. data/lib/bundler/man/bundle-cache.1.ronn +9 -2
  60. data/lib/bundler/man/bundle-check.1 +1 -1
  61. data/lib/bundler/man/bundle-clean.1 +2 -2
  62. data/lib/bundler/man/bundle-clean.1.ronn +1 -1
  63. data/lib/bundler/man/bundle-config.1 +26 -10
  64. data/lib/bundler/man/bundle-config.1.ronn +17 -10
  65. data/lib/bundler/man/bundle-console.1 +53 -0
  66. data/lib/bundler/man/bundle-console.1.ronn +44 -0
  67. data/lib/bundler/man/bundle-doctor.1 +1 -1
  68. data/lib/bundler/man/bundle-exec.1 +6 -6
  69. data/lib/bundler/man/bundle-exec.1.ronn +6 -6
  70. data/lib/bundler/man/bundle-gem.1 +27 -37
  71. data/lib/bundler/man/bundle-gem.1.ronn +5 -5
  72. data/lib/bundler/man/bundle-help.1 +13 -0
  73. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  74. data/lib/bundler/man/bundle-info.1 +1 -1
  75. data/lib/bundler/man/bundle-init.1 +5 -1
  76. data/lib/bundler/man/bundle-init.1.ronn +2 -0
  77. data/lib/bundler/man/bundle-inject.1 +5 -2
  78. data/lib/bundler/man/bundle-inject.1.ronn +3 -1
  79. data/lib/bundler/man/bundle-install.1 +5 -30
  80. data/lib/bundler/man/bundle-install.1.ronn +6 -29
  81. data/lib/bundler/man/bundle-list.1 +1 -1
  82. data/lib/bundler/man/bundle-lock.1 +1 -1
  83. data/lib/bundler/man/bundle-open.1 +22 -2
  84. data/lib/bundler/man/bundle-open.1.ronn +9 -1
  85. data/lib/bundler/man/bundle-outdated.1 +13 -9
  86. data/lib/bundler/man/bundle-outdated.1.ronn +12 -9
  87. data/lib/bundler/man/bundle-platform.1 +16 -6
  88. data/lib/bundler/man/bundle-platform.1.ronn +14 -7
  89. data/lib/bundler/man/bundle-plugin.1 +81 -0
  90. data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  91. data/lib/bundler/man/bundle-pristine.1 +1 -1
  92. data/lib/bundler/man/bundle-remove.1 +1 -1
  93. data/lib/bundler/man/bundle-show.1 +1 -1
  94. data/lib/bundler/man/bundle-update.1 +1 -1
  95. data/lib/bundler/man/bundle-version.1 +35 -0
  96. data/lib/bundler/man/bundle-version.1.ronn +24 -0
  97. data/lib/bundler/man/bundle-viz.1 +4 -1
  98. data/lib/bundler/man/bundle-viz.1.ronn +2 -0
  99. data/lib/bundler/man/bundle.1 +15 -10
  100. data/lib/bundler/man/bundle.1.ronn +12 -7
  101. data/lib/bundler/man/gemfile.5 +93 -82
  102. data/lib/bundler/man/gemfile.5.ronn +99 -86
  103. data/lib/bundler/man/index.txt +4 -0
  104. data/lib/bundler/match_metadata.rb +13 -0
  105. data/lib/bundler/match_platform.rb +0 -1
  106. data/lib/bundler/match_remote_metadata.rb +29 -0
  107. data/lib/bundler/mirror.rb +5 -7
  108. data/lib/bundler/plugin/api/source.rb +3 -3
  109. data/lib/bundler/plugin/index.rb +4 -4
  110. data/lib/bundler/plugin/installer/git.rb +0 -4
  111. data/lib/bundler/plugin/installer/rubygems.rb +0 -8
  112. data/lib/bundler/plugin/installer.rb +5 -2
  113. data/lib/bundler/plugin.rb +3 -1
  114. data/lib/bundler/process_lock.rb +1 -1
  115. data/lib/bundler/remote_specification.rb +7 -12
  116. data/lib/bundler/resolver/base.rb +107 -0
  117. data/lib/bundler/resolver/candidate.rb +94 -0
  118. data/lib/bundler/resolver/incompatibility.rb +15 -0
  119. data/lib/bundler/resolver/package.rb +72 -0
  120. data/lib/bundler/resolver/root.rb +25 -0
  121. data/lib/bundler/resolver/spec_group.rb +42 -70
  122. data/lib/bundler/resolver.rb +333 -326
  123. data/lib/bundler/ruby_dsl.rb +1 -1
  124. data/lib/bundler/ruby_version.rb +6 -6
  125. data/lib/bundler/rubygems_ext.rb +107 -15
  126. data/lib/bundler/rubygems_gem_installer.rb +32 -20
  127. data/lib/bundler/rubygems_integration.rb +13 -35
  128. data/lib/bundler/runtime.rb +2 -7
  129. data/lib/bundler/safe_marshal.rb +31 -0
  130. data/lib/bundler/settings.rb +6 -12
  131. data/lib/bundler/setup.rb +4 -1
  132. data/lib/bundler/shared_helpers.rb +8 -8
  133. data/lib/bundler/source/git/git_proxy.rb +237 -74
  134. data/lib/bundler/source/git.rb +54 -38
  135. data/lib/bundler/source/metadata.rb +1 -2
  136. data/lib/bundler/source/path/installer.rb +1 -22
  137. data/lib/bundler/source/path.rb +7 -7
  138. data/lib/bundler/source/rubygems.rb +85 -128
  139. data/lib/bundler/source.rb +4 -5
  140. data/lib/bundler/source_list.rb +12 -2
  141. data/lib/bundler/spec_set.rb +62 -34
  142. data/lib/bundler/stub_specification.rb +5 -3
  143. data/lib/bundler/templates/Executable +1 -1
  144. data/lib/bundler/templates/Executable.bundler +5 -10
  145. data/lib/bundler/templates/Executable.standalone +2 -0
  146. data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  147. data/lib/bundler/templates/newgem/Gemfile.tt +3 -0
  148. data/lib/bundler/templates/newgem/README.md.tt +6 -4
  149. data/lib/bundler/templates/newgem/Rakefile.tt +12 -1
  150. data/lib/bundler/templates/newgem/bin/console.tt +0 -4
  151. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  152. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  153. data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
  154. data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  155. data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
  156. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  157. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +10 -0
  158. data/lib/bundler/templates/newgem/gitignore.tt +3 -0
  159. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
  160. data/lib/bundler/templates/newgem/newgem.gemspec.tt +9 -2
  161. data/lib/bundler/ui/shell.rb +35 -12
  162. data/lib/bundler/ui/silent.rb +21 -5
  163. data/lib/bundler/uri_normalizer.rb +23 -0
  164. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +3 -3
  165. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +0 -1
  166. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -1
  167. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1351 -409
  168. data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  169. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
  170. data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  171. data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  172. data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  173. data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  174. data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
  175. data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  176. data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  177. data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  178. data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  179. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
  180. data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  181. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  182. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
  183. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
  184. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -0
  185. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  186. data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  187. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +1 -1
  188. data/lib/bundler/vendor/uri/lib/uri/common.rb +64 -16
  189. data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
  190. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -1
  191. data/lib/bundler/vendor/uri/lib/uri/generic.rb +27 -7
  192. data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -2
  193. data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -1
  194. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  195. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
  196. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -2
  197. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +15 -9
  198. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +11 -6
  199. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  200. data/lib/bundler/vendor/uri/lib/uri/ws.rb +1 -2
  201. data/lib/bundler/vendor/uri/lib/uri/wss.rb +2 -1
  202. data/lib/bundler/vendor/uri/lib/uri.rb +3 -2
  203. data/lib/bundler/vendored_persistent.rb +1 -33
  204. data/lib/bundler/{vendored_tmpdir.rb → vendored_pub_grub.rb} +1 -1
  205. data/lib/bundler/version.rb +5 -1
  206. data/lib/bundler/worker.rb +5 -7
  207. data/lib/bundler.rb +36 -77
  208. metadata +47 -35
  209. data/lib/bundler/dep_proxy.rb +0 -55
  210. data/lib/bundler/templates/gems.rb +0 -5
  211. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -5
  212. data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
  213. data/lib/bundler/vendor/molinillo/LICENSE +0 -9
  214. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  215. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
  216. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  217. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  218. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  219. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  220. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  221. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  222. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  223. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  224. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
  225. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
  226. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -149
  227. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  228. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
  229. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  230. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
  231. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  232. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  233. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
  234. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
  235. data/lib/bundler/vendored_molinillo.rb +0 -4
  236. data/lib/bundler/version_ranges.rb +0 -122
@@ -7,90 +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
10
+ attr_reader :groups, :platforms, :gemfile, :path, :git, :github, :branch, :ref
11
11
 
12
+ ALL_RUBY_VERSIONS = ((18..27).to_a + (30..33).to_a).freeze
12
13
  PLATFORM_MAP = {
13
- :ruby => Gem::Platform::RUBY,
14
- :ruby_18 => Gem::Platform::RUBY,
15
- :ruby_19 => Gem::Platform::RUBY,
16
- :ruby_20 => Gem::Platform::RUBY,
17
- :ruby_21 => Gem::Platform::RUBY,
18
- :ruby_22 => Gem::Platform::RUBY,
19
- :ruby_23 => Gem::Platform::RUBY,
20
- :ruby_24 => Gem::Platform::RUBY,
21
- :ruby_25 => Gem::Platform::RUBY,
22
- :ruby_26 => Gem::Platform::RUBY,
23
- :ruby_27 => Gem::Platform::RUBY,
24
- :ruby_30 => Gem::Platform::RUBY,
25
- :ruby_31 => Gem::Platform::RUBY,
26
- :mri => Gem::Platform::RUBY,
27
- :mri_18 => Gem::Platform::RUBY,
28
- :mri_19 => Gem::Platform::RUBY,
29
- :mri_20 => Gem::Platform::RUBY,
30
- :mri_21 => Gem::Platform::RUBY,
31
- :mri_22 => Gem::Platform::RUBY,
32
- :mri_23 => Gem::Platform::RUBY,
33
- :mri_24 => Gem::Platform::RUBY,
34
- :mri_25 => Gem::Platform::RUBY,
35
- :mri_26 => Gem::Platform::RUBY,
36
- :mri_27 => Gem::Platform::RUBY,
37
- :mri_30 => Gem::Platform::RUBY,
38
- :mri_31 => Gem::Platform::RUBY,
39
- :rbx => Gem::Platform::RUBY,
40
- :truffleruby => Gem::Platform::RUBY,
41
- :jruby => Gem::Platform::JAVA,
42
- :jruby_18 => Gem::Platform::JAVA,
43
- :jruby_19 => Gem::Platform::JAVA,
44
- :mswin => Gem::Platform::MSWIN,
45
- :mswin_18 => Gem::Platform::MSWIN,
46
- :mswin_19 => Gem::Platform::MSWIN,
47
- :mswin_20 => Gem::Platform::MSWIN,
48
- :mswin_21 => Gem::Platform::MSWIN,
49
- :mswin_22 => Gem::Platform::MSWIN,
50
- :mswin_23 => Gem::Platform::MSWIN,
51
- :mswin_24 => Gem::Platform::MSWIN,
52
- :mswin_25 => Gem::Platform::MSWIN,
53
- :mswin_26 => Gem::Platform::MSWIN,
54
- :mswin_27 => Gem::Platform::MSWIN,
55
- :mswin_30 => Gem::Platform::MSWIN,
56
- :mswin_31 => Gem::Platform::MSWIN,
57
- :mswin64 => Gem::Platform::MSWIN64,
58
- :mswin64_19 => Gem::Platform::MSWIN64,
59
- :mswin64_20 => Gem::Platform::MSWIN64,
60
- :mswin64_21 => Gem::Platform::MSWIN64,
61
- :mswin64_22 => Gem::Platform::MSWIN64,
62
- :mswin64_23 => Gem::Platform::MSWIN64,
63
- :mswin64_24 => Gem::Platform::MSWIN64,
64
- :mswin64_25 => Gem::Platform::MSWIN64,
65
- :mswin64_26 => Gem::Platform::MSWIN64,
66
- :mswin64_27 => Gem::Platform::MSWIN64,
67
- :mswin64_30 => Gem::Platform::MSWIN64,
68
- :mswin64_31 => Gem::Platform::MSWIN64,
69
- :mingw => Gem::Platform::MINGW,
70
- :mingw_18 => Gem::Platform::MINGW,
71
- :mingw_19 => Gem::Platform::MINGW,
72
- :mingw_20 => Gem::Platform::MINGW,
73
- :mingw_21 => Gem::Platform::MINGW,
74
- :mingw_22 => Gem::Platform::MINGW,
75
- :mingw_23 => Gem::Platform::MINGW,
76
- :mingw_24 => Gem::Platform::MINGW,
77
- :mingw_25 => Gem::Platform::MINGW,
78
- :mingw_26 => Gem::Platform::MINGW,
79
- :mingw_27 => Gem::Platform::MINGW,
80
- :mingw_30 => Gem::Platform::MINGW,
81
- :mingw_31 => Gem::Platform::MINGW,
82
- :x64_mingw => Gem::Platform::X64_MINGW,
83
- :x64_mingw_20 => Gem::Platform::X64_MINGW,
84
- :x64_mingw_21 => Gem::Platform::X64_MINGW,
85
- :x64_mingw_22 => Gem::Platform::X64_MINGW,
86
- :x64_mingw_23 => Gem::Platform::X64_MINGW,
87
- :x64_mingw_24 => Gem::Platform::X64_MINGW,
88
- :x64_mingw_25 => Gem::Platform::X64_MINGW,
89
- :x64_mingw_26 => Gem::Platform::X64_MINGW,
90
- :x64_mingw_27 => Gem::Platform::X64_MINGW,
91
- :x64_mingw_30 => Gem::Platform::X64_MINGW,
92
- :x64_mingw_31 => Gem::Platform::X64_MINGW,
93
- }.freeze
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
94
28
 
95
29
  def initialize(name, version, options = {}, &blk)
96
30
  type = options["type"] || :runtime
@@ -99,6 +33,7 @@ module Bundler
99
33
  @autorequire = nil
100
34
  @groups = Array(options["group"] || :default).map(&:to_sym)
101
35
  @source = options["source"]
36
+ @path = options["path"]
102
37
  @git = options["git"]
103
38
  @github = options["github"]
104
39
  @branch = options["branch"]
@@ -107,6 +42,7 @@ module Bundler
107
42
  @env = options["env"]
108
43
  @should_include = options.fetch("should_include", true)
109
44
  @gemfile = options["gemfile"]
45
+ @force_ruby_platform = options["force_ruby_platform"] if options.key?("force_ruby_platform")
110
46
 
111
47
  @autorequire = Array(options["require"] || []) if options.key?("require")
112
48
  end
@@ -114,13 +50,14 @@ module Bundler
114
50
  # Returns the platforms this dependency is valid for, in the same order as
115
51
  # passed in the `valid_platforms` parameter
116
52
  def gem_platforms(valid_platforms)
53
+ return [Gem::Platform::RUBY] if force_ruby_platform
117
54
  return valid_platforms if @platforms.empty?
118
55
 
119
56
  valid_platforms.select {|p| expanded_platforms.include?(GemHelpers.generic(p)) }
120
57
  end
121
58
 
122
59
  def expanded_platforms
123
- @expanded_platforms ||= @platforms.map {|pl| PLATFORM_MAP[pl] }.compact.uniq
60
+ @expanded_platforms ||= @platforms.map {|pl| PLATFORM_MAP[pl] }.compact.flatten.uniq
124
61
  end
125
62
 
126
63
  def should_include?
@@ -148,7 +85,7 @@ module Bundler
148
85
  def to_lock
149
86
  out = super
150
87
  out << "!" if source
151
- out << "\n"
88
+ out
152
89
  end
153
90
 
154
91
  def specific?
@@ -43,7 +43,7 @@ module Bundler
43
43
  f = (b ^ c ^ d)
44
44
  k = 0xCA62C1D6
45
45
  end
46
- t = SHA1_MASK & (SHA1_MASK & rotate(a, 5) + f + e + k + w[i])
46
+ t = SHA1_MASK & rotate(a, 5) + f + e + k + w[i]
47
47
  a, b, c, d, e = t, a, SHA1_MASK & rotate(b, 30), c, d # rubocop:disable Style/ParallelAssignment
48
48
  end
49
49
  mutated = [a, b, c, d, e]
data/lib/bundler/dsl.rb CHANGED
@@ -16,7 +16,7 @@ module Bundler
16
16
  VALID_PLATFORMS = Bundler::Dependency::PLATFORM_MAP.keys.freeze
17
17
 
18
18
  VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules
19
- platform platforms type source install_if gemfile].freeze
19
+ platform platforms type source install_if gemfile force_ruby_platform].freeze
20
20
 
21
21
  GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}.freeze
22
22
 
@@ -46,7 +46,7 @@ module Bundler
46
46
  @gemfile = expanded_gemfile_path
47
47
  @gemfiles << expanded_gemfile_path
48
48
  contents ||= Bundler.read_file(@gemfile.to_s)
49
- instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
49
+ instance_eval(contents.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
50
50
  rescue Exception => e # rubocop:disable Lint/RescueException
51
51
  message = "There was an error " \
52
52
  "#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
@@ -67,7 +67,6 @@ module Bundler
67
67
 
68
68
  gemspecs = Gem::Util.glob_files_in_dir("{,*}.gemspec", expanded_path).map {|g| Bundler.load_gemspec(g) }.compact
69
69
  gemspecs.reject! {|s| s.name != name } if name
70
- Index.sort_specs(gemspecs)
71
70
  specs_by_name_and_version = gemspecs.group_by {|s| [s.name, s.version] }
72
71
 
73
72
  case specs_by_name_and_version.size
@@ -124,19 +123,17 @@ module Bundler
124
123
  raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
125
124
  "You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
126
125
  "#{update_prompt}"
126
+ elsif current.source != dep.source
127
+ return if dep.type == :development
128
+ raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
129
+ "You specified that #{dep.name} (#{dep.requirement}) should come from " \
130
+ "#{current.source || "an unspecified source"} and #{dep.source}\n"
127
131
  else
128
132
  Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
129
133
  "You should probably keep only one of them.\n" \
130
134
  "Remove any duplicate entries and specify the gem only once.\n" \
131
135
  "While it's not a problem now, it could cause errors if you change the version of one of them later."
132
136
  end
133
-
134
- if current.source != dep.source
135
- return if dep.type == :development
136
- raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
137
- "You specified that #{dep.name} (#{dep.requirement}) should come from " \
138
- "#{current.source || "an unspecified source"} and #{dep.source}\n"
139
- end
140
137
  end
141
138
  end
142
139
 
@@ -280,8 +277,8 @@ module Bundler
280
277
  if repo_name =~ GITHUB_PULL_REQUEST_URL
281
278
  {
282
279
  "git" => "https://github.com/#{$1}.git",
283
- "branch" => "refs/pull/#{$2}/head",
284
- "ref" => nil,
280
+ "branch" => nil,
281
+ "ref" => "refs/pull/#{$2}/head",
285
282
  "tag" => nil,
286
283
  }
287
284
  else
@@ -327,7 +324,7 @@ module Bundler
327
324
  if name.is_a?(Symbol)
328
325
  raise GemfileError, %(You need to specify gem names as Strings. Use 'gem "#{name}"' instead)
329
326
  end
330
- if name =~ /\s/
327
+ if /\s/.match?(name)
331
328
  raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace)
332
329
  end
333
330
  raise GemfileError, %(an empty gem name is not valid) if name.empty?
@@ -467,12 +464,12 @@ module Bundler
467
464
 
468
465
  def multiple_global_source_warning
469
466
  if Bundler.feature_flag.bundler_3_mode?
470
- msg = "This Gemfile contains multiple primary sources. " \
467
+ msg = "This Gemfile contains multiple global sources. " \
471
468
  "Each source after the first must include a block to indicate which gems " \
472
469
  "should come from that source"
473
470
  raise GemfileEvalError, msg
474
471
  else
475
- Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
472
+ Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple global sources. " \
476
473
  "Using `source` more than once without a block is a security risk, and " \
477
474
  "may result in installing unexpected gems. To resolve this warning, use " \
478
475
  "a block to indicate which gems should come from the secondary source."
@@ -513,9 +510,7 @@ module Bundler
513
510
  # be raised.
514
511
  #
515
512
  def contents
516
- @contents ||= begin
517
- dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
518
- end
513
+ @contents ||= dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
519
514
  end
520
515
 
521
516
  # The message of the exception reports the content of podspec for the
@@ -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,14 +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
- def required_rubygems_version
30
- @required_rubygems_version ||= _remote_specification.required_rubygems_version
31
- end
32
-
33
25
  def fetch_platform
34
26
  @platform
35
27
  end
data/lib/bundler/env.rb CHANGED
@@ -75,7 +75,7 @@ module Bundler
75
75
  end
76
76
 
77
77
  def self.git_version
78
- Bundler::Source::Git::GitProxy.new(nil, nil, nil).full_version
78
+ Bundler::Source::Git::GitProxy.new(nil, nil).full_version
79
79
  rescue Bundler::Source::Git::GitNotInstalledError
80
80
  "not installed"
81
81
  end
@@ -2,11 +2,12 @@
2
2
 
3
3
  module Bundler
4
4
  class EnvironmentPreserver
5
- INTENTIONALLY_NIL = "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL".freeze
5
+ INTENTIONALLY_NIL = "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL"
6
6
  BUNDLER_KEYS = %w[
7
7
  BUNDLE_BIN_PATH
8
8
  BUNDLE_GEMFILE
9
9
  BUNDLER_VERSION
10
+ BUNDLER_SETUP
10
11
  GEM_HOME
11
12
  GEM_PATH
12
13
  MANPATH
@@ -15,7 +16,7 @@ module Bundler
15
16
  RUBYLIB
16
17
  RUBYOPT
17
18
  ].map(&:freeze).freeze
18
- BUNDLER_PREFIX = "BUNDLER_ORIG_".freeze
19
+ BUNDLER_PREFIX = "BUNDLER_ORIG_"
19
20
 
20
21
  def self.from_env
21
22
  new(env_to_hash(ENV), BUNDLER_KEYS)
@@ -21,16 +21,7 @@ module Bundler
21
21
  class InstallError < BundlerError; status_code(5); end
22
22
 
23
23
  # Internal error, should be rescued
24
- class VersionConflict < BundlerError
25
- attr_reader :conflicts
26
-
27
- def initialize(conflicts, msg = nil)
28
- super(msg)
29
- @conflicts = conflicts
30
- end
31
-
32
- status_code(6)
33
- end
24
+ class SolveFailure < BundlerError; status_code(6); end
34
25
 
35
26
  class GemNotFound < BundlerError; status_code(7); end
36
27
  class InstallHookError < BundlerError; status_code(8); end
@@ -41,19 +32,20 @@ module Bundler
41
32
  class GemspecError < BundlerError; status_code(14); end
42
33
  class InvalidOption < BundlerError; status_code(15); end
43
34
  class ProductionError < BundlerError; status_code(16); end
35
+
44
36
  class HTTPError < BundlerError
45
37
  status_code(17)
46
38
  def filter_uri(uri)
47
39
  URICredentialsFilter.credential_filtered_uri(uri)
48
40
  end
49
41
  end
42
+
50
43
  class RubyVersionMismatch < BundlerError; status_code(18); end
51
44
  class SecurityError < BundlerError; status_code(19); end
52
45
  class LockfileError < BundlerError; status_code(20); end
53
46
  class CyclicDependencyError < BundlerError; status_code(21); end
54
47
  class GemfileLockNotFound < BundlerError; status_code(22); end
55
48
  class PluginError < BundlerError; status_code(29); end
56
- class SudoNotPermittedError < BundlerError; status_code(30); end
57
49
  class ThreadCreationError < BundlerError; status_code(33); end
58
50
  class APIResponseMismatchError < BundlerError; status_code(34); end
59
51
  class APIResponseInvalidDependenciesError < BundlerError; status_code(35); end
@@ -79,10 +71,6 @@ module Bundler
79
71
  case @permission_type
80
72
  when :create
81
73
  "executable permissions for all parent directories and write permissions for `#{parent_folder}`"
82
- when :delete
83
- permissions = "executable permissions for all parent directories and write permissions for `#{parent_folder}`"
84
- permissions += ", and the same thing for all subdirectories inside #{@path}" if File.directory?(@path)
85
- permissions
86
74
  else
87
75
  "#{@permission_type} permissions for that path"
88
76
  end
@@ -172,4 +160,16 @@ module Bundler
172
160
 
173
161
  status_code(32)
174
162
  end
163
+
164
+ class DirectoryRemovalError < BundlerError
165
+ def initialize(orig_exception, msg)
166
+ full_message = "#{msg}.\n" \
167
+ "The underlying error was #{orig_exception.class}: #{orig_exception.message}, with backtrace:\n" \
168
+ " #{orig_exception.backtrace.join("\n ")}\n\n" \
169
+ "Bundler Error Backtrace:"
170
+ super(full_message)
171
+ end
172
+
173
+ status_code(36)
174
+ end
175
175
  end
@@ -37,9 +37,7 @@ module Bundler
37
37
  settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
38
38
  settings_flag(:print_only_version_number) { bundler_3_mode? }
39
39
  settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
40
- settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
41
40
  settings_flag(:update_requires_all_flag) { bundler_4_mode? }
42
- settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? }
43
41
 
44
42
  settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }
45
43
 
@@ -19,14 +19,12 @@ module Bundler
19
19
  end
20
20
 
21
21
  def fetch_uri
22
- @fetch_uri ||= begin
23
- if remote_uri.host == "rubygems.org"
24
- uri = remote_uri.dup
25
- uri.host = "index.rubygems.org"
26
- uri
27
- else
28
- remote_uri
29
- end
22
+ @fetch_uri ||= if remote_uri.host == "rubygems.org"
23
+ uri = remote_uri.dup
24
+ uri.host = "index.rubygems.org"
25
+ uri
26
+ else
27
+ remote_uri
30
28
  end
31
29
  end
32
30
 
@@ -12,17 +12,15 @@ module Bundler
12
12
  method = instance_method(method_name)
13
13
  undef_method(method_name)
14
14
  define_method(method_name) do |*args, &blk|
15
- begin
16
- method.bind(self).call(*args, &blk)
17
- rescue NetworkDownError, CompactIndexClient::Updater::MisMatchedChecksumError => e
18
- raise HTTPError, e.message
19
- rescue AuthenticationRequiredError
20
- # Fail since we got a 401 from the server.
21
- raise
22
- rescue HTTPError => e
23
- Bundler.ui.trace(e)
24
- nil
25
- end
15
+ method.bind(self).call(*args, &blk)
16
+ rescue NetworkDownError, CompactIndexClient::Updater::MisMatchedChecksumError => e
17
+ raise HTTPError, e.message
18
+ rescue AuthenticationRequiredError
19
+ # Fail since we got a 401 from the server.
20
+ raise
21
+ rescue HTTPError => e
22
+ Bundler.ui.trace(e)
23
+ nil
26
24
  end
27
25
  end
28
26
 
@@ -34,14 +34,10 @@ module Bundler
34
34
 
35
35
  returned_gems = spec_list.map(&:first).uniq
36
36
  specs(deps_list, full_dependency_list + returned_gems, spec_list + last_spec_list)
37
- rescue MarshalError
37
+ rescue MarshalError, HTTPError, GemspecError
38
38
  Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
39
39
  Bundler.ui.debug "could not fetch from the dependency API, trying the full index"
40
40
  nil
41
- rescue HTTPError, GemspecError
42
- Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
43
- Bundler.ui.debug "could not fetch from the dependency API\nit's suggested to retry using the full index via `bundle install --full-index`"
44
- nil
45
41
  end
46
42
 
47
43
  def dependency_specs(gem_names)
@@ -55,7 +51,7 @@ module Bundler
55
51
  gem_list = []
56
52
  gem_names.each_slice(Source::Rubygems::API_REQUEST_SIZE) do |names|
57
53
  marshalled_deps = downloader.fetch(dependency_api_uri(names)).body
58
- gem_list.concat(Bundler.load_marshal(marshalled_deps))
54
+ gem_list.concat(Bundler.safe_load_marshal(marshalled_deps))
59
55
  end
60
56
  gem_list
61
57
  end
@@ -61,14 +61,11 @@ module Bundler
61
61
  req.basic_auth(user, password)
62
62
  end
63
63
  connection.request(uri, req)
64
- rescue NoMethodError => e
65
- raise unless ["undefined method", "use_ssl="].all? {|snippet| e.message.include? snippet }
66
- raise LoadError.new("cannot load such file -- openssl")
67
64
  rescue OpenSSL::SSL::SSLError
68
65
  raise CertificateFailureError.new(uri)
69
66
  rescue *HTTP_ERRORS => e
70
67
  Bundler.ui.trace e
71
- if e.is_a?(SocketError) || e.message =~ /host down:/
68
+ if e.is_a?(SocketError) || e.message.to_s.include?("host down:")
72
69
  raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \
73
70
  "connection and try again."
74
71
  else
@@ -80,7 +77,7 @@ module Bundler
80
77
  private
81
78
 
82
79
  def validate_uri_scheme!(uri)
83
- return if uri.scheme =~ /\Ahttps?\z/
80
+ return if /\Ahttps?\z/.match?(uri.scheme)
84
81
  raise InvalidOption,
85
82
  "The request uri `#{uri}` has an invalid scheme (`#{uri.scheme}`). " \
86
83
  "Did you mean `http` or `https`?"
@@ -20,6 +20,7 @@ module Bundler
20
20
  class TooManyRequestsError < HTTPError; end
21
21
  # This error is raised if the API returns a 413 (only printed in verbose)
22
22
  class FallbackError < HTTPError; end
23
+
23
24
  # This is the error raised if OpenSSL fails the cert verification
24
25
  class CertificateFailureError < HTTPError
25
26
  def initialize(remote_uri)
@@ -28,20 +29,18 @@ module Bundler
28
29
  " is a chance you are experiencing a man-in-the-middle attack, but" \
29
30
  " most likely your system doesn't have the CA certificates needed" \
30
31
  " for verification. For information about OpenSSL certificates, see" \
31
- " https://railsapps.github.io/openssl-certificate-verify-failed.html." \
32
- " To connect without using SSL, edit your Gemfile" \
33
- " sources and change 'https' to 'http'."
32
+ " https://railsapps.github.io/openssl-certificate-verify-failed.html."
34
33
  end
35
34
  end
35
+
36
36
  # This is the error raised when a source is HTTPS and OpenSSL didn't load
37
37
  class SSLError < HTTPError
38
38
  def initialize(msg = nil)
39
39
  super msg || "Could not load OpenSSL.\n" \
40
- "You must recompile Ruby with OpenSSL support or change the sources in your " \
41
- "Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL " \
42
- "using RVM are available at rvm.io/packages/openssl."
40
+ "You must recompile Ruby with OpenSSL support."
43
41
  end
44
42
  end
43
+
45
44
  # This error is raised if HTTP authentication is required, but not provided.
46
45
  class AuthenticationRequiredError < HTTPError
47
46
  def initialize(remote_uri)
@@ -52,6 +51,7 @@ module Bundler
52
51
  "or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable"
53
52
  end
54
53
  end
54
+
55
55
  # This error is raised if HTTP authentication is provided, but incorrect.
56
56
  class BadAuthenticationError < HTTPError
57
57
  def initialize(remote_uri)
@@ -102,11 +102,11 @@ module Bundler
102
102
  uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
103
103
  if uri.scheme == "file"
104
104
  path = Bundler.rubygems.correct_for_windows_path(uri.path)
105
- Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
105
+ Bundler.safe_load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
106
106
  elsif cached_spec_path = gemspec_cached_path(spec_file_name)
107
107
  Bundler.load_gemspec(cached_spec_path)
108
108
  else
109
- Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
109
+ Bundler.safe_load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
110
110
  end
111
111
  rescue MarshalError
112
112
  raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
@@ -236,8 +236,8 @@ module Bundler
236
236
  def connection
237
237
  @connection ||= begin
238
238
  needs_ssl = remote_uri.scheme == "https" ||
239
- Bundler.settings[:ssl_verify_mode] ||
240
- Bundler.settings[:ssl_client_cert]
239
+ Bundler.settings[:ssl_verify_mode] ||
240
+ Bundler.settings[:ssl_client_cert]
241
241
  raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
242
242
 
243
243
  con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
@@ -252,8 +252,8 @@ module Bundler
252
252
  end
253
253
 
254
254
  ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
255
- (Gem.configuration.ssl_client_cert if
256
- Gem.configuration.respond_to?(:ssl_client_cert))
255
+ (Gem.configuration.ssl_client_cert if
256
+ Gem.configuration.respond_to?(:ssl_client_cert))
257
257
  if ssl_client_cert
258
258
  pem = File.read(ssl_client_cert)
259
259
  con.cert = OpenSSL::X509::Certificate.new(pem)
@@ -284,8 +284,8 @@ module Bundler
284
284
  def bundler_cert_store
285
285
  store = OpenSSL::X509::Store.new
286
286
  ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
287
- (Gem.configuration.ssl_ca_cert if
288
- Gem.configuration.respond_to?(:ssl_ca_cert))
287
+ (Gem.configuration.ssl_ca_cert if
288
+ Gem.configuration.respond_to?(:ssl_ca_cert))
289
289
  if ssl_ca_cert
290
290
  if File.directory? ssl_ca_cert
291
291
  store.add_path ssl_ca_cert
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module ForcePlatform
5
+ private
6
+
7
+ # The `:force_ruby_platform` value used by dependencies for resolution, and
8
+ # by locked specifications for materialization is `false` by default, except
9
+ # for TruffleRuby. TruffleRuby generally needs to force the RUBY platform
10
+ # variant unless the name is explicitly allowlisted.
11
+
12
+ def default_force_ruby_platform
13
+ return false unless RUBY_ENGINE == "truffleruby"
14
+
15
+ !Gem::Platform::REUSE_AS_BINARY_ON_TRUFFLERUBY.include?(name)
16
+ end
17
+ end
18
+ end
@@ -29,13 +29,13 @@ module Bundler
29
29
  Bundler.ui.error error.message
30
30
  Bundler.ui.trace error.orig_exception
31
31
  when BundlerError
32
- Bundler.ui.error error.message, :wrap => true
33
- Bundler.ui.trace error
32
+ if Bundler.ui.debug?
33
+ Bundler.ui.trace error
34
+ else
35
+ Bundler.ui.error error.message, :wrap => true
36
+ end
34
37
  when Thor::Error
35
38
  Bundler.ui.error error.message
36
- when LoadError
37
- raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
38
- Bundler.ui.error "\nCould not load OpenSSL. #{error.class}: #{error}\n#{error.backtrace.join("\n ")}"
39
39
  when Interrupt
40
40
  Bundler.ui.error "\nQuitting..."
41
41
  Bundler.ui.trace error
@@ -65,8 +65,7 @@ module Bundler
65
65
  --- ERROR REPORT TEMPLATE -------------------------------------------------------
66
66
 
67
67
  ```
68
- #{e.class}: #{e.message}
69
- #{e.backtrace && e.backtrace.join("\n ").chomp}
68
+ #{exception_message(e)}
70
69
  ```
71
70
 
72
71
  #{Bundler::Env.report}
@@ -85,6 +84,21 @@ module Bundler
85
84
  EOS
86
85
  end
87
86
 
87
+ def exception_message(error)
88
+ message = serialized_exception_for(error)
89
+ cause = error.cause
90
+ return message unless cause
91
+
92
+ message + serialized_exception_for(cause)
93
+ end
94
+
95
+ def serialized_exception_for(e)
96
+ <<-EOS.gsub(/^ {8}/, "")
97
+ #{e.class}: #{e.message}
98
+ #{e.backtrace && e.backtrace.join("\n ").chomp}
99
+ EOS
100
+ end
101
+
88
102
  def issues_url(exception)
89
103
  message = exception.message.lines.first.tr(":", " ").chomp
90
104
  message = message.split("-").first if exception.is_a?(Errno)