bundler 2.4.22 → 2.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +113 -0
  3. data/bundler.gemspec +4 -2
  4. data/exe/bundle +1 -10
  5. data/lib/bundler/build_metadata.rb +3 -3
  6. data/lib/bundler/capistrano.rb +1 -1
  7. data/lib/bundler/checksum.rb +254 -0
  8. data/lib/bundler/ci_detector.rb +75 -0
  9. data/lib/bundler/cli/add.rb +3 -3
  10. data/lib/bundler/cli/binstubs.rb +4 -4
  11. data/lib/bundler/cli/cache.rb +1 -1
  12. data/lib/bundler/cli/check.rb +1 -1
  13. data/lib/bundler/cli/common.rb +9 -1
  14. data/lib/bundler/cli/config.rb +8 -7
  15. data/lib/bundler/cli/console.rb +3 -2
  16. data/lib/bundler/cli/doctor.rb +2 -2
  17. data/lib/bundler/cli/exec.rb +1 -1
  18. data/lib/bundler/cli/gem.rb +29 -24
  19. data/lib/bundler/cli/info.rb +2 -13
  20. data/lib/bundler/cli/install.rb +5 -4
  21. data/lib/bundler/cli/issue.rb +1 -1
  22. data/lib/bundler/cli/lock.rb +9 -8
  23. data/lib/bundler/cli/open.rb +1 -1
  24. data/lib/bundler/cli/outdated.rb +6 -6
  25. data/lib/bundler/cli/plugin.rb +7 -14
  26. data/lib/bundler/cli/pristine.rb +38 -30
  27. data/lib/bundler/cli/show.rb +2 -2
  28. data/lib/bundler/cli/update.rb +5 -5
  29. data/lib/bundler/cli.rb +215 -263
  30. data/lib/bundler/compact_index_client/cache.rb +29 -9
  31. data/lib/bundler/compact_index_client/cache_file.rb +153 -0
  32. data/lib/bundler/compact_index_client/gem_parser.rb +7 -3
  33. data/lib/bundler/compact_index_client/updater.rb +79 -81
  34. data/lib/bundler/compact_index_client.rb +14 -7
  35. data/lib/bundler/constants.rb +1 -1
  36. data/lib/bundler/current_ruby.rb +5 -21
  37. data/lib/bundler/definition.rb +111 -48
  38. data/lib/bundler/dependency.rb +20 -12
  39. data/lib/bundler/digest.rb +2 -2
  40. data/lib/bundler/dsl.rb +52 -31
  41. data/lib/bundler/endpoint_specification.rb +5 -1
  42. data/lib/bundler/env.rb +1 -3
  43. data/lib/bundler/environment_preserver.rb +3 -3
  44. data/lib/bundler/errors.rb +43 -0
  45. data/lib/bundler/fetcher/base.rb +3 -1
  46. data/lib/bundler/fetcher/compact_index.rb +4 -4
  47. data/lib/bundler/fetcher/downloader.rb +14 -12
  48. data/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
  49. data/lib/bundler/fetcher/index.rb +1 -1
  50. data/lib/bundler/fetcher.rb +30 -27
  51. data/lib/bundler/friendly_errors.rb +5 -5
  52. data/lib/bundler/gem_helper.rb +1 -1
  53. data/lib/bundler/gem_helpers.rb +5 -2
  54. data/lib/bundler/graph.rb +9 -9
  55. data/lib/bundler/index.rb +1 -2
  56. data/lib/bundler/injector.rb +2 -2
  57. data/lib/bundler/inline.rb +3 -3
  58. data/lib/bundler/installer/gem_installer.rb +5 -5
  59. data/lib/bundler/installer/parallel_installer.rb +16 -8
  60. data/lib/bundler/installer/standalone.rb +2 -3
  61. data/lib/bundler/installer.rb +11 -11
  62. data/lib/bundler/lazy_specification.rb +26 -17
  63. data/lib/bundler/lockfile_generator.rb +9 -0
  64. data/lib/bundler/lockfile_parser.rb +81 -10
  65. data/lib/bundler/man/bundle-add.1 +3 -26
  66. data/lib/bundler/man/bundle-binstubs.1 +4 -16
  67. data/lib/bundler/man/bundle-cache.1 +3 -24
  68. data/lib/bundler/man/bundle-check.1 +3 -12
  69. data/lib/bundler/man/bundle-clean.1 +3 -10
  70. data/lib/bundler/man/bundle-config.1 +22 -213
  71. data/lib/bundler/man/bundle-config.1.ronn +8 -2
  72. data/lib/bundler/man/bundle-console.1 +4 -22
  73. data/lib/bundler/man/bundle-doctor.1 +4 -18
  74. data/lib/bundler/man/bundle-exec.1 +12 -73
  75. data/lib/bundler/man/bundle-gem.1 +13 -49
  76. data/lib/bundler/man/bundle-help.1 +3 -7
  77. data/lib/bundler/man/bundle-info.1 +3 -9
  78. data/lib/bundler/man/bundle-init.1 +3 -12
  79. data/lib/bundler/man/bundle-inject.1 +6 -19
  80. data/lib/bundler/man/bundle-install.1 +27 -125
  81. data/lib/bundler/man/bundle-install.1.ronn +1 -0
  82. data/lib/bundler/man/bundle-list.1 +4 -19
  83. data/lib/bundler/man/bundle-lock.1 +5 -29
  84. data/lib/bundler/man/bundle-open.1 +7 -27
  85. data/lib/bundler/man/bundle-outdated.1 +3 -55
  86. data/lib/bundler/man/bundle-outdated.1.ronn +1 -0
  87. data/lib/bundler/man/bundle-platform.1 +5 -27
  88. data/lib/bundler/man/bundle-plugin.1 +3 -29
  89. data/lib/bundler/man/bundle-pristine.1 +5 -16
  90. data/lib/bundler/man/bundle-remove.1 +4 -14
  91. data/lib/bundler/man/bundle-show.1 +3 -10
  92. data/lib/bundler/man/bundle-update.1 +18 -137
  93. data/lib/bundler/man/bundle-version.1 +3 -16
  94. data/lib/bundler/man/bundle-viz.1 +4 -16
  95. data/lib/bundler/man/bundle.1 +5 -44
  96. data/lib/bundler/man/gemfile.5 +24 -301
  97. data/lib/bundler/man/gemfile.5.ronn +4 -0
  98. data/lib/bundler/match_metadata.rb +4 -0
  99. data/lib/bundler/match_platform.rb +1 -1
  100. data/lib/bundler/mirror.rb +3 -3
  101. data/lib/bundler/plugin/api/source.rb +5 -4
  102. data/lib/bundler/plugin/installer.rb +1 -1
  103. data/lib/bundler/plugin.rb +3 -3
  104. data/lib/bundler/remote_specification.rb +4 -0
  105. data/lib/bundler/resolver/base.rb +1 -1
  106. data/lib/bundler/resolver/incompatibility.rb +1 -1
  107. data/lib/bundler/resolver/spec_group.rb +1 -4
  108. data/lib/bundler/resolver.rb +16 -16
  109. data/lib/bundler/ruby_dsl.rb +20 -12
  110. data/lib/bundler/ruby_version.rb +1 -1
  111. data/lib/bundler/rubygems_ext.rb +24 -50
  112. data/lib/bundler/rubygems_gem_installer.rb +6 -56
  113. data/lib/bundler/rubygems_integration.rb +25 -94
  114. data/lib/bundler/runtime.rb +3 -3
  115. data/lib/bundler/self_manager.rb +24 -8
  116. data/lib/bundler/settings.rb +31 -11
  117. data/lib/bundler/setup.rb +4 -1
  118. data/lib/bundler/shared_helpers.rb +35 -13
  119. data/lib/bundler/source/git/git_proxy.rb +16 -16
  120. data/lib/bundler/source/git.rb +5 -4
  121. data/lib/bundler/source/metadata.rb +15 -15
  122. data/lib/bundler/source/path.rb +7 -6
  123. data/lib/bundler/source/rubygems/remote.rb +1 -1
  124. data/lib/bundler/source/rubygems.rb +23 -16
  125. data/lib/bundler/source.rb +2 -0
  126. data/lib/bundler/spec_set.rb +99 -22
  127. data/lib/bundler/stub_specification.rb +1 -0
  128. data/lib/bundler/templates/Executable.bundler +1 -1
  129. data/lib/bundler/templates/newgem/README.md.tt +3 -3
  130. data/lib/bundler/templates/newgem/Rakefile.tt +2 -6
  131. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  132. data/lib/bundler/templates/newgem/standard.yml.tt +1 -1
  133. data/lib/bundler/ui/shell.rb +1 -1
  134. data/lib/bundler/uri_credentials_filter.rb +2 -2
  135. data/lib/bundler/vendor/connection_pool/.document +1 -0
  136. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  137. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +53 -6
  138. data/lib/bundler/vendor/fileutils/.document +1 -0
  139. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +8 -20
  140. data/lib/bundler/vendor/net-http-persistent/.document +1 -0
  141. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +3 -3
  142. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +2 -2
  143. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +1 -1
  144. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +56 -56
  145. data/lib/bundler/vendor/pub_grub/.document +1 -0
  146. data/lib/bundler/vendor/thor/.document +1 -0
  147. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +0 -3
  148. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +0 -3
  149. data/lib/bundler/vendor/tsort/.document +1 -0
  150. data/lib/bundler/vendor/tsort/lib/tsort.rb +3 -0
  151. data/lib/bundler/vendor/uri/.document +1 -0
  152. data/lib/bundler/vendor/uri/lib/uri/common.rb +256 -132
  153. data/lib/bundler/vendor/uri/lib/uri/generic.rb +1 -0
  154. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +95 -31
  155. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  156. data/lib/bundler/vendored_net_http.rb +8 -0
  157. data/lib/bundler/vendored_persistent.rb +0 -4
  158. data/lib/bundler/vendored_timeout.rb +8 -0
  159. data/lib/bundler/vendored_uri.rb +18 -1
  160. data/lib/bundler/version.rb +1 -1
  161. data/lib/bundler/vlad.rb +1 -1
  162. data/lib/bundler/yaml_serializer.rb +15 -3
  163. data/lib/bundler.rb +44 -34
  164. metadata +18 -6
  165. data/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb +0 -49
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f18e076341154326f22050b2bf57d7aa5f82278331f38079b4cb9ea53a13350
4
- data.tar.gz: 5edcf31c166b6e65530b57c535c9e593a1cc24be7234a74b07eedbe448d775bf
3
+ metadata.gz: 39c97ec41b023928932bc15dd7a27d7d6c44a1081d8d8a8d929323acc7923516
4
+ data.tar.gz: fcee9b11554764b4b762fbeff5be2afa1747bb00522f76a8f2ed8910af6140ba
5
5
  SHA512:
6
- metadata.gz: 19f1201ce7d6a27379d5782373671a1fecfa6482bc699bdb89aa15ef9482f33659913874a5f22e8e3dece848350f411ebe96eb14f3fd3d6dc624455d85ba19de
7
- data.tar.gz: 113401cf222bcf13bcda4424492b103f9bd9563c38f6dbdd7b7a7c4465e3971819a5ae77e1153987178d8353cf8d7aa79332484324bad00858a6f526b7f4a1b7
6
+ metadata.gz: 3f0e03b892ab04ffbbe98dc64a8edf39976e9f06f7e3c3f0d023760de2c10335975dd6658081fe9f6daf259f19e84bb829196f9387c3037ddd3fea9fdb865c80
7
+ data.tar.gz: c483f1305486133a2a0845c4ad13de99baf81b456d88d0e899726db2d1257c445625aeb3f4b32a4b6717f42da23858336284ffecc5fd9ce9a15a6ca797349c75
data/CHANGELOG.md CHANGED
@@ -1,3 +1,115 @@
1
+ # 2.5.6 (February 6, 2024)
2
+
3
+ ## Deprecations:
4
+
5
+ - Refactor lockfile generation and deprecate `Definition#lock` with explicit lockfile [#7047](https://github.com/rubygems/rubygems/pull/7047)
6
+
7
+ ## Enhancements:
8
+
9
+ - Bump `required_ruby_version` to be used in `bundle gem` template [#7430](https://github.com/rubygems/rubygems/pull/7430)
10
+
11
+ ## Bug fixes:
12
+
13
+ - Fix musl platform not being added to the lockfile [#7441](https://github.com/rubygems/rubygems/pull/7441)
14
+ - Let `Bundler.with_original_env` properly restore env variables originally empty [#7383](https://github.com/rubygems/rubygems/pull/7383)
15
+
16
+ # 2.5.5 (January 18, 2024)
17
+
18
+ ## Bug fixes:
19
+
20
+ - Fix development dependency not being added if introduced by two gemspecs [#7358](https://github.com/rubygems/rubygems/pull/7358)
21
+ - Fix ETag quoting regression in If-None-Match header of compact index request [#7352](https://github.com/rubygems/rubygems/pull/7352)
22
+
23
+ ## Documentation:
24
+
25
+ - Refer to underscores as underscores [#7364](https://github.com/rubygems/rubygems/pull/7364)
26
+
27
+ # 2.5.4 (January 4, 2024)
28
+
29
+ ## Bug fixes:
30
+
31
+ - Fix resolution when different platform specific gems have different dependencies [#7324](https://github.com/rubygems/rubygems/pull/7324)
32
+
33
+ # 2.5.3 (December 22, 2023)
34
+
35
+ ## Bug fixes:
36
+
37
+ - Fix incorrect error when Gemfile overrides a gemspec development dependency [#7319](https://github.com/rubygems/rubygems/pull/7319)
38
+
39
+ # 2.5.2 (December 21, 2023)
40
+
41
+ ## Enhancements:
42
+
43
+ - Avoid vendored thor gem polluting the global namespace [#7305](https://github.com/rubygems/rubygems/pull/7305)
44
+
45
+ ## Bug fixes:
46
+
47
+ - Fix `bundle update --bundler` when latest version does not support current ruby [#7310](https://github.com/rubygems/rubygems/pull/7310)
48
+ - Fix incorrect lockfiles being generated in some situations [#7307](https://github.com/rubygems/rubygems/pull/7307)
49
+ - Fix incorrect re-resolve messages [#7306](https://github.com/rubygems/rubygems/pull/7306)
50
+
51
+ # 2.5.1 (December 15, 2023)
52
+
53
+ ## Bug fixes:
54
+
55
+ - Fix `ruby` Gemfile DSL with `file:` parameter no longer working [#7288](https://github.com/rubygems/rubygems/pull/7288)
56
+
57
+ ## Performance:
58
+
59
+ - Save array allocation for every dependency in Gemfile [#7270](https://github.com/rubygems/rubygems/pull/7270)
60
+
61
+ # 2.5.0 (December 15, 2023)
62
+
63
+ ## Breaking changes:
64
+
65
+ - Drop ruby 2.6 and 2.7 support [#7116](https://github.com/rubygems/rubygems/pull/7116)
66
+ - The `:mswin`, `:mswin64`, `:mingw`, and `:x64_mingw` Gemfile `platform` values are soft-deprecated and aliased to `:windows` [#6391](https://github.com/rubygems/rubygems/pull/6391)
67
+
68
+ ## Features:
69
+
70
+ - Leverage ruby feature to warn when requiring default gems not included in the bundle that will be turned into bundled gems in the future [#6831](https://github.com/rubygems/rubygems/pull/6831)
71
+ - Introduce `bundle config set version` feature to choose the version of Bundler that should be used and potentially disable using the `lockfile` version by setting it to `system` [#6817](https://github.com/rubygems/rubygems/pull/6817)
72
+
73
+ ## Performance:
74
+
75
+ - Use match? when regexp match data is unused [#7263](https://github.com/rubygems/rubygems/pull/7263)
76
+ - Avoid some allocations when evaluating `ruby` Gemfile DSL [#7251](https://github.com/rubygems/rubygems/pull/7251)
77
+ - Reduce array allocations when loading definition [#7199](https://github.com/rubygems/rubygems/pull/7199)
78
+ - Avoid re-compiling static regexp in a loop [#7198](https://github.com/rubygems/rubygems/pull/7198)
79
+ - Reduce allocations when installing gems with bundler [#6977](https://github.com/rubygems/rubygems/pull/6977)
80
+ - Use a shared connection pool for fetching gems [#7079](https://github.com/rubygems/rubygems/pull/7079)
81
+ - Reduce allocations when parsing compact index [#6971](https://github.com/rubygems/rubygems/pull/6971)
82
+
83
+ ## Enhancements:
84
+
85
+ - Add 3.4 as a supported ruby version in Gemfile DSL [#7264](https://github.com/rubygems/rubygems/pull/7264)
86
+ - Improve install advice when some gems are not found [#7265](https://github.com/rubygems/rubygems/pull/7265)
87
+ - Vendor `net-http`, `net-protocol`, `resolv`, and `timeout` to reduce conflicts between Gemfile gems and internal dependencies [#6793](https://github.com/rubygems/rubygems/pull/6793)
88
+ - Allow `bundle pristine` to run in parallel [#6927](https://github.com/rubygems/rubygems/pull/6927)
89
+ - Make `bundle lock` always touch the lockfile in non-frozen mode [#7220](https://github.com/rubygems/rubygems/pull/7220)
90
+ - Use `Minitest::TestTask` in a template file for `minitest` [#7234](https://github.com/rubygems/rubygems/pull/7234)
91
+ - Add missing services to CI detection and make it consistent between RubyGems and Bundler [#7205](https://github.com/rubygems/rubygems/pull/7205)
92
+ - Allow auto-install to install missing git gems [#7197](https://github.com/rubygems/rubygems/pull/7197)
93
+ - Stop remembering cli flags like `--jobs` or `--retry` in configuration [#7191](https://github.com/rubygems/rubygems/pull/7191)
94
+ - Simplify remembered flags deprecation message [#7189](https://github.com/rubygems/rubygems/pull/7189)
95
+ - Make sure to `require "rubygems"` explicitly [#7139](https://github.com/rubygems/rubygems/pull/7139)
96
+ - Handle development dependencies duplicated in gemspec vs Gemfile [#6014](https://github.com/rubygems/rubygems/pull/6014)
97
+ - Make lockfiles generated on macOS include a lock for Linux by default [#5700](https://github.com/rubygems/rubygems/pull/5700)
98
+ - Only add a dummy bundler spec to the metadata source when necessary [#4443](https://github.com/rubygems/rubygems/pull/4443)
99
+
100
+ ## Bug fixes:
101
+
102
+ - Resolve `ruby file: ".ruby-version"` relative to containing Gemfile [#7250](https://github.com/rubygems/rubygems/pull/7250)
103
+ - Implement opaque ETag in Compact Index to avoid falling back to old index in servers with different etag implementations [#7122](https://github.com/rubygems/rubygems/pull/7122)
104
+ - Fix `bundle install --system` deprecation advice [#7190](https://github.com/rubygems/rubygems/pull/7190)
105
+ - Fix invalid platform removal missing adjacent platforms [#7170](https://github.com/rubygems/rubygems/pull/7170)
106
+
107
+ ## Documentation:
108
+
109
+ - Add missing --prefer-local to Synopsis in bundle-install.1.ronn [#7194](https://github.com/rubygems/rubygems/pull/7194)
110
+ - Update GitHub organization of Standard Ruby in `bundle gem` output and generated configuration [#6818](https://github.com/rubygems/rubygems/pull/6818)
111
+ - Replace "prior to" with "immediately after" in `bundle gem` generated README file [#6338](https://github.com/rubygems/rubygems/pull/6338)
112
+
1
113
  # 2.4.22 (November 9, 2023)
2
114
 
3
115
  ## Enhancements:
@@ -757,6 +869,7 @@
757
869
 
758
870
  ## Enhancements:
759
871
 
872
+ - Cancel deprecation of custom git sources [#5147](https://github.com/rubygems/rubygems/pull/5147)
760
873
  - Print warning when running Bundler on potentially problematic RubyGems & Ruby combinations [#5177](https://github.com/rubygems/rubygems/pull/5177)
761
874
  - Error tracing should be printed to stderr [#5179](https://github.com/rubygems/rubygems/pull/5179)
762
875
  - Add `github` and `ref` options to `bundle add` [#5159](https://github.com/rubygems/rubygems/pull/5159)
data/bundler.gemspec CHANGED
@@ -29,8 +29,10 @@ Gem::Specification.new do |s|
29
29
  "source_code_uri" => "https://github.com/rubygems/rubygems/tree/master/bundler",
30
30
  }
31
31
 
32
- s.required_ruby_version = ">= 2.6.0"
33
- s.required_rubygems_version = ">= 3.0.1"
32
+ s.required_ruby_version = ">= 3.0.0"
33
+
34
+ # It should match the RubyGems version shipped with `required_ruby_version` above
35
+ s.required_rubygems_version = ">= 3.2.3"
34
36
 
35
37
  s.files = Dir.glob("lib/bundler{.rb,/**/*}", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
36
38
 
data/exe/bundle CHANGED
@@ -15,15 +15,6 @@ end
15
15
 
16
16
  require "bundler"
17
17
 
18
- if Gem.rubygems_version < Gem::Version.new("3.2.3") && Gem.ruby_version < Gem::Version.new("2.7.a") && !ENV["BUNDLER_NO_OLD_RUBYGEMS_WARNING"]
19
- Bundler.ui.warn \
20
- "Your RubyGems version (#{Gem::VERSION}) has a bug that prevents " \
21
- "`required_ruby_version` from working for Bundler. Any scripts that use " \
22
- "`gem install bundler` will break as soon as Bundler drops support for " \
23
- "your Ruby version. Please upgrade RubyGems to avoid future breakage " \
24
- "and silence this warning by running `gem update --system 3.2.3`"
25
- end
26
-
27
18
  require "bundler/friendly_errors"
28
19
 
29
20
  Bundler.with_friendly_errors do
@@ -34,5 +25,5 @@ Bundler.with_friendly_errors do
34
25
  help_flag_used = ARGV.any? {|a| help_flags.include? a }
35
26
  args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV
36
27
 
37
- Bundler::CLI.start(args, :debug => true)
28
+ Bundler::CLI.start(args, debug: true)
38
29
  end
@@ -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 = "2023-11-09".freeze
8
- @git_commit_sha = "ec2089640".freeze
7
+ @built_at = "2024-02-06".freeze
8
+ @git_commit_sha = "7ac045dcaa".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -31,7 +31,7 @@ module Bundler
31
31
  # commit instance variable then we can't determine its commits SHA.
32
32
  git_dir = File.expand_path("../../../.git", __dir__)
33
33
  if File.directory?(git_dir)
34
- return @git_commit_sha = IO.popen(%w[git rev-parse --short HEAD], { :chdir => git_dir }, &:read).strip.freeze
34
+ return @git_commit_sha = IO.popen(%w[git rev-parse --short HEAD], { chdir: git_dir }, &:read).strip.freeze
35
35
  end
36
36
 
37
37
  @git_commit_sha ||= "unknown"
@@ -17,6 +17,6 @@ end
17
17
 
18
18
  Capistrano::Configuration.instance(:must_exist).load do
19
19
  before "deploy:finalize_update", "bundle:install"
20
- Bundler::Deployment.define_task(self, :task, :except => { :no_release => true })
20
+ Bundler::Deployment.define_task(self, :task, except: { no_release: true })
21
21
  set :rake, lambda { "#{fetch(:bundle_cmd, "bundle")} exec rake" }
22
22
  end
@@ -0,0 +1,254 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class Checksum
5
+ ALGO_SEPARATOR = "="
6
+ DEFAULT_ALGORITHM = "sha256"
7
+ private_constant :DEFAULT_ALGORITHM
8
+ DEFAULT_BLOCK_SIZE = 16_384
9
+ private_constant :DEFAULT_BLOCK_SIZE
10
+
11
+ class << self
12
+ def from_gem_package(gem_package, algo = DEFAULT_ALGORITHM)
13
+ return if Bundler.settings[:disable_checksum_validation]
14
+ return unless source = gem_package.instance_variable_get(:@gem)
15
+ return unless source.respond_to?(:with_read_io)
16
+
17
+ source.with_read_io do |io|
18
+ from_gem(io, source.path)
19
+ ensure
20
+ io.rewind
21
+ end
22
+ end
23
+
24
+ def from_gem(io, pathname, algo = DEFAULT_ALGORITHM)
25
+ digest = Bundler::SharedHelpers.digest(algo.upcase).new
26
+ buf = String.new(capacity: DEFAULT_BLOCK_SIZE)
27
+ digest << io.readpartial(DEFAULT_BLOCK_SIZE, buf) until io.eof?
28
+ Checksum.new(algo, digest.hexdigest!, Source.new(:gem, pathname))
29
+ end
30
+
31
+ def from_api(digest, source_uri, algo = DEFAULT_ALGORITHM)
32
+ return if Bundler.settings[:disable_checksum_validation]
33
+
34
+ Checksum.new(algo, to_hexdigest(digest, algo), Source.new(:api, source_uri))
35
+ end
36
+
37
+ def from_lock(lock_checksum, lockfile_location)
38
+ algo, digest = lock_checksum.strip.split(ALGO_SEPARATOR, 2)
39
+ Checksum.new(algo, to_hexdigest(digest, algo), Source.new(:lock, lockfile_location))
40
+ end
41
+
42
+ def to_hexdigest(digest, algo = DEFAULT_ALGORITHM)
43
+ return digest unless algo == DEFAULT_ALGORITHM
44
+ return digest if digest.match?(/\A[0-9a-f]{64}\z/i)
45
+
46
+ if digest.match?(%r{\A[-0-9a-z_+/]{43}={0,2}\z}i)
47
+ digest = digest.tr("-_", "+/") # fix urlsafe base64
48
+ digest.unpack1("m0").unpack1("H*")
49
+ else
50
+ raise ArgumentError, "#{digest.inspect} is not a valid SHA256 hex or base64 digest"
51
+ end
52
+ end
53
+ end
54
+
55
+ attr_reader :algo, :digest, :sources
56
+
57
+ def initialize(algo, digest, source)
58
+ @algo = algo
59
+ @digest = digest
60
+ @sources = [source]
61
+ end
62
+
63
+ def ==(other)
64
+ match?(other) && other.sources == sources
65
+ end
66
+
67
+ alias_method :eql?, :==
68
+
69
+ def same_source?(other)
70
+ sources.include?(other.sources.first)
71
+ end
72
+
73
+ def match?(other)
74
+ other.is_a?(self.class) && other.digest == digest && other.algo == algo
75
+ end
76
+
77
+ def hash
78
+ digest.hash
79
+ end
80
+
81
+ def to_s
82
+ "#{to_lock} (from #{sources.first}#{", ..." if sources.size > 1})"
83
+ end
84
+
85
+ def to_lock
86
+ "#{algo}#{ALGO_SEPARATOR}#{digest}"
87
+ end
88
+
89
+ def merge!(other)
90
+ return nil unless match?(other)
91
+
92
+ @sources.concat(other.sources).uniq!
93
+ self
94
+ end
95
+
96
+ def formatted_sources
97
+ sources.join("\n and ").concat("\n")
98
+ end
99
+
100
+ def removable?
101
+ sources.all?(&:removable?)
102
+ end
103
+
104
+ def removal_instructions
105
+ msg = +""
106
+ i = 1
107
+ sources.each do |source|
108
+ msg << " #{i}. #{source.removal}\n"
109
+ i += 1
110
+ end
111
+ msg << " #{i}. run `bundle install`\n"
112
+ end
113
+
114
+ def inspect
115
+ abbr = "#{algo}#{ALGO_SEPARATOR}#{digest[0, 8]}"
116
+ from = "from #{sources.join(" and ")}"
117
+ "#<#{self.class}:#{object_id} #{abbr} #{from}>"
118
+ end
119
+
120
+ class Source
121
+ attr_reader :type, :location
122
+
123
+ def initialize(type, location)
124
+ @type = type
125
+ @location = location
126
+ end
127
+
128
+ def removable?
129
+ type == :lock || type == :gem
130
+ end
131
+
132
+ def ==(other)
133
+ other.is_a?(self.class) && other.type == type && other.location == location
134
+ end
135
+
136
+ # phrased so that the usual string format is grammatically correct
137
+ # rake (10.3.2) sha256=abc123 from #{to_s}
138
+ def to_s
139
+ case type
140
+ when :lock
141
+ "the lockfile CHECKSUMS at #{location}"
142
+ when :gem
143
+ "the gem at #{location}"
144
+ when :api
145
+ "the API at #{location}"
146
+ else
147
+ "#{location} (#{type})"
148
+ end
149
+ end
150
+
151
+ # A full sentence describing how to remove the checksum
152
+ def removal
153
+ case type
154
+ when :lock
155
+ "remove the matching checksum in #{location}"
156
+ when :gem
157
+ "remove the gem at #{location}"
158
+ when :api
159
+ "checksums from #{location} cannot be locally modified, you may need to update your sources"
160
+ else
161
+ "remove #{location} (#{type})"
162
+ end
163
+ end
164
+ end
165
+
166
+ class Store
167
+ attr_reader :store
168
+ protected :store
169
+
170
+ def initialize
171
+ @store = {}
172
+ @store_mutex = Mutex.new
173
+ end
174
+
175
+ def inspect
176
+ "#<#{self.class}:#{object_id} size=#{store.size}>"
177
+ end
178
+
179
+ # Replace when the new checksum is from the same source.
180
+ # The primary purpose is registering checksums from gems where there are
181
+ # duplicates of the same gem (according to full_name) in the index.
182
+ #
183
+ # In particular, this is when 2 gems have two similar platforms, e.g.
184
+ # "darwin20" and "darwin-20", both of which resolve to darwin-20.
185
+ # In the Index, the later gem replaces the former, so we do that here.
186
+ #
187
+ # However, if the new checksum is from a different source, we register like normal.
188
+ # This ensures a mismatch error where there are multiple top level sources
189
+ # that contain the same gem with different checksums.
190
+ def replace(spec, checksum)
191
+ return unless checksum
192
+
193
+ lock_name = spec.name_tuple.lock_name
194
+ @store_mutex.synchronize do
195
+ existing = fetch_checksum(lock_name, checksum.algo)
196
+ if !existing || existing.same_source?(checksum)
197
+ store_checksum(lock_name, checksum)
198
+ else
199
+ merge_checksum(lock_name, checksum, existing)
200
+ end
201
+ end
202
+ end
203
+
204
+ def register(spec, checksum)
205
+ return unless checksum
206
+
207
+ register_checksum(spec.name_tuple.lock_name, checksum)
208
+ end
209
+
210
+ def merge!(other)
211
+ other.store.each do |lock_name, checksums|
212
+ checksums.each do |_algo, checksum|
213
+ register_checksum(lock_name, checksum)
214
+ end
215
+ end
216
+ end
217
+
218
+ def to_lock(spec)
219
+ lock_name = spec.name_tuple.lock_name
220
+ checksums = @store[lock_name]
221
+ if checksums
222
+ "#{lock_name} #{checksums.values.map(&:to_lock).sort.join(",")}"
223
+ else
224
+ lock_name
225
+ end
226
+ end
227
+
228
+ private
229
+
230
+ def register_checksum(lock_name, checksum)
231
+ @store_mutex.synchronize do
232
+ existing = fetch_checksum(lock_name, checksum.algo)
233
+ if existing
234
+ merge_checksum(lock_name, checksum, existing)
235
+ else
236
+ store_checksum(lock_name, checksum)
237
+ end
238
+ end
239
+ end
240
+
241
+ def merge_checksum(lock_name, checksum, existing)
242
+ existing.merge!(checksum) || raise(ChecksumMismatchError.new(lock_name, existing, checksum))
243
+ end
244
+
245
+ def store_checksum(lock_name, checksum)
246
+ (@store[lock_name] ||= {})[checksum.algo] = checksum
247
+ end
248
+
249
+ def fetch_checksum(lock_name, algo)
250
+ @store[lock_name]&.fetch(algo, nil)
251
+ end
252
+ end
253
+ end
254
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module CIDetector
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).
7
+ # TODO: Drop that duplication once bundler drops support for RubyGems 3.4
8
+ #
9
+ # ## Recognized CI providers, their signifiers, and the relevant docs ##
10
+ #
11
+ # Travis CI - CI, TRAVIS https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
12
+ # Cirrus CI - CI, CIRRUS_CI https://cirrus-ci.org/guide/writing-tasks/#environment-variables
13
+ # Circle CI - CI, CIRCLECI https://circleci.com/docs/variables/#built-in-environment-variables
14
+ # Gitlab CI - CI, GITLAB_CI https://docs.gitlab.com/ee/ci/variables/
15
+ # AppVeyor - CI, APPVEYOR https://www.appveyor.com/docs/environment-variables/
16
+ # CodeShip - CI_NAME https://docs.cloudbees.com/docs/cloudbees-codeship/latest/pro-builds-and-configuration/environment-variables#_default_environment_variables
17
+ # dsari - CI, DSARI https://github.com/rfinnie/dsari#running
18
+ # Jenkins - BUILD_NUMBER https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
19
+ # TeamCity - TEAMCITY_VERSION https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html#Predefined+Server+Build+Parameters
20
+ # Appflow - CI_BUILD_ID https://ionic.io/docs/appflow/automation/environments#predefined-environments
21
+ # TaskCluster - TASKCLUSTER_ROOT_URL https://docs.taskcluster.net/docs/manual/design/env-vars
22
+ # Semaphore - CI, SEMAPHORE https://docs.semaphoreci.com/ci-cd-environment/environment-variables/
23
+ # BuildKite - CI, BUILDKITE https://buildkite.com/docs/pipelines/environment-variables
24
+ # GoCD - GO_SERVER_URL https://docs.gocd.org/current/faq/dev_use_current_revision_in_build.html
25
+ # GH Actions - CI, GITHUB_ACTIONS https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
26
+ #
27
+ # ### Some "standard" ENVs that multiple providers may set ###
28
+ #
29
+ # * CI - this is set by _most_ (but not all) CI providers now; it's approaching a standard.
30
+ # * CI_NAME - Not as frequently used, but some providers set this to specify their own name
31
+
32
+ # Any of these being set is a reasonably reliable indicator that we are
33
+ # executing in a CI environment.
34
+ ENV_INDICATORS = [
35
+ "CI",
36
+ "CI_NAME",
37
+ "CONTINUOUS_INTEGRATION",
38
+ "BUILD_NUMBER",
39
+ "CI_APP_ID",
40
+ "CI_BUILD_ID",
41
+ "CI_BUILD_NUMBER",
42
+ "RUN_ID",
43
+ "TASKCLUSTER_ROOT_URL",
44
+ ].freeze
45
+
46
+ # For each CI, this env suffices to indicate that we're on _that_ CI's
47
+ # containers. (A few of them only supply a CI_NAME variable, which is also
48
+ # nice). And if they set "CI" but we can't tell which one they are, we also
49
+ # want to know that - a bare "ci" without another token tells us as much.
50
+ ENV_DESCRIPTORS = {
51
+ "TRAVIS" => "travis",
52
+ "CIRCLECI" => "circle",
53
+ "CIRRUS_CI" => "cirrus",
54
+ "DSARI" => "dsari",
55
+ "SEMAPHORE" => "semaphore",
56
+ "JENKINS_URL" => "jenkins",
57
+ "BUILDKITE" => "buildkite",
58
+ "GO_SERVER_URL" => "go",
59
+ "GITLAB_CI" => "gitlab",
60
+ "GITHUB_ACTIONS" => "github",
61
+ "TASKCLUSTER_ROOT_URL" => "taskcluster",
62
+ "CI" => "ci",
63
+ }.freeze
64
+
65
+ def self.ci?
66
+ ENV_INDICATORS.any? {|var| ENV.include?(var) }
67
+ end
68
+
69
+ def self.ci_strings
70
+ matching_names = ENV_DESCRIPTORS.select {|env, _| ENV[env] }.values
71
+ matching_names << ENV["CI_NAME"].downcase if ENV["CI_NAME"]
72
+ matching_names.reject(&:empty?).sort.uniq
73
+ end
74
+ end
75
+ end
@@ -28,9 +28,9 @@ module Bundler
28
28
  dependencies = gems.map {|g| Bundler::Dependency.new(g, version, options) }
29
29
 
30
30
  Injector.inject(dependencies,
31
- :conservative_versioning => options[:version].nil?, # Perform conservative versioning only when version is not specified
32
- :optimistic => options[:optimistic],
33
- :strict => options[:strict])
31
+ conservative_versioning: options[:version].nil?, # Perform conservative versioning only when version is not specified
32
+ optimistic: options[:optimistic],
33
+ strict: options[:strict])
34
34
  end
35
35
 
36
36
  def validate_options!
@@ -17,9 +17,9 @@ module Bundler
17
17
  installer = Installer.new(Bundler.root, Bundler.definition)
18
18
 
19
19
  installer_opts = {
20
- :force => options[:force],
21
- :binstubs_cmd => true,
22
- :all_platforms => options["all-platforms"],
20
+ force: options[:force],
21
+ binstubs_cmd: true,
22
+ all_platforms: options["all-platforms"],
23
23
  }
24
24
 
25
25
  if options[:all]
@@ -45,7 +45,7 @@ module Bundler
45
45
  next
46
46
  end
47
47
 
48
- Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do
48
+ Bundler.settings.temporary(path: (Bundler.settings[:path] || Bundler.root)) do
49
49
  installer.generate_standalone_bundler_executable_stubs(spec, installer_opts)
50
50
  end
51
51
  else
@@ -19,7 +19,7 @@ module Bundler
19
19
  # TODO: move cache contents here now that all bundles are locked
20
20
  custom_path = Bundler.settings[:path] if options[:path]
21
21
 
22
- Bundler.settings.temporary(:cache_all_platforms => options["all-platforms"]) do
22
+ Bundler.settings.temporary(cache_all_platforms: options["all-platforms"]) do
23
23
  Bundler.load.cache(custom_path)
24
24
  end
25
25
  end
@@ -32,7 +32,7 @@ module Bundler
32
32
  Bundler.ui.error "This bundle has been frozen, but there is no #{SharedHelpers.relative_lockfile_path} present"
33
33
  exit 1
34
34
  else
35
- Bundler.load.lock(:preserve_unknown_sections => true) unless options[:"dry-run"]
35
+ Bundler.load.lock(preserve_unknown_sections: true) unless options[:"dry-run"]
36
36
  Bundler.ui.info "The Gemfile's dependencies are satisfied"
37
37
  end
38
38
  end
@@ -54,9 +54,12 @@ module Bundler
54
54
 
55
55
  Bundler.definition.specs.each do |spec|
56
56
  return spec if spec.name == name
57
- specs << spec if regexp && spec.name =~ regexp
57
+ specs << spec if regexp && spec.name.match?(regexp)
58
58
  end
59
59
 
60
+ default_spec = default_gem_spec(name)
61
+ specs << default_spec if default_spec
62
+
60
63
  case specs.count
61
64
  when 0
62
65
  dep_in_other_group = Bundler.definition.current_dependencies.find {|dep|dep.name == name }
@@ -75,6 +78,11 @@ module Bundler
75
78
  raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
76
79
  end
77
80
 
81
+ def self.default_gem_spec(name)
82
+ gem_spec = Gem::Specification.find_all_by_name(name).last
83
+ gem_spec if gem_spec&.default_gem?
84
+ end
85
+
78
86
  def self.ask_for_spec_from(specs)
79
87
  specs.each_with_index do |spec, index|
80
88
  Bundler.ui.info "#{index.succ} : #{spec.name}", true
@@ -2,17 +2,17 @@
2
2
 
3
3
  module Bundler
4
4
  class CLI::Config < Thor
5
- class_option :parseable, :type => :boolean, :banner => "Use minimal formatting for more parseable output"
5
+ class_option :parseable, type: :boolean, banner: "Use minimal formatting for more parseable output"
6
6
 
7
7
  def self.scope_options
8
- method_option :global, :type => :boolean, :banner => "Only change the global config"
9
- method_option :local, :type => :boolean, :banner => "Only change the local config"
8
+ method_option :global, type: :boolean, banner: "Only change the global config"
9
+ method_option :local, type: :boolean, banner: "Only change the local config"
10
10
  end
11
11
  private_class_method :scope_options
12
12
 
13
- desc "base NAME [VALUE]", "The Bundler 1 config interface", :hide => true
13
+ desc "base NAME [VALUE]", "The Bundler 1 config interface", hide: true
14
14
  scope_options
15
- method_option :delete, :type => :boolean, :banner => "delete"
15
+ method_option :delete, type: :boolean, banner: "delete"
16
16
  def base(name = nil, *value)
17
17
  new_args =
18
18
  if ARGV.size == 1
@@ -25,8 +25,9 @@ module Bundler
25
25
  ["config", "get", ARGV[1]]
26
26
  end
27
27
 
28
- SharedHelpers.major_deprecation 3,
29
- "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead."
28
+ message = "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead."
29
+ removed_message = "Using the `config` command without a subcommand [list, get, set, unset] is has been removed. Use `bundle #{new_args.join(" ")}` instead."
30
+ SharedHelpers.major_deprecation 3, message, removed_message: removed_message
30
31
 
31
32
  Base.new(options, name, value, self).run
32
33
  end
@@ -9,8 +9,9 @@ module Bundler
9
9
  end
10
10
 
11
11
  def run
12
- Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
13
- "by `bin/console` generated by `bundle gem <name>`"
12
+ message = "bundle console will be replaced by `bin/console` generated by `bundle gem <name>`"
13
+ removed_message = "bundle console has been replaced by `bin/console` generated by `bundle gem <name>`"
14
+ Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
14
15
 
15
16
  group ? Bundler.require(:default, *group.split(" ").map!(&:to_sym)) : Bundler.require
16
17
  ARGV.clear