bundler 4.0.20 → 4.1.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/{lib/bundler/vendor/connection_pool/LICENSE → MIT.txt} +8 -6
  3. data/bundler.gemspec +24 -7
  4. data/lib/bundler/build_metadata.rb +2 -2
  5. data/lib/bundler/checksum.rb +40 -25
  6. data/lib/bundler/ci_detector.rb +1 -1
  7. data/lib/bundler/cli/add.rb +3 -4
  8. data/lib/bundler/cli/cache.rb +4 -0
  9. data/lib/bundler/cli/clean.rb +5 -0
  10. data/lib/bundler/cli/common.rb +37 -1
  11. data/lib/bundler/cli/config.rb +4 -2
  12. data/lib/bundler/cli/gem.rb +0 -17
  13. data/lib/bundler/cli/install.rb +4 -5
  14. data/lib/bundler/cli/lock.rb +1 -2
  15. data/lib/bundler/cli/outdated.rb +8 -3
  16. data/lib/bundler/cli/pristine.rb +2 -1
  17. data/lib/bundler/cli/update.rb +20 -11
  18. data/lib/bundler/cli.rb +12 -9
  19. data/lib/bundler/definition.rb +60 -13
  20. data/lib/bundler/dependency.rb +4 -0
  21. data/lib/bundler/dsl.rb +77 -11
  22. data/lib/bundler/endpoint_specification.rb +51 -14
  23. data/lib/bundler/env.rb +7 -24
  24. data/lib/bundler/errors.rb +34 -5
  25. data/lib/bundler/fetcher/compact_index.rb +14 -5
  26. data/lib/bundler/fetcher/connection_pools.rb +150 -0
  27. data/lib/bundler/fetcher/downloader.rb +40 -16
  28. data/lib/bundler/fetcher.rb +8 -47
  29. data/lib/bundler/injector.rb +3 -3
  30. data/lib/bundler/inline.rb +44 -4
  31. data/lib/bundler/installer/parallel_installer.rb +25 -30
  32. data/lib/bundler/installer.rb +20 -6
  33. data/lib/bundler/lazy_specification.rb +44 -17
  34. data/lib/bundler/lockfile_generator.rb +24 -2
  35. data/lib/bundler/lockfile_parser.rb +43 -5
  36. data/lib/bundler/man/bundle-add.1 +7 -4
  37. data/lib/bundler/man/bundle-add.1.ronn +8 -4
  38. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  39. data/lib/bundler/man/bundle-cache.1 +2 -2
  40. data/lib/bundler/man/bundle-cache.1.ronn +2 -2
  41. data/lib/bundler/man/bundle-check.1 +1 -1
  42. data/lib/bundler/man/bundle-clean.1 +1 -1
  43. data/lib/bundler/man/bundle-config.1 +38 -6
  44. data/lib/bundler/man/bundle-config.1.ronn +143 -10
  45. data/lib/bundler/man/bundle-console.1 +1 -1
  46. data/lib/bundler/man/bundle-doctor.1 +1 -1
  47. data/lib/bundler/man/bundle-env.1 +1 -1
  48. data/lib/bundler/man/bundle-exec.1 +1 -1
  49. data/lib/bundler/man/bundle-fund.1 +1 -1
  50. data/lib/bundler/man/bundle-gem.1 +1 -1
  51. data/lib/bundler/man/bundle-help.1 +1 -1
  52. data/lib/bundler/man/bundle-info.1 +1 -1
  53. data/lib/bundler/man/bundle-init.1 +1 -1
  54. data/lib/bundler/man/bundle-install.1 +2 -2
  55. data/lib/bundler/man/bundle-install.1.ronn +4 -4
  56. data/lib/bundler/man/bundle-issue.1 +1 -1
  57. data/lib/bundler/man/bundle-licenses.1 +1 -1
  58. data/lib/bundler/man/bundle-list.1 +1 -1
  59. data/lib/bundler/man/bundle-lock.1 +2 -2
  60. data/lib/bundler/man/bundle-lock.1.ronn +3 -2
  61. data/lib/bundler/man/bundle-open.1 +1 -1
  62. data/lib/bundler/man/bundle-outdated.1 +1 -1
  63. data/lib/bundler/man/bundle-platform.1 +1 -1
  64. data/lib/bundler/man/bundle-plugin.1 +1 -1
  65. data/lib/bundler/man/bundle-pristine.1 +1 -1
  66. data/lib/bundler/man/bundle-remove.1 +1 -1
  67. data/lib/bundler/man/bundle-show.1 +1 -1
  68. data/lib/bundler/man/bundle-update.1 +2 -2
  69. data/lib/bundler/man/bundle-update.1.ronn +2 -2
  70. data/lib/bundler/man/bundle-version.1 +1 -1
  71. data/lib/bundler/man/bundle.1 +1 -1
  72. data/lib/bundler/man/gemfile.5 +45 -1
  73. data/lib/bundler/man/gemfile.5.ronn +53 -0
  74. data/lib/bundler/match_metadata.rb +20 -0
  75. data/lib/bundler/match_platform.rb +25 -2
  76. data/lib/bundler/match_remote_metadata.rb +21 -6
  77. data/lib/bundler/materialization.rb +2 -1
  78. data/lib/bundler/override.rb +69 -0
  79. data/lib/bundler/plugin/dsl.rb +3 -5
  80. data/lib/bundler/plugin/events.rb +55 -13
  81. data/lib/bundler/plugin/index.rb +87 -11
  82. data/lib/bundler/plugin/installer/path.rb +1 -1
  83. data/lib/bundler/plugin/installer.rb +13 -5
  84. data/lib/bundler/plugin.rb +58 -30
  85. data/lib/bundler/remote_specification.rb +6 -3
  86. data/lib/bundler/resolver/base.rb +2 -1
  87. data/lib/bundler/resolver/incompatibility.rb +1 -1
  88. data/lib/bundler/resolver.rb +73 -23
  89. data/lib/bundler/ruby_version.rb +0 -2
  90. data/lib/bundler/rubygems_ext.rb +71 -1
  91. data/lib/bundler/rubygems_gem_installer.rb +41 -2
  92. data/lib/bundler/rubygems_integration.rb +7 -2
  93. data/lib/bundler/runtime.rb +69 -2
  94. data/lib/bundler/settings.rb +373 -30
  95. data/lib/bundler/shared_helpers.rb +2 -1
  96. data/lib/bundler/source/git/git_proxy.rb +1 -1
  97. data/lib/bundler/source/git.rb +21 -10
  98. data/lib/bundler/source/path/installer.rb +1 -1
  99. data/lib/bundler/source/rubygems/remote.rb +10 -5
  100. data/lib/bundler/source/rubygems.rb +48 -12
  101. data/lib/bundler/spec_set.rb +16 -4
  102. data/lib/bundler/stub_specification.rb +2 -1
  103. data/lib/bundler/templates/newgem/Gemfile.tt +4 -4
  104. data/lib/bundler/templates/newgem/newgem.gemspec.tt +3 -3
  105. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +1 -1
  106. data/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +1 -1
  107. data/lib/bundler/ui/shell.rb +0 -4
  108. data/lib/bundler/ui/silent.rb +0 -4
  109. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +35 -2
  110. data/lib/bundler/vendor/thor/lib/thor/base.rb +2 -1
  111. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +14 -6
  112. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +2 -0
  113. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  114. data/lib/bundler/vendor/thor/lib/thor.rb +34 -1
  115. data/lib/bundler/vendored_pub_grub.rb +5 -2
  116. data/lib/bundler/vendored_securerandom.rb +11 -8
  117. data/lib/bundler/vendored_uri.rb +14 -14
  118. data/lib/bundler/version.rb +1 -1
  119. data/lib/bundler/worker.rb +3 -2
  120. data/lib/bundler.rb +1 -1
  121. data/lib/rubygems/compact_index_client/cache.rb +122 -0
  122. data/lib/rubygems/compact_index_client/cache_file.rb +147 -0
  123. data/lib/rubygems/compact_index_client/http_fetcher.rb +88 -0
  124. data/lib/rubygems/compact_index_client/parser.rb +90 -0
  125. data/lib/rubygems/compact_index_client/updater.rb +113 -0
  126. data/lib/rubygems/compact_index_client.rb +111 -0
  127. data/lib/rubygems/cooldown_settings.rb +57 -0
  128. data/lib/rubygems/credential_store/native/linux.rb +97 -0
  129. data/lib/rubygems/credential_store/native/macos.rb +88 -0
  130. data/lib/rubygems/credential_store/native/windows.rb +130 -0
  131. data/lib/rubygems/credential_store.rb +332 -0
  132. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/assignment.rb +1 -1
  133. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +7 -7
  134. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/failure_writer.rb +1 -1
  135. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/incompatibility.rb +4 -4
  136. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/package.rb +1 -1
  137. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/partial_solution.rb +1 -1
  138. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/rubygems.rb +3 -3
  139. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/solve_failure.rb +1 -1
  140. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/static_package_source.rb +3 -3
  141. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/strategy.rb +2 -2
  142. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/term.rb +1 -1
  143. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/version.rb +1 -1
  144. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/version_constraint.rb +3 -3
  145. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/version_range.rb +1 -1
  146. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/version_solver.rb +2 -2
  147. data/lib/{bundler → rubygems}/vendor/pub_grub/lib/pub_grub/version_union.rb +1 -1
  148. data/lib/rubygems/vendor/pub_grub/lib/pub_grub.rb +57 -0
  149. data/lib/{bundler → rubygems}/vendor/securerandom/lib/securerandom.rb +10 -6
  150. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/common.rb +119 -119
  151. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/file.rb +13 -13
  152. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/ftp.rb +24 -24
  153. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/generic.rb +132 -132
  154. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/http.rb +18 -18
  155. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/https.rb +4 -4
  156. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/ldap.rb +14 -14
  157. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/ldaps.rb +4 -4
  158. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/mailto.rb +21 -21
  159. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/rfc2396_parser.rb +39 -39
  160. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/rfc3986_parser.rb +14 -14
  161. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/version.rb +1 -1
  162. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/ws.rb +12 -12
  163. data/lib/{bundler → rubygems}/vendor/uri/lib/uri/wss.rb +4 -4
  164. data/lib/{bundler → rubygems}/vendor/uri/lib/uri.rb +35 -31
  165. data/lib/rubygems/yaml_serializer.rb +880 -0
  166. metadata +78 -69
  167. data/CHANGELOG.md +0 -5771
  168. data/LICENSE.md +0 -22
  169. data/README.md +0 -58
  170. data/lib/bundler/compact_index_client/cache.rb +0 -107
  171. data/lib/bundler/compact_index_client/cache_file.rb +0 -148
  172. data/lib/bundler/compact_index_client/parser.rb +0 -87
  173. data/lib/bundler/compact_index_client/updater.rb +0 -105
  174. data/lib/bundler/compact_index_client.rb +0 -92
  175. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +0 -227
  176. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +0 -3
  177. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +0 -56
  178. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +0 -230
  179. data/lib/bundler/vendor/net-http-persistent/README.rdoc +0 -82
  180. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +0 -41
  181. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +0 -65
  182. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +0 -80
  183. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +0 -1153
  184. data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +0 -31
  185. data/lib/bundler/vendored_persistent.rb +0 -11
  186. data/lib/bundler/yaml_serializer.rb +0 -98
  187. /data/lib/{bundler → rubygems}/vendor/pub_grub/LICENSE.txt +0 -0
  188. /data/lib/{bundler → rubygems}/vendor/securerandom/COPYING +0 -0
  189. /data/lib/{bundler → rubygems}/vendor/uri/COPYING +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b47ebbcd326a80d96d63eb16bc6743f1869f9ad1f37d83fac4dc9e1ea805c82c
4
- data.tar.gz: c4903d7995ee2fa13381891ea105a1960ed5fb2ed69255f9fab09b4a7457f89e
3
+ metadata.gz: 64a16d95664584fa37c3a29d228d05929ff6ab31adfb8784a8625b242e27563d
4
+ data.tar.gz: fcf44920ce08c9436bb0076a8a000f2344487858db6ee94644f4d6acced91cc4
5
5
  SHA512:
6
- metadata.gz: 2bdee0e45396bc93bf1837856a137f30ac3fa2a6bd4cc805ada1c0326e25309da64571d048edcd230f4f2143e1878ca4628d525fadea65e89333255946d2ead8
7
- data.tar.gz: a8f333636a584612db1e4ae36ad93265e22873c38b3ff6cab66bb0e935a84126eeeaef21626fa429fe3229a4f194881be7d8bfed25ebc7675719644d538f0d2e
6
+ metadata.gz: f39b20fc90c76be12671a4f4e5dfe73f697d9d46183786fbf0de925f977675e188fa74db50f3cf010053fdfc62724bdeca2ad65341167ee7f2b2c434a77b9773
7
+ data.tar.gz: 0f7806fa9c0e09b79eeab58116f92d7f3b0bfd395a091de186a1c129e5cda7595ad02f891f993d0d1436cdfc993692783b8ff3a506d2bbbfbe7028976b0e53cd
@@ -1,4 +1,6 @@
1
- Copyright (c) 2011 Mike Perham
1
+ Copyright (c) Chad Fowler, Rich Kilmer, Jim Weirich and others.
2
+ Portions copyright (c) 2010-2019 André Arko
3
+ Portions copyright (c) 2009 Engine Yard
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
@@ -13,8 +15,8 @@ included in all copies or substantial portions of the Software.
13
15
 
14
16
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
17
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bundler.gemspec CHANGED
@@ -12,19 +12,22 @@ Gem::Specification.new do |s|
12
12
  s.version = Bundler::VERSION
13
13
  s.license = "MIT"
14
14
  s.authors = [
15
- "André Arko", "Samuel Giddins", "Colby Swandale", "Hiroshi Shibata",
16
- "David Rodríguez", "Grey Baker", "Stephanie Morillo", "Chris Morris", "James Wen", "Tim Moore",
17
- "André Medeiros", "Jessica Lynn Suttles", "Terence Lee", "Carl Lerche",
18
- "Yehuda Katz"
15
+ "Yehuda Katz", "Carl Lerche", "André Arko", "Terence Lee", "Tim Moore",
16
+ "Jessica Lynn Suttles", "Hiroshi SHIBATA", "André Medeiros", "Samuel Giddins", "David Rodríguez",
17
+ "James Wen", "Chris Morris", "Colby Swandale", "Grey Baker", "Stephanie Morillo"
18
+ ]
19
+ s.email = [
20
+ "wycats@gmail.com", "me@carllerche.com", "andre@arko.net", "hone02@gmail.com", "tmoore@incrementalism.net",
21
+ "jlsuttles@gmail.com", "hsbt@ruby-lang.org", "me@andremedeiros.info", "segiddins@segiddins.me", "deivid.rodriguez@riseup.net",
22
+ "jrw2175@columbia.edu", "chrismo@clabs.org", "colby@rubygems.org", "greysteil@gmail.com", ""
19
23
  ]
20
- s.email = ["team@bundler.io"]
21
24
  s.homepage = "https://bundler.io"
22
25
  s.summary = "The best way to manage your application's dependencies"
23
26
  s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
24
27
 
25
28
  s.metadata = {
26
29
  "bug_tracker_uri" => "https://github.com/ruby/rubygems/issues?q=is%3Aopen+is%3Aissue+label%3ABundler",
27
- "changelog_uri" => "https://github.com/ruby/rubygems/blob/master/CHANGELOG-bundler.md",
30
+ "changelog_uri" => "https://github.com/ruby/rubygems/blob/master/CHANGELOG.md",
28
31
  "homepage_uri" => "https://bundler.io/",
29
32
  "source_code_uri" => "https://github.com/ruby/rubygems",
30
33
  }
@@ -36,10 +39,24 @@ Gem::Specification.new do |s|
36
39
 
37
40
  s.files = Dir.glob("lib/bundler{.rb,/**/*}", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
38
41
 
42
+ # Bundler reuses RubyGems' vendored URI, SecureRandom and PubGrub, its
43
+ # pure-Ruby YAML serializer, its shared cooldown setting rules, its compact
44
+ # index client and its credential store. Ship a copy under lib/rubygems so
45
+ # Bundler stays self-contained on RubyGems versions that predate them.
46
+ s.files += Dir.glob("lib/rubygems/vendor/uri/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
47
+ s.files += Dir.glob("lib/rubygems/vendor/securerandom/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
48
+ s.files += Dir.glob("lib/rubygems/vendor/pub_grub/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
49
+ s.files += Dir.glob("lib/rubygems/yaml_serializer.rb")
50
+ s.files += Dir.glob("lib/rubygems/cooldown_settings.rb")
51
+ s.files += Dir.glob("lib/rubygems/compact_index_client{.rb,/**/*}", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
52
+ s.files += Dir.glob("lib/rubygems/credential_store{.rb,/**/*}", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
53
+
39
54
  # include the gemspec itself because warbler breaks w/o it
40
55
  s.files += %w[bundler.gemspec]
41
56
 
42
- s.files += %w[CHANGELOG.md LICENSE.md README.md]
57
+ # These live next to the gemspec when Bundler ships as a gem, but not when
58
+ # it is synced into Ruby core, where the gemspec moves under lib/bundler.
59
+ s.files += %w[MIT.txt].select {|f| File.file?(f) }
43
60
  s.bindir = "exe"
44
61
  s.executables = %w[bundle bundler]
45
62
  s.require_paths = ["lib"]
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2026-09-02".freeze
8
- @git_commit_sha = "7f2502dc32b".freeze
7
+ @built_at = "2026-09-09".freeze
8
+ @git_commit_sha = "98e4d8083a7".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -187,83 +187,98 @@ module Bundler
187
187
  # However, if the new checksum is from a different source, we register like normal.
188
188
  # This ensures a mismatch error where there are multiple top level sources
189
189
  # that contain the same gem with different checksums.
190
+ # The store is keyed by full name rather than lock name because a
191
+ # content-addressable build and the ordinary platform build of the same
192
+ # name, version, and platform share a lock name while being different
193
+ # files with different checksums.
190
194
  def replace(spec, checksum)
191
195
  return unless checksum
192
196
 
193
- lock_name = spec.lock_name
197
+ full_name = spec.full_name
194
198
  @store_mutex.synchronize do
195
- existing = fetch_checksum(lock_name, checksum.algo)
199
+ existing = fetch_checksum(full_name, checksum.algo)
196
200
  if !existing || existing.same_source?(checksum)
197
- store_checksum(lock_name, checksum)
201
+ store_checksum(full_name, checksum)
198
202
  else
199
- merge_checksum(lock_name, checksum, existing)
203
+ merge_checksum(full_name, checksum, existing, spec.lock_name)
200
204
  end
201
205
  end
202
206
  end
203
207
 
204
208
  def missing?(spec)
205
- @store[spec.lock_name].nil?
209
+ @store[spec.full_name].nil?
206
210
  end
207
211
 
208
212
  def empty?(spec)
209
213
  return false unless spec.source.is_a?(Bundler::Source::Rubygems)
210
214
 
211
- @store[spec.lock_name].empty?
215
+ @store[spec.full_name].empty?
212
216
  end
213
217
 
214
218
  def register(spec, checksum)
215
- register_checksum(spec.lock_name, checksum)
219
+ register_checksum(spec.full_name, checksum, spec.lock_name)
216
220
  end
217
221
 
218
222
  def merge!(other)
219
- other.store.each do |lock_name, checksums|
223
+ other.store.each do |full_name, checksums|
220
224
  checksums.each do |_algo, checksum|
221
- register_checksum(lock_name, checksum)
225
+ register_checksum(full_name, checksum)
222
226
  end
223
227
  end
224
228
  end
225
229
 
226
230
  def to_lock(spec)
227
231
  lock_name = spec.lock_name
228
- checksums = @store[lock_name]
229
- if checksums&.any?
230
- "#{lock_name} #{checksums.values.map(&:to_lock).sort.join(",")}"
232
+ checksums = checksums_to_lock(platform_full_name(spec))
233
+ if checksums
234
+ "#{lock_name} #{checksums}"
231
235
  else
232
236
  lock_name
233
237
  end
234
238
  end
235
239
 
240
+ def checksums_to_lock(full_name)
241
+ checksums = @store[full_name]
242
+ return unless checksums&.any?
243
+
244
+ checksums.values.map(&:to_lock).sort.join(",")
245
+ end
246
+
236
247
  private
237
248
 
238
- def register_checksum(lock_name, checksum)
249
+ def platform_full_name(spec)
250
+ Gem::NameTuple.new(spec.name, spec.version, spec.platform).full_name
251
+ end
252
+
253
+ def register_checksum(full_name, checksum, display_name = full_name)
239
254
  @store_mutex.synchronize do
240
255
  if checksum
241
- existing = fetch_checksum(lock_name, checksum.algo)
256
+ existing = fetch_checksum(full_name, checksum.algo)
242
257
  if existing
243
- merge_checksum(lock_name, checksum, existing)
258
+ merge_checksum(full_name, checksum, existing, display_name)
244
259
  else
245
- store_checksum(lock_name, checksum)
260
+ store_checksum(full_name, checksum)
246
261
  end
247
262
  else
248
- init_checksum(lock_name)
263
+ init_checksum(full_name)
249
264
  end
250
265
  end
251
266
  end
252
267
 
253
- def merge_checksum(lock_name, checksum, existing)
254
- existing.merge!(checksum) || raise(ChecksumMismatchError.new(lock_name, existing, checksum))
268
+ def merge_checksum(full_name, checksum, existing, display_name = full_name)
269
+ existing.merge!(checksum) || raise(ChecksumMismatchError.new(display_name, existing, checksum))
255
270
  end
256
271
 
257
- def store_checksum(lock_name, checksum)
258
- init_checksum(lock_name)[checksum.algo] = checksum
272
+ def store_checksum(full_name, checksum)
273
+ init_checksum(full_name)[checksum.algo] = checksum
259
274
  end
260
275
 
261
- def init_checksum(lock_name)
262
- @store[lock_name] ||= {}
276
+ def init_checksum(full_name)
277
+ @store[full_name] ||= {}
263
278
  end
264
279
 
265
- def fetch_checksum(lock_name, algo)
266
- @store[lock_name]&.fetch(algo, nil)
280
+ def fetch_checksum(full_name, algo)
281
+ @store[full_name]&.fetch(algo, nil)
267
282
  end
268
283
  end
269
284
  end
@@ -3,7 +3,7 @@
3
3
  module Bundler
4
4
  module CIDetector
5
5
  # NOTE: Any changes made here will need to be made to both lib/rubygems/ci_detector.rb and
6
- # bundler/lib/bundler/ci_detector.rb (which are enforced duplicates).
6
+ # lib/bundler/ci_detector.rb (which are enforced duplicates).
7
7
  # TODO: Drop that duplication once bundler drops support for RubyGems 3.4
8
8
  #
9
9
  # ## Recognized CI providers, their signifiers, and the relevant docs ##
@@ -14,8 +14,7 @@ module Bundler
14
14
  def run
15
15
  Bundler.ui.level = "warn" if options[:quiet]
16
16
 
17
- Bundler::CLI::Common.validate_cooldown!(options[:cooldown])
18
- Bundler.settings.set_command_option_if_given :cooldown, options[:cooldown]
17
+ Bundler::CLI::Common.configure_cooldown(options)
19
18
 
20
19
  validate_options!
21
20
  inject_dependencies
@@ -34,7 +33,7 @@ module Bundler
34
33
 
35
34
  Injector.inject(dependencies,
36
35
  conservative_versioning: options[:version].nil?, # Perform conservative versioning only when version is not specified
37
- optimistic: options[:optimistic],
36
+ pessimistic: options[:pessimistic],
38
37
  strict: options[:strict])
39
38
  end
40
39
 
@@ -49,7 +48,7 @@ module Bundler
49
48
 
50
49
  raise InvalidOption, "You cannot specify `--branch` and `--ref` at the same time." if options["branch"] && options["ref"]
51
50
 
52
- raise InvalidOption, "You cannot specify `--strict` and `--optimistic` at the same time." if options[:strict] && options[:optimistic]
51
+ raise InvalidOption, "You cannot specify `--strict` and `--pessimistic` at the same time." if options[:strict] && options[:pessimistic]
53
52
 
54
53
  # raise error when no gems are specified
55
54
  raise InvalidOption, "Please specify gems to add." if gems.empty?
@@ -17,6 +17,8 @@ module Bundler
17
17
  Bundler.settings.temporary(cache_all_platforms: options["all-platforms"]) do
18
18
  Bundler.load.cache
19
19
  end
20
+
21
+ Bundler::CLI::Common.prune
20
22
  end
21
23
 
22
24
  private
@@ -26,6 +28,8 @@ module Bundler
26
28
  options = self.options.dup
27
29
  options["local"] = false if Bundler.settings[:cache_all_platforms]
28
30
  options["no-cache"] = true
31
+ options["skip-prune"] = true
32
+ options["cache-archives"] = true
29
33
  Bundler::CLI::Install.new(options).run
30
34
  end
31
35
  end
@@ -11,6 +11,11 @@ module Bundler
11
11
  def run
12
12
  require_path_or_force unless options[:"dry-run"]
13
13
  Bundler.load.clean(options[:"dry-run"])
14
+ return if options[:"dry-run"]
15
+
16
+ # Pruning last, because cleaning decides which cached .gem files are
17
+ # stale by reading them.
18
+ Bundler::CLI::Common.prune(options)
14
19
  end
15
20
 
16
21
  protected
@@ -2,12 +2,39 @@
2
2
 
3
3
  module Bundler
4
4
  module CLI::Common
5
+ # Validates the `--cooldown` flag and makes it the setting for this
6
+ # command. Every command that takes the flag goes through here, so they
7
+ # share one reading of the value.
8
+ def self.configure_cooldown(options)
9
+ value = options[:cooldown]
10
+
11
+ validate_cooldown!(value)
12
+ Bundler.settings.set_command_option_if_given :cooldown, value
13
+ end
14
+
5
15
  def self.validate_cooldown!(value)
6
- return if value.nil?
16
+ # Without the flag the config files, BUNDLE_COOLDOWN and the gemrc
17
+ # setting decide, and those only warn, so a typo left in a config file
18
+ # keeps the command usable.
19
+ return warn_invalid_cooldown_setting if value.nil?
7
20
  return if value.is_a?(Integer) && value >= 0
8
21
  raise InvalidOption, "Expected `--cooldown` to be a non-negative integer, got #{value.inspect}"
9
22
  end
10
23
 
24
+ # A cooldown value that cannot be read as a non-negative integer takes no
25
+ # part in the resolution, so say so rather than letting the protection
26
+ # lapse quietly. The RubyGems `:cooldown:` setting feeds the same
27
+ # resolution and is checked in Bundler::Settings#rubygems_cooldown, where
28
+ # reading it is already being paid for.
29
+ def self.warn_invalid_cooldown_setting
30
+ require "rubygems/cooldown_settings"
31
+
32
+ value = Bundler.settings.locations(:cooldown).values.first
33
+ return unless Gem::CooldownSettings.invalid?(value)
34
+
35
+ Bundler.ui.warn Gem::CooldownSettings.invalid_message(value, "Bundler's configuration")
36
+ end
37
+
11
38
  def self.output_post_install_messages(messages)
12
39
  return if Bundler.settings["ignore_messages"]
13
40
  messages.to_a.each do |name, msg|
@@ -155,6 +182,15 @@ module Bundler
155
182
  clean
156
183
  end
157
184
 
185
+ # `bundle cache` copies the gem files out of the cache after installing, so
186
+ # it asks to be skipped here and prunes once it is done.
187
+ def self.prune(options = {})
188
+ return if options["skip-prune"]
189
+
190
+ categories = Bundler.settings[:prune]
191
+ Bundler.load.prune(categories) unless categories.empty?
192
+ end
193
+
158
194
  def self.word_list(words)
159
195
  if words.empty?
160
196
  return ""
@@ -97,7 +97,7 @@ module Bundler
97
97
  confirm(name)
98
98
  end
99
99
 
100
- if current_value.nil?
100
+ if current_value.nil? && !Bundler.settings.stored_outside_config_files?(name)
101
101
  exit 1
102
102
  else
103
103
  return
@@ -111,6 +111,8 @@ module Bundler
111
111
  def confirm_all
112
112
  if @options[:parseable]
113
113
  thor.with_padding do
114
+ # --parseable output is fed back to `bundle config set`, where a
115
+ # placeholder would be read back as the credential itself.
114
116
  Bundler.settings.all.each do |setting|
115
117
  val = Bundler.settings[setting]
116
118
  Bundler.ui.info "#{setting}=#{val}"
@@ -118,7 +120,7 @@ module Bundler
118
120
  end
119
121
  else
120
122
  Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
121
- Bundler.settings.all.each do |setting|
123
+ Bundler.settings.all_including_stored_credentials.each do |setting|
122
124
  Bundler.ui.confirm setting
123
125
  show_pretty_values_for(setting)
124
126
  Bundler.ui.confirm ""
@@ -7,12 +7,6 @@ module Bundler
7
7
  end
8
8
 
9
9
  class CLI::Gem
10
- TEST_FRAMEWORK_VERSIONS = {
11
- "rspec" => "3.0",
12
- "minitest" => "5.16",
13
- "test-unit" => "3.0",
14
- }.freeze
15
-
16
10
  DEFAULT_GITHUB_USERNAME = "[USERNAME]"
17
11
 
18
12
  attr_reader :options, :gem_name, :thor, :name, :target, :extension
@@ -117,7 +111,6 @@ module Bundler
117
111
 
118
112
  if test_framework = ask_and_set_test_framework
119
113
  config[:test] = test_framework
120
- config[:test_framework_version] = TEST_FRAMEWORK_VERSIONS[test_framework]
121
114
 
122
115
  case test_framework
123
116
  when "rspec"
@@ -203,12 +196,10 @@ module Bundler
203
196
  config[:linter] = ask_and_set_linter
204
197
  case config[:linter]
205
198
  when "rubocop"
206
- config[:linter_version] = rubocop_version
207
199
  Bundler.ui.info "RuboCop enabled in config"
208
200
  templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
209
201
  config[:ignore_paths] << ".rubocop.yml"
210
202
  when "standard"
211
- config[:linter_version] = standard_version
212
203
  Bundler.ui.info "Standard enabled in config"
213
204
  templates.merge!("standard.yml.tt" => ".standard.yml")
214
205
  config[:ignore_paths] << ".standard.yml"
@@ -471,14 +462,6 @@ module Bundler
471
462
  "3.2.0"
472
463
  end
473
464
 
474
- def rubocop_version
475
- "1.21"
476
- end
477
-
478
- def standard_version
479
- "1.3"
480
- end
481
-
482
465
  def github_username(git_username)
483
466
  if options[:github_username].nil?
484
467
  git_username
@@ -38,7 +38,7 @@ module Bundler
38
38
 
39
39
  Bundler::Fetcher.disable_endpoint = options["full-index"]
40
40
 
41
- Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugins]
41
+ Plugin.gemfile_install(Bundler.default_gemfile, Bundler.default_lockfile) if Bundler.settings[:plugins]
42
42
 
43
43
  # For install we want to enable strict validation
44
44
  # (rather than some optimizations we perform at app runtime).
@@ -69,6 +69,8 @@ module Bundler
69
69
  if CLI::Common.clean_after_install?
70
70
  require_relative "clean"
71
71
  Bundler::CLI::Clean.new(options).run
72
+ else
73
+ CLI::Common.prune(options)
72
74
  end
73
75
 
74
76
  Bundler::CLI::Common.output_fund_metadata_summary
@@ -113,10 +115,7 @@ module Bundler
113
115
 
114
116
  Bundler.settings.set_command_option_if_given :jobs, options["jobs"]
115
117
 
116
- Bundler::CLI::Common.validate_cooldown!(options["cooldown"])
117
- Bundler.settings.set_command_option_if_given :cooldown, options["cooldown"]
118
-
119
- Bundler.settings.set_command_option_if_given :no_prune, options["no-prune"]
118
+ Bundler::CLI::Common.configure_cooldown(options)
120
119
 
121
120
  Bundler.settings.set_command_option_if_given :no_install, options["no-install"]
122
121
 
@@ -16,8 +16,7 @@ module Bundler
16
16
 
17
17
  check_for_conflicting_options
18
18
 
19
- Bundler::CLI::Common.validate_cooldown!(options[:cooldown])
20
- Bundler.settings.set_command_option_if_given :cooldown, options[:cooldown]
19
+ Bundler::CLI::Common.configure_cooldown(options)
21
20
 
22
21
  print = options[:print]
23
22
  previous_output_stream = Bundler.ui.output_stream
@@ -26,8 +26,7 @@ module Bundler
26
26
  def run
27
27
  check_for_deployment_mode!
28
28
 
29
- Bundler::CLI::Common.validate_cooldown!(options[:cooldown])
30
- Bundler.settings.set_command_option_if_given :cooldown, options[:cooldown]
29
+ Bundler::CLI::Common.configure_cooldown(options)
31
30
 
32
31
  Bundler.definition.validate_runtime!
33
32
  current_specs = Bundler.ui.silence { Bundler.definition.resolve }
@@ -77,7 +76,7 @@ module Bundler
77
76
  gemfile_specs + dependency_specs
78
77
  end
79
78
 
80
- specs.sort_by(&:name).uniq(&:name).each do |current_spec|
79
+ specs_for_outdated_check(specs).each do |current_spec|
81
80
  next unless gems.empty? || gems.include?(current_spec.name)
82
81
 
83
82
  active_spec = retrieve_active_spec(definition, current_spec)
@@ -152,6 +151,12 @@ module Bundler
152
151
  end
153
152
  end
154
153
 
154
+ def specs_for_outdated_check(specs)
155
+ specs.group_by(&:name).values.filter_map do |matching_specs|
156
+ MatchPlatform.select_best_platform_match(matching_specs, Bundler.local_platform).first || matching_specs.first
157
+ end.sort_by(&:name)
158
+ end
159
+
155
160
  def retrieve_active_spec(definition, current_spec)
156
161
  active_spec = definition.resolve.find_by_name_and_platform(current_spec.name, current_spec.platform)
157
162
  return unless active_spec
@@ -25,7 +25,8 @@ module Bundler
25
25
  when Source::Rubygems
26
26
  cached_gem = spec.cache_file
27
27
  unless File.exist?(cached_gem)
28
- Bundler.ui.error("Failed to pristine #{gem_name}. Cached gem #{cached_gem} does not exist.")
28
+ Bundler.ui.error("Failed to pristine #{gem_name}. Cached gem #{cached_gem} does not exist. " \
29
+ "Run `bundle install --redownload` to download it again.")
29
30
  next
30
31
  end
31
32
 
@@ -15,8 +15,6 @@ module Bundler
15
15
 
16
16
  Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler) if update_bundler
17
17
 
18
- Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugins]
19
-
20
18
  sources = Array(options[:source])
21
19
  groups = Array(options[:group]).map(&:to_sym)
22
20
 
@@ -33,29 +31,39 @@ module Bundler
33
31
 
34
32
  conservative = options[:conservative]
35
33
 
36
- if full_update
34
+ unlock = if full_update
37
35
  if conservative
38
- Bundler.definition(conservative: conservative)
36
+ { conservative: conservative }
39
37
  else
40
- Bundler.definition(true)
38
+ true
41
39
  end
42
40
  else
43
41
  unless Bundler.default_lockfile.exist?
44
42
  raise GemfileLockNotFound, "This Bundle hasn't been installed yet. " \
45
43
  "Run `bundle install` to update and install the bundled gems."
46
44
  end
47
- Bundler::CLI::Common.ensure_all_gems_in_lockfile!(gems)
45
+ explicit_gems = gems.dup
48
46
 
49
47
  if groups.any?
50
48
  deps = Bundler.definition.dependencies.select {|d| (d.groups & groups).any? }
51
49
  gems.concat(deps.map(&:name))
52
50
  end
53
51
 
54
- Bundler.definition(gems: gems, sources: sources, ruby: options[:ruby],
55
- conservative: conservative,
56
- bundler: update_bundler)
52
+ {
53
+ gems: gems,
54
+ sources: sources,
55
+ ruby: options[:ruby],
56
+ conservative: conservative,
57
+ bundler: update_bundler,
58
+ }
57
59
  end
58
60
 
61
+ Plugin.gemfile_install(Bundler.default_gemfile, Bundler.default_lockfile, unlock.dup) if Bundler.settings[:plugins]
62
+
63
+ Bundler::CLI::Common.ensure_all_gems_in_lockfile!(explicit_gems) if explicit_gems
64
+
65
+ Bundler.definition(unlock)
66
+
59
67
  Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
60
68
 
61
69
  Bundler::Fetcher.disable_endpoint = options["full-index"]
@@ -66,8 +74,7 @@ module Bundler
66
74
  opts["force"] = options[:redownload] if options[:redownload]
67
75
 
68
76
  Bundler.settings.set_command_option_if_given :jobs, opts["jobs"]
69
- Bundler::CLI::Common.validate_cooldown!(options[:cooldown])
70
- Bundler.settings.set_command_option_if_given :cooldown, options[:cooldown]
77
+ Bundler::CLI::Common.configure_cooldown(options)
71
78
 
72
79
  Bundler.definition.validate_runtime!
73
80
 
@@ -84,6 +91,8 @@ module Bundler
84
91
  if CLI::Common.clean_after_install?
85
92
  require_relative "clean"
86
93
  Bundler::CLI::Clean.new(options).run
94
+ else
95
+ CLI::Common.prune(options)
87
96
  end
88
97
 
89
98
  if locked_gems
data/lib/bundler/cli.rb CHANGED
@@ -276,10 +276,12 @@ module Bundler
276
276
  method_option "with", type: :array, banner: "Include gems that are part of the specified named group (removed)."
277
277
  method_option "cooldown", type: :numeric, banner: "Only consider gem versions published at least N days ago. Use 0 to disable."
278
278
  def install
279
- %w[clean deployment frozen no-prune path shebang without with].each do |option|
279
+ %w[clean deployment frozen path shebang without with].each do |option|
280
280
  remembered_flag_deprecation(option)
281
281
  end
282
282
 
283
+ remembered_flag_deprecation("no-prune", option_name: "keep_outdated_cache")
284
+
283
285
  print_remembered_flag_deprecation("--system", "path.system", "true") if ARGV.include?("--system")
284
286
 
285
287
  remembered_flag_deprecation("deployment", negative: true)
@@ -405,7 +407,8 @@ module Bundler
405
407
  method_option "glob", type: :string, banner: "The location of a dependency's .gemspec, expanded within Ruby (single quotes recommended)"
406
408
  method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
407
409
  method_option "skip-install", type: :boolean, banner: "Adds gem to the Gemfile but does not install it"
408
- method_option "optimistic", type: :boolean, banner: "Adds optimistic declaration of version to gem"
410
+ method_option "optimistic", type: :boolean, banner: "Ignored (now default behavior)"
411
+ method_option "pessimistic", type: :boolean, banner: "Adds pessimistic declaration of version to gem"
409
412
  method_option "strict", type: :boolean, banner: "Adds strict declaration of version to gem"
410
413
  method_option "cooldown", type: :numeric, banner: "Only consider gem versions published at least N days ago. Use 0 to disable."
411
414
  def add(*gems)
@@ -472,9 +475,8 @@ module Bundler
472
475
  print_remembered_flag_deprecation("--all", "cache_all", "true") if ARGV.include?("--all")
473
476
  print_remembered_flag_deprecation("--no-all", "cache_all", "false") if ARGV.include?("--no-all")
474
477
 
475
- %w[frozen no-prune].each do |option|
476
- remembered_flag_deprecation(option)
477
- end
478
+ remembered_flag_deprecation("frozen")
479
+ remembered_flag_deprecation("no-prune", option_name: "keep_outdated_cache")
478
480
 
479
481
  if flag_passed?("--path")
480
482
  removed_message =
@@ -759,9 +761,6 @@ module Bundler
759
761
  config[:current_command] = original_command
760
762
  end
761
763
 
762
- def current_command=(command)
763
- end
764
-
765
764
  def print_command
766
765
  return unless Bundler.ui.debug?
767
766
  cmd = current_command
@@ -787,9 +786,13 @@ module Bundler
787
786
  return unless SharedHelpers.md5_available?
788
787
 
789
788
  require_relative "vendored_uri"
789
+ require "rubygems/compact_index_client"
790
+ if Gem::CompactIndexClient.respond_to?(:filesystem_access=)
791
+ Gem::CompactIndexClient.filesystem_access = SharedHelpers.method(:filesystem_access)
792
+ end
790
793
  remote = Source::Rubygems::Remote.new(Gem::URI("https://rubygems.org"))
791
794
  cache_path = Bundler.user_cache.join("compact_index", remote.cache_slug)
792
- latest = Bundler::CompactIndexClient.new(cache_path).latest_version("bundler")
795
+ latest = Gem::CompactIndexClient.new(cache_path).latest_version("bundler")
793
796
  return unless latest
794
797
 
795
798
  current = Gem::Version.new(VERSION)