bundler 2.2.16 → 2.4.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (280) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +971 -7
  3. data/README.md +4 -7
  4. data/bundler.gemspec +10 -13
  5. data/exe/bundle +12 -24
  6. data/exe/bundler +1 -1
  7. data/lib/bundler/.document +1 -0
  8. data/lib/bundler/build_metadata.rb +3 -3
  9. data/lib/bundler/cli/add.rb +1 -1
  10. data/lib/bundler/cli/binstubs.rb +6 -2
  11. data/lib/bundler/cli/cache.rb +1 -1
  12. data/lib/bundler/cli/check.rb +5 -3
  13. data/lib/bundler/cli/common.rb +6 -2
  14. data/lib/bundler/cli/config.rb +10 -1
  15. data/lib/bundler/cli/console.rb +2 -2
  16. data/lib/bundler/cli/doctor.rb +22 -5
  17. data/lib/bundler/cli/exec.rb +1 -6
  18. data/lib/bundler/cli/gem.rb +147 -35
  19. data/lib/bundler/cli/info.rb +28 -7
  20. data/lib/bundler/cli/init.rb +6 -2
  21. data/lib/bundler/cli/install.rb +26 -58
  22. data/lib/bundler/cli/issue.rb +4 -3
  23. data/lib/bundler/cli/list.rb +7 -1
  24. data/lib/bundler/cli/lock.rb +11 -4
  25. data/lib/bundler/cli/open.rb +7 -6
  26. data/lib/bundler/cli/outdated.rb +23 -17
  27. data/lib/bundler/cli/platform.rb +8 -6
  28. data/lib/bundler/cli/remove.rb +1 -2
  29. data/lib/bundler/cli/show.rb +1 -1
  30. data/lib/bundler/cli/update.rb +17 -8
  31. data/lib/bundler/cli/viz.rb +1 -1
  32. data/lib/bundler/cli.rb +95 -65
  33. data/lib/bundler/compact_index_client/cache.rb +1 -10
  34. data/lib/bundler/compact_index_client/updater.rb +56 -43
  35. data/lib/bundler/compact_index_client.rb +2 -8
  36. data/lib/bundler/constants.rb +1 -1
  37. data/lib/bundler/current_ruby.rb +19 -6
  38. data/lib/bundler/definition.rb +386 -419
  39. data/lib/bundler/dependency.rb +24 -71
  40. data/lib/bundler/digest.rb +71 -0
  41. data/lib/bundler/dsl.rb +48 -63
  42. data/lib/bundler/endpoint_specification.rb +15 -13
  43. data/lib/bundler/env.rb +3 -3
  44. data/lib/bundler/environment_preserver.rb +7 -3
  45. data/lib/bundler/errors.rb +30 -14
  46. data/lib/bundler/feature_flag.rb +0 -5
  47. data/lib/bundler/fetcher/base.rb +6 -8
  48. data/lib/bundler/fetcher/compact_index.rb +21 -28
  49. data/lib/bundler/fetcher/dependency.rb +2 -6
  50. data/lib/bundler/fetcher/downloader.rb +12 -10
  51. data/lib/bundler/fetcher/index.rb +1 -29
  52. data/lib/bundler/fetcher.rb +35 -30
  53. data/lib/bundler/force_platform.rb +18 -0
  54. data/lib/bundler/friendly_errors.rb +26 -39
  55. data/lib/bundler/gem_helper.rb +10 -22
  56. data/lib/bundler/gem_helpers.rb +9 -2
  57. data/lib/bundler/gem_version_promoter.rb +53 -98
  58. data/lib/bundler/graph.rb +3 -3
  59. data/lib/bundler/index.rb +14 -57
  60. data/lib/bundler/injector.rb +20 -6
  61. data/lib/bundler/inline.rb +10 -22
  62. data/lib/bundler/installer/gem_installer.rb +16 -21
  63. data/lib/bundler/installer/parallel_installer.rb +4 -34
  64. data/lib/bundler/installer/standalone.rb +53 -17
  65. data/lib/bundler/installer.rb +26 -58
  66. data/lib/bundler/lazy_specification.rb +72 -55
  67. data/lib/bundler/lockfile_generator.rb +3 -3
  68. data/lib/bundler/lockfile_parser.rb +31 -45
  69. data/lib/bundler/man/bundle-add.1 +21 -5
  70. data/lib/bundler/man/bundle-add.1.ronn +16 -4
  71. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  72. data/lib/bundler/man/bundle-cache.1 +9 -3
  73. data/lib/bundler/man/bundle-cache.1.ronn +9 -2
  74. data/lib/bundler/man/bundle-check.1 +1 -1
  75. data/lib/bundler/man/bundle-clean.1 +2 -2
  76. data/lib/bundler/man/bundle-clean.1.ronn +1 -1
  77. data/lib/bundler/man/bundle-config.1 +50 -26
  78. data/lib/bundler/man/bundle-config.1.ronn +47 -32
  79. data/lib/bundler/man/bundle-console.1 +53 -0
  80. data/lib/bundler/man/bundle-console.1.ronn +44 -0
  81. data/lib/bundler/man/bundle-doctor.1 +1 -1
  82. data/lib/bundler/man/bundle-exec.1 +6 -6
  83. data/lib/bundler/man/bundle-exec.1.ronn +6 -6
  84. data/lib/bundler/man/bundle-gem.1 +37 -34
  85. data/lib/bundler/man/bundle-gem.1.ronn +21 -5
  86. data/lib/bundler/man/bundle-help.1 +13 -0
  87. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  88. data/lib/bundler/man/bundle-info.1 +3 -3
  89. data/lib/bundler/man/bundle-info.1.ronn +3 -3
  90. data/lib/bundler/man/bundle-init.1 +5 -1
  91. data/lib/bundler/man/bundle-init.1.ronn +2 -0
  92. data/lib/bundler/man/bundle-inject.1 +5 -2
  93. data/lib/bundler/man/bundle-inject.1.ronn +3 -1
  94. data/lib/bundler/man/bundle-install.1 +6 -31
  95. data/lib/bundler/man/bundle-install.1.ronn +8 -31
  96. data/lib/bundler/man/bundle-list.1 +1 -1
  97. data/lib/bundler/man/bundle-lock.1 +1 -1
  98. data/lib/bundler/man/bundle-open.1 +22 -2
  99. data/lib/bundler/man/bundle-open.1.ronn +9 -1
  100. data/lib/bundler/man/bundle-outdated.1 +15 -18
  101. data/lib/bundler/man/bundle-outdated.1.ronn +13 -19
  102. data/lib/bundler/man/bundle-platform.1 +16 -6
  103. data/lib/bundler/man/bundle-platform.1.ronn +14 -7
  104. data/lib/bundler/man/bundle-plugin.1 +81 -0
  105. data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  106. data/lib/bundler/man/bundle-pristine.1 +1 -1
  107. data/lib/bundler/man/bundle-remove.1 +1 -1
  108. data/lib/bundler/man/bundle-show.1 +1 -1
  109. data/lib/bundler/man/bundle-update.1 +5 -5
  110. data/lib/bundler/man/bundle-update.1.ronn +5 -4
  111. data/lib/bundler/man/bundle-version.1 +35 -0
  112. data/lib/bundler/man/bundle-version.1.ronn +24 -0
  113. data/lib/bundler/man/bundle-viz.1 +4 -1
  114. data/lib/bundler/man/bundle-viz.1.ronn +2 -0
  115. data/lib/bundler/man/bundle.1 +15 -10
  116. data/lib/bundler/man/bundle.1.ronn +12 -7
  117. data/lib/bundler/man/gemfile.5 +131 -81
  118. data/lib/bundler/man/gemfile.5.ronn +111 -85
  119. data/lib/bundler/man/index.txt +4 -0
  120. data/lib/bundler/match_metadata.rb +13 -0
  121. data/lib/bundler/match_platform.rb +0 -1
  122. data/lib/bundler/match_remote_metadata.rb +29 -0
  123. data/lib/bundler/mirror.rb +5 -7
  124. data/lib/bundler/plugin/api/source.rb +17 -8
  125. data/lib/bundler/plugin/index.rb +9 -6
  126. data/lib/bundler/plugin/installer/git.rb +0 -4
  127. data/lib/bundler/plugin/installer/rubygems.rb +0 -8
  128. data/lib/bundler/plugin/installer.rb +9 -4
  129. data/lib/bundler/plugin.rb +30 -9
  130. data/lib/bundler/process_lock.rb +1 -1
  131. data/lib/bundler/remote_specification.rb +7 -5
  132. data/lib/bundler/resolver/base.rb +107 -0
  133. data/lib/bundler/resolver/candidate.rb +94 -0
  134. data/lib/bundler/resolver/incompatibility.rb +15 -0
  135. data/lib/bundler/resolver/package.rb +72 -0
  136. data/lib/bundler/resolver/root.rb +25 -0
  137. data/lib/bundler/resolver/spec_group.rb +42 -94
  138. data/lib/bundler/resolver.rb +331 -381
  139. data/lib/bundler/retry.rb +1 -1
  140. data/lib/bundler/ruby_dsl.rb +7 -1
  141. data/lib/bundler/ruby_version.rb +8 -21
  142. data/lib/bundler/rubygems_ext.rb +175 -34
  143. data/lib/bundler/rubygems_gem_installer.rb +46 -14
  144. data/lib/bundler/rubygems_integration.rb +57 -108
  145. data/lib/bundler/runtime.rb +20 -18
  146. data/lib/bundler/safe_marshal.rb +31 -0
  147. data/lib/bundler/self_manager.rb +168 -0
  148. data/lib/bundler/settings.rb +101 -30
  149. data/lib/bundler/setup.rb +5 -2
  150. data/lib/bundler/shared_helpers.rb +17 -32
  151. data/lib/bundler/source/git/git_proxy.rb +242 -77
  152. data/lib/bundler/source/git.rb +82 -41
  153. data/lib/bundler/source/metadata.rb +3 -4
  154. data/lib/bundler/source/path/installer.rb +1 -22
  155. data/lib/bundler/source/path.rb +7 -7
  156. data/lib/bundler/source/rubygems.rb +158 -212
  157. data/lib/bundler/source/rubygems_aggregate.rb +68 -0
  158. data/lib/bundler/source.rb +19 -5
  159. data/lib/bundler/source_list.rb +91 -52
  160. data/lib/bundler/source_map.rb +71 -0
  161. data/lib/bundler/spec_set.rb +69 -57
  162. data/lib/bundler/stub_specification.rb +5 -3
  163. data/lib/bundler/templates/Executable +3 -5
  164. data/lib/bundler/templates/Executable.bundler +11 -16
  165. data/lib/bundler/templates/Executable.standalone +4 -4
  166. data/lib/bundler/templates/Gemfile +0 -2
  167. data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  168. data/lib/bundler/templates/newgem/Gemfile.tt +8 -2
  169. data/lib/bundler/templates/newgem/README.md.tt +7 -11
  170. data/lib/bundler/templates/newgem/Rakefile.tt +27 -3
  171. data/lib/bundler/templates/newgem/bin/console.tt +0 -4
  172. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  173. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  174. data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
  175. data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  176. data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
  177. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  178. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +24 -3
  179. data/lib/bundler/templates/newgem/gitignore.tt +3 -0
  180. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
  181. data/lib/bundler/templates/newgem/newgem.gemspec.tt +27 -18
  182. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  183. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  184. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  185. data/lib/bundler/ui/rg_proxy.rb +1 -1
  186. data/lib/bundler/ui/shell.rb +36 -13
  187. data/lib/bundler/ui/silent.rb +21 -5
  188. data/lib/bundler/uri_normalizer.rb +23 -0
  189. data/lib/bundler/vendor/.document +1 -0
  190. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  191. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  192. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  193. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
  194. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +41 -74
  195. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  196. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1351 -409
  197. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  198. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
  199. data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  200. data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  201. data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  202. data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  203. data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
  204. data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  205. data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  206. data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  207. data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  208. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
  209. data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  210. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  211. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
  212. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
  213. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -0
  214. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  215. data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  216. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  217. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +5 -5
  218. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  219. data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
  220. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  221. data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
  222. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
  223. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +23 -5
  224. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  225. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  226. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  227. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  228. data/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
  229. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  230. data/lib/bundler/vendor/uri/lib/uri/common.rb +76 -91
  231. data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
  232. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
  233. data/lib/bundler/vendor/uri/lib/uri/generic.rb +32 -13
  234. data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
  235. data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
  236. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
  237. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
  238. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
  239. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +16 -23
  240. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +12 -18
  241. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  242. data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
  243. data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
  244. data/lib/bundler/vendor/uri/lib/uri.rb +3 -3
  245. data/lib/bundler/vendored_persistent.rb +1 -33
  246. data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
  247. data/lib/bundler/{vendored_tmpdir.rb → vendored_tsort.rb} +1 -1
  248. data/lib/bundler/version.rb +5 -1
  249. data/lib/bundler/worker.rb +24 -11
  250. data/lib/bundler.rb +66 -110
  251. metadata +70 -41
  252. data/lib/bundler/dep_proxy.rb +0 -55
  253. data/lib/bundler/gemdeps.rb +0 -29
  254. data/lib/bundler/psyched_yaml.rb +0 -22
  255. data/lib/bundler/templates/gems.rb +0 -8
  256. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -5
  257. data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
  258. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
  259. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  260. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
  261. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  262. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  263. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  264. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  265. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  266. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  267. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  268. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  269. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
  270. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
  271. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
  272. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  273. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
  274. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  275. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
  276. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  277. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  278. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
  279. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
  280. data/lib/bundler/version_ranges.rb +0 -122
@@ -13,24 +13,26 @@ module Bundler
13
13
  auto_install
14
14
  cache_all
15
15
  cache_all_platforms
16
+ clean
16
17
  default_install_uses_path
17
18
  deployment
18
- deployment_means_frozen
19
19
  disable_checksum_validation
20
20
  disable_exec_load
21
21
  disable_local_branch_check
22
22
  disable_local_revision_check
23
- disable_multisource
24
23
  disable_shared_gems
25
24
  disable_version_check
26
25
  force_ruby_platform
27
26
  forget_cli_options
28
27
  frozen
28
+ gem.changelog
29
29
  gem.coc
30
30
  gem.mit
31
+ git.allow_insecure
31
32
  global_gem_cache
32
33
  ignore_messages
33
34
  init_gems_rb
35
+ inline
34
36
  no_install
35
37
  no_prune
36
38
  path_relative_to_cwd
@@ -41,10 +43,7 @@ module Bundler
41
43
  setup_makes_kernel_gem_public
42
44
  silence_deprecations
43
45
  silence_root_warning
44
- suppress_install_using_messages
45
- unlock_source_unlocks_spec
46
46
  update_requires_all_flag
47
- use_gem_version_promoter_for_major_updates
48
47
  ].freeze
49
48
 
50
49
  NUMBER_KEYS = %w[
@@ -56,10 +55,27 @@ module Bundler
56
55
  ].freeze
57
56
 
58
57
  ARRAY_KEYS = %w[
58
+ only
59
59
  with
60
60
  without
61
61
  ].freeze
62
62
 
63
+ STRING_KEYS = %w[
64
+ bin
65
+ cache_path
66
+ console
67
+ gem.ci
68
+ gem.github_username
69
+ gem.linter
70
+ gem.rubocop
71
+ gem.test
72
+ gemfile
73
+ path
74
+ shebang
75
+ system_bindir
76
+ trust-policy
77
+ ].freeze
78
+
63
79
  DEFAULT_CONFIG = {
64
80
  "BUNDLE_SILENCE_DEPRECATIONS" => false,
65
81
  "BUNDLE_DISABLE_VERSION_CHECK" => true,
@@ -125,8 +141,8 @@ module Bundler
125
141
  keys = @temporary.keys | @global_config.keys | @local_config.keys | @env_config.keys
126
142
 
127
143
  keys.map do |key|
128
- key.sub(/^BUNDLE_/, "").gsub(/__/, ".").downcase
129
- end
144
+ key.sub(/^BUNDLE_/, "").gsub(/___/, "-").gsub(/__/, ".").downcase
145
+ end.sort
130
146
  end
131
147
 
132
148
  def local_overrides
@@ -172,25 +188,32 @@ module Bundler
172
188
  locations = []
173
189
 
174
190
  if value = @temporary[key]
175
- locations << "Set for the current command: #{converted_value(value, exposed_key).inspect}"
191
+ locations << "Set for the current command: #{printable_value(value, exposed_key).inspect}"
176
192
  end
177
193
 
178
194
  if value = @local_config[key]
179
- locations << "Set for your local app (#{local_config_file}): #{converted_value(value, exposed_key).inspect}"
195
+ locations << "Set for your local app (#{local_config_file}): #{printable_value(value, exposed_key).inspect}"
180
196
  end
181
197
 
182
198
  if value = @env_config[key]
183
- locations << "Set via #{key}: #{converted_value(value, exposed_key).inspect}"
199
+ locations << "Set via #{key}: #{printable_value(value, exposed_key).inspect}"
184
200
  end
185
201
 
186
202
  if value = @global_config[key]
187
- locations << "Set for the current user (#{global_config_file}): #{converted_value(value, exposed_key).inspect}"
203
+ locations << "Set for the current user (#{global_config_file}): #{printable_value(value, exposed_key).inspect}"
188
204
  end
189
205
 
190
206
  return ["You have not configured a value for `#{exposed_key}`"] if locations.empty?
191
207
  locations
192
208
  end
193
209
 
210
+ def processor_count
211
+ require "etc"
212
+ Etc.nprocessors
213
+ rescue StandardError
214
+ 1
215
+ end
216
+
194
217
  # for legacy reasons, in Bundler 2, we do not respect :disable_shared_gems
195
218
  def path
196
219
  configs.each do |_level, settings|
@@ -202,7 +225,9 @@ module Bundler
202
225
  return Path.new(path, system_path)
203
226
  end
204
227
 
205
- Path.new(nil, false)
228
+ path = "vendor/bundle" if self[:deployment]
229
+
230
+ Path.new(path, false)
206
231
  end
207
232
 
208
233
  Path = Struct.new(:explicit_path, :system_path) do
@@ -252,12 +277,6 @@ module Bundler
252
277
  end
253
278
  end
254
279
 
255
- def allow_sudo?
256
- key = key_for(:path)
257
- path_configured = @temporary.key?(key) || @local_config.key?(key)
258
- !path_configured
259
- end
260
-
261
280
  def ignore_config?
262
281
  ENV["BUNDLE_IGNORE_CONFIG"]
263
282
  end
@@ -276,9 +295,7 @@ module Bundler
276
295
  end
277
296
 
278
297
  def key_for(key)
279
- key = Settings.normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
280
- key = key.to_s.gsub(".", "__").upcase
281
- "BUNDLE_#{key}"
298
+ self.class.key_for(key)
282
299
  end
283
300
 
284
301
  private
@@ -313,6 +330,10 @@ module Bundler
313
330
  BOOL_KEYS.include?(name.to_s) || BOOL_KEYS.include?(parent_setting_for(name.to_s))
314
331
  end
315
332
 
333
+ def is_string(name)
334
+ STRING_KEYS.include?(name.to_s) || name.to_s.start_with?("local.") || name.to_s.start_with?("mirror.") || name.to_s.start_with?("build.")
335
+ end
336
+
316
337
  def to_bool(value)
317
338
  case value
318
339
  when nil, /\A(false|f|no|n|0|)\z/i, false
@@ -330,9 +351,17 @@ module Bundler
330
351
  ARRAY_KEYS.include?(key.to_s)
331
352
  end
332
353
 
354
+ def is_credential(key)
355
+ key == "gem.push_key"
356
+ end
357
+
358
+ def is_userinfo(value)
359
+ value.include?(":")
360
+ end
361
+
333
362
  def to_array(value)
334
363
  return [] unless value
335
- value.split(":").map(&:to_sym)
364
+ value.tr(" ", ":").split(":").map(&:to_sym)
336
365
  end
337
366
 
338
367
  def array_to_s(array)
@@ -376,15 +405,38 @@ module Bundler
376
405
  end
377
406
  end
378
407
 
408
+ def printable_value(value, key)
409
+ converted = converted_value(value, key)
410
+ return converted unless converted.is_a?(String)
411
+
412
+ if is_string(key)
413
+ converted
414
+ elsif is_credential(key)
415
+ "[REDACTED]"
416
+ elsif is_userinfo(converted)
417
+ username, pass = converted.split(":", 2)
418
+
419
+ if pass == "x-oauth-basic"
420
+ username = "[REDACTED]"
421
+ else
422
+ pass = "[REDACTED]"
423
+ end
424
+
425
+ [username, pass].join(":")
426
+ else
427
+ converted
428
+ end
429
+ end
430
+
379
431
  def global_config_file
380
432
  if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
381
433
  Pathname.new(ENV["BUNDLE_CONFIG"])
382
- else
383
- begin
384
- Bundler.user_bundle_path("config")
385
- rescue PermissionError, GenericSystemCallError
386
- nil
387
- end
434
+ elsif ENV["BUNDLE_USER_CONFIG"] && !ENV["BUNDLE_USER_CONFIG"].empty?
435
+ Pathname.new(ENV["BUNDLE_USER_CONFIG"])
436
+ elsif ENV["BUNDLE_USER_HOME"] && !ENV["BUNDLE_USER_HOME"].empty?
437
+ Pathname.new(ENV["BUNDLE_USER_HOME"]).join("config")
438
+ elsif Bundler.rubygems.user_home && !Bundler.rubygems.user_home.empty?
439
+ Pathname.new(Bundler.rubygems.user_home).join(".bundle/config")
388
440
  end
389
441
  end
390
442
 
@@ -398,7 +450,20 @@ module Bundler
398
450
  valid_file = file.exist? && !file.size.zero?
399
451
  return {} unless valid_file
400
452
  require_relative "yaml_serializer"
401
- YAMLSerializer.load file.read
453
+ YAMLSerializer.load(file.read).inject({}) do |config, (k, v)|
454
+ new_k = k
455
+
456
+ if k.include?("-")
457
+ Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \
458
+ "This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \
459
+ "Please edit #{file} and replace any dashes in configuration keys with a triple underscore (`___`)."
460
+
461
+ new_k = k.gsub("-", "___")
462
+ end
463
+
464
+ config[new_k] = v
465
+ config
466
+ end
402
467
  end
403
468
  end
404
469
 
@@ -415,6 +480,12 @@ module Bundler
415
480
  \z
416
481
  /ix.freeze
417
482
 
483
+ def self.key_for(key)
484
+ key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")
485
+ key = key.to_s.gsub(".", "__").gsub("-", "___").upcase
486
+ "BUNDLE_#{key}"
487
+ end
488
+
418
489
  # TODO: duplicates Rubygems#normalize_uri
419
490
  # TODO: is this the correct place to validate mirror URIs?
420
491
  def self.normalize_uri(uri)
@@ -424,7 +495,7 @@ module Bundler
424
495
  uri = $2
425
496
  suffix = $3
426
497
  end
427
- uri = "#{uri}/" unless uri.end_with?("/")
498
+ uri = URINormalizer.normalize_suffix(uri)
428
499
  require_relative "vendored_uri"
429
500
  uri = Bundler::URI(uri)
430
501
  unless uri.absolute?
data/lib/bundler/setup.rb CHANGED
@@ -9,10 +9,13 @@ if Bundler::SharedHelpers.in_bundle?
9
9
  begin
10
10
  Bundler.ui.silence { Bundler.setup }
11
11
  rescue Bundler::BundlerError => e
12
- Bundler.ui.warn "\e[31m#{e.message}\e[0m"
12
+ Bundler.ui.error e.message
13
13
  Bundler.ui.warn e.backtrace.join("\n") if ENV["DEBUG"]
14
14
  if e.is_a?(Bundler::GemNotFound)
15
- Bundler.ui.warn "\e[33mRun `bundle install` to install missing gems.\e[0m"
15
+ suggested_cmd = "bundle install"
16
+ original_gemfile = Bundler.original_env["BUNDLE_GEMFILE"]
17
+ suggested_cmd += " --gemfile #{original_gemfile}" if original_gemfile
18
+ Bundler.ui.warn "Run `#{suggested_cmd}` to install missing gems."
16
19
  end
17
20
  exit e.status_code
18
21
  end
@@ -13,13 +13,13 @@ module Bundler
13
13
  def root
14
14
  gemfile = find_gemfile
15
15
  raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
16
- Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
16
+ Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
17
17
  end
18
18
 
19
19
  def default_gemfile
20
20
  gemfile = find_gemfile
21
21
  raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
22
- Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
22
+ Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
23
23
  end
24
24
 
25
25
  def default_lockfile
@@ -28,7 +28,7 @@ module Bundler
28
28
  case gemfile.basename.to_s
29
29
  when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
30
30
  else Pathname.new("#{gemfile}.lock")
31
- end.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
31
+ end.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
32
32
  end
33
33
 
34
34
  def default_bundle_dir
@@ -100,7 +100,7 @@ module Bundler
100
100
  #
101
101
  # @see {Bundler::PermissionError}
102
102
  def filesystem_access(path, action = :write, &block)
103
- yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" })
103
+ yield(path.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" })
104
104
  rescue Errno::EACCES
105
105
  raise PermissionError.new(path, action)
106
106
  rescue Errno::EAGAIN
@@ -109,7 +109,7 @@ module Bundler
109
109
  raise VirtualProtocolError.new
110
110
  rescue Errno::ENOSPC
111
111
  raise NoSpaceOnDeviceError.new(path, action)
112
- rescue *[const_get_safely(:ENOTSUP, Errno)].compact
112
+ rescue Errno::ENOTSUP
113
113
  raise OperationNotSupportedError.new(path, action)
114
114
  rescue Errno::EEXIST, Errno::ENOENT
115
115
  raise
@@ -117,13 +117,6 @@ module Bundler
117
117
  raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
118
118
  end
119
119
 
120
- def const_get_safely(constant_name, namespace)
121
- const_in_namespace = namespace.constants.include?(constant_name.to_s) ||
122
- namespace.constants.include?(constant_name.to_sym)
123
- return nil unless const_in_namespace
124
- namespace.const_get(constant_name)
125
- end
126
-
127
120
  def major_deprecation(major_version, message, print_caller_location: false)
128
121
  if print_caller_location
129
122
  caller_location = caller_locations(2, 2).first
@@ -148,17 +141,10 @@ module Bundler
148
141
  end
149
142
  return unless multiple_gemfiles
150
143
  message = "Multiple gemfiles (gems.rb and Gemfile) detected. " \
151
- "Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked."
144
+ "Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.locked."
152
145
  Bundler.ui.warn message
153
146
  end
154
147
 
155
- def trap(signal, override = false, &block)
156
- prior = Signal.trap(signal) do
157
- block.call
158
- prior.call unless override
159
- end
160
- end
161
-
162
148
  def ensure_same_dependencies(spec, old_deps, new_deps)
163
149
  new_deps = new_deps.reject {|d| d.type == :development }
164
150
  old_deps = old_deps.reject {|d| d.type == :development }
@@ -174,10 +160,10 @@ module Bundler
174
160
  " (was expecting #{old_deps.map(&:to_s)}, but the real spec has #{new_deps.map(&:to_s)})"
175
161
  raise APIResponseMismatchError,
176
162
  "Downloading #{spec.full_name} revealed dependencies not in the API or the lockfile (#{extra_deps.join(", ")})." \
177
- "\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
163
+ "\nRunning `bundle update #{spec.name}` should fix the problem."
178
164
  end
179
165
 
180
- def pretty_dependency(dep, print_source = false)
166
+ def pretty_dependency(dep)
181
167
  msg = String.new(dep.name)
182
168
  msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
183
169
 
@@ -186,7 +172,6 @@ module Bundler
186
172
  msg << " " << platform_string if !platform_string.empty? && platform_string != Gem::Platform::RUBY
187
173
  end
188
174
 
189
- msg << " from the `#{dep.source}` source" if print_source && dep.source
190
175
  msg
191
176
  end
192
177
 
@@ -250,10 +235,10 @@ module Bundler
250
235
 
251
236
  def search_up(*names)
252
237
  previous = nil
253
- current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
238
+ current = File.expand_path(SharedHelpers.pwd).tap {|x| x.untaint if RUBY_VERSION < "2.7" }
254
239
 
255
240
  until !File.directory?(current) || current == previous
256
- if ENV["BUNDLE_SPEC_RUN"]
241
+ if ENV["BUNDLER_SPEC_RUN"]
257
242
  # avoid stepping above the tmp directory when testing
258
243
  gemspec = if ENV["GEM_COMMAND"]
259
244
  # for Ruby Core
@@ -288,10 +273,10 @@ module Bundler
288
273
 
289
274
  def set_bundle_variables
290
275
  # bundler exe & lib folders have same root folder, typical gem installation
291
- exe_file = File.expand_path("../../../exe/bundle", __FILE__)
276
+ exe_file = File.expand_path("../../exe/bundle", __dir__)
292
277
 
293
278
  # for Ruby core repository testing
294
- exe_file = File.expand_path("../../../libexec/bundle", __FILE__) unless File.exist?(exe_file)
279
+ exe_file = File.expand_path("../../libexec/bundle", __dir__) unless File.exist?(exe_file)
295
280
 
296
281
  # bundler is a default gem, exe path is separate
297
282
  exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)
@@ -299,6 +284,7 @@ module Bundler
299
284
  Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
300
285
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile.to_s
301
286
  Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
287
+ Bundler::SharedHelpers.set_env "BUNDLER_SETUP", File.expand_path("setup", __dir__) unless RUBY_VERSION < "2.7"
302
288
  end
303
289
 
304
290
  def set_path
@@ -323,16 +309,15 @@ module Bundler
323
309
  end
324
310
 
325
311
  def bundler_ruby_lib
326
- resolve_path File.expand_path("../..", __FILE__)
312
+ File.expand_path("..", __dir__)
327
313
  end
328
314
 
329
315
  def clean_load_path
330
- bundler_lib = bundler_ruby_lib
331
-
332
316
  loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
333
317
 
334
318
  $LOAD_PATH.reject! do |p|
335
- next if resolve_path(p).start_with?(bundler_lib)
319
+ resolved_path = resolve_path(p)
320
+ next if $LOADED_FEATURES.any? {|lf| lf.start_with?(resolved_path) }
336
321
  loaded_gem_paths.delete(p)
337
322
  end
338
323
  $LOAD_PATH.uniq!
@@ -340,7 +325,7 @@ module Bundler
340
325
 
341
326
  def resolve_path(path)
342
327
  expanded = File.expand_path(path)
343
- return expanded unless File.respond_to?(:realpath) && File.exist?(expanded)
328
+ return expanded unless File.exist?(expanded)
344
329
 
345
330
  File.realpath(expanded)
346
331
  end