bundler 2.4.19 → 2.4.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +62 -2
  3. data/lib/bundler/build_metadata.rb +3 -3
  4. data/lib/bundler/cli/check.rb +1 -1
  5. data/lib/bundler/cli/gem.rb +1 -3
  6. data/lib/bundler/cli/info.rb +1 -1
  7. data/lib/bundler/cli/install.rb +2 -2
  8. data/lib/bundler/cli/lock.rb +26 -23
  9. data/lib/bundler/cli/open.rb +5 -7
  10. data/lib/bundler/cli/update.rb +1 -0
  11. data/lib/bundler/definition.rb +42 -25
  12. data/lib/bundler/env.rb +2 -2
  13. data/lib/bundler/fetcher/base.rb +2 -2
  14. data/lib/bundler/fetcher/compact_index.rb +1 -5
  15. data/lib/bundler/fetcher/dependency.rb +1 -1
  16. data/lib/bundler/fetcher.rb +31 -30
  17. data/lib/bundler/gem_version_promoter.rb +2 -2
  18. data/lib/bundler/index.rb +62 -31
  19. data/lib/bundler/injector.rb +1 -1
  20. data/lib/bundler/installer/parallel_installer.rb +0 -26
  21. data/lib/bundler/installer/standalone.rb +15 -1
  22. data/lib/bundler/lockfile_parser.rb +32 -39
  23. data/lib/bundler/man/bundle-add.1 +1 -1
  24. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  25. data/lib/bundler/man/bundle-cache.1 +1 -1
  26. data/lib/bundler/man/bundle-check.1 +1 -1
  27. data/lib/bundler/man/bundle-clean.1 +1 -1
  28. data/lib/bundler/man/bundle-config.1 +1 -1
  29. data/lib/bundler/man/bundle-console.1 +1 -1
  30. data/lib/bundler/man/bundle-doctor.1 +1 -1
  31. data/lib/bundler/man/bundle-exec.1 +2 -2
  32. data/lib/bundler/man/bundle-exec.1.ronn +2 -3
  33. data/lib/bundler/man/bundle-gem.1 +1 -1
  34. data/lib/bundler/man/bundle-help.1 +1 -1
  35. data/lib/bundler/man/bundle-info.1 +1 -1
  36. data/lib/bundler/man/bundle-init.1 +1 -1
  37. data/lib/bundler/man/bundle-inject.1 +1 -1
  38. data/lib/bundler/man/bundle-install.1 +1 -1
  39. data/lib/bundler/man/bundle-list.1 +1 -1
  40. data/lib/bundler/man/bundle-lock.1 +1 -1
  41. data/lib/bundler/man/bundle-open.1 +1 -1
  42. data/lib/bundler/man/bundle-outdated.1 +1 -1
  43. data/lib/bundler/man/bundle-platform.1 +1 -1
  44. data/lib/bundler/man/bundle-plugin.1 +17 -17
  45. data/lib/bundler/man/bundle-plugin.1.ronn +5 -5
  46. data/lib/bundler/man/bundle-pristine.1 +1 -1
  47. data/lib/bundler/man/bundle-remove.1 +1 -1
  48. data/lib/bundler/man/bundle-show.1 +1 -1
  49. data/lib/bundler/man/bundle-update.1 +1 -1
  50. data/lib/bundler/man/bundle-version.1 +1 -1
  51. data/lib/bundler/man/bundle-viz.1 +1 -1
  52. data/lib/bundler/man/bundle.1 +1 -1
  53. data/lib/bundler/man/gemfile.5 +12 -1
  54. data/lib/bundler/man/gemfile.5.ronn +5 -0
  55. data/lib/bundler/plugin.rb +1 -1
  56. data/lib/bundler/resolver/package.rb +5 -0
  57. data/lib/bundler/resolver.rb +45 -10
  58. data/lib/bundler/retry.rb +1 -1
  59. data/lib/bundler/ruby_dsl.rb +23 -2
  60. data/lib/bundler/ruby_version.rb +8 -1
  61. data/lib/bundler/self_manager.rb +2 -0
  62. data/lib/bundler/settings.rb +86 -25
  63. data/lib/bundler/shared_helpers.rb +16 -1
  64. data/lib/bundler/source/git/git_proxy.rb +27 -6
  65. data/lib/bundler/source/rubygems.rb +22 -25
  66. data/lib/bundler/spec_set.rb +2 -2
  67. data/lib/bundler/stub_specification.rb +4 -2
  68. data/lib/bundler/templates/newgem/Rakefile.tt +6 -2
  69. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +1 -1
  70. data/lib/bundler/version.rb +1 -1
  71. data/lib/bundler/yaml_serializer.rb +6 -7
  72. metadata +3 -3
@@ -43,6 +43,13 @@ module Bundler
43
43
  end
44
44
  end
45
45
 
46
+ class AmbiguousGitReference < GitError
47
+ def initialize(options)
48
+ msg = "Specification of branch or ref with tag is ambiguous. You specified #{options.inspect}"
49
+ super msg
50
+ end
51
+ end
52
+
46
53
  # The GitProxy is responsible to interact with git repositories.
47
54
  # All actions required by the Git source is encapsulated in this
48
55
  # object.
@@ -53,10 +60,15 @@ module Bundler
53
60
  def initialize(path, uri, options = {}, revision = nil, git = nil)
54
61
  @path = path
55
62
  @uri = uri
56
- @branch = options["branch"]
57
63
  @tag = options["tag"]
64
+ @branch = options["branch"]
58
65
  @ref = options["ref"]
59
- @explicit_ref = branch || tag || ref
66
+ if @tag
67
+ raise AmbiguousGitReference.new(options) if @branch || @ref
68
+ @explicit_ref = @tag
69
+ else
70
+ @explicit_ref = @ref || @branch
71
+ end
60
72
  @revision = revision
61
73
  @git = git
62
74
  @commit_ref = nil
@@ -118,7 +130,8 @@ module Bundler
118
130
  end
119
131
  end
120
132
 
121
- git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination if @commit_ref
133
+ ref = @commit_ref || (locked_to_full_sha? && @revision)
134
+ git "fetch", "--force", "--quiet", *extra_fetch_args(ref), :dir => destination if ref
122
135
 
123
136
  git "reset", "--hard", @revision, :dir => destination
124
137
 
@@ -235,7 +248,15 @@ module Bundler
235
248
  end
236
249
 
237
250
  def pinned_to_full_sha?
238
- ref =~ /\A\h{40}\z/
251
+ full_sha_revision?(ref)
252
+ end
253
+
254
+ def locked_to_full_sha?
255
+ full_sha_revision?(@revision)
256
+ end
257
+
258
+ def full_sha_revision?(ref)
259
+ ref&.match?(/\A\h{40}\z/)
239
260
  end
240
261
 
241
262
  def git_null(*command, dir: nil)
@@ -399,9 +420,9 @@ module Bundler
399
420
  ["--depth", depth.to_s]
400
421
  end
401
422
 
402
- def extra_fetch_args
423
+ def extra_fetch_args(ref)
403
424
  extra_args = [path.to_s, *depth_args]
404
- extra_args.push(@commit_ref)
425
+ extra_args.push(ref)
405
426
  extra_args
406
427
  end
407
428
 
@@ -88,6 +88,7 @@ module Bundler
88
88
  end
89
89
 
90
90
  def self.from_lock(options)
91
+ options["remotes"] = Array(options.delete("remote")).reverse
91
92
  new(options)
92
93
  end
93
94
 
@@ -128,12 +129,12 @@ module Bundler
128
129
  def specs
129
130
  @specs ||= begin
130
131
  # remote_specs usually generates a way larger Index than the other
131
- # sources, and large_idx.use small_idx is way faster than
132
- # small_idx.use large_idx.
133
- idx = @allow_remote ? remote_specs.dup : Index.new
134
- idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
135
- idx.use(installed_specs, :override_dupes) if @allow_local
136
- idx
132
+ # sources, and large_idx.merge! small_idx is way faster than
133
+ # small_idx.merge! large_idx.
134
+ index = @allow_remote ? remote_specs.dup : Index.new
135
+ index.merge!(cached_specs) if @allow_cached || @allow_remote
136
+ index.merge!(installed_specs) if @allow_local
137
+ index
137
138
  end
138
139
  end
139
140
 
@@ -237,7 +238,7 @@ module Bundler
237
238
  end
238
239
 
239
240
  def spec_names
240
- if @allow_remote && dependency_api_available?
241
+ if dependency_api_available?
241
242
  remote_specs.spec_names
242
243
  else
243
244
  []
@@ -245,7 +246,7 @@ module Bundler
245
246
  end
246
247
 
247
248
  def unmet_deps
248
- if @allow_remote && dependency_api_available?
249
+ if dependency_api_available?
249
250
  remote_specs.unmet_dependency_names
250
251
  else
251
252
  []
@@ -260,7 +261,6 @@ module Bundler
260
261
  end
261
262
 
262
263
  def double_check_for(unmet_dependency_names)
263
- return unless @allow_remote
264
264
  return unless dependency_api_available?
265
265
 
266
266
  unmet_dependency_names = unmet_dependency_names.call
@@ -275,7 +275,9 @@ module Bundler
275
275
 
276
276
  Bundler.ui.debug "Double checking for #{unmet_dependency_names || "all specs (due to the size of the request)"} in #{self}"
277
277
 
278
- fetch_names(api_fetchers, unmet_dependency_names, specs, false)
278
+ fetch_names(api_fetchers, unmet_dependency_names, remote_specs)
279
+
280
+ specs.use remote_specs
279
281
  end
280
282
 
281
283
  def dependency_names_to_double_check
@@ -379,7 +381,7 @@ module Bundler
379
381
 
380
382
  def cached_specs
381
383
  @cached_specs ||= begin
382
- idx = @allow_local ? installed_specs.dup : Index.new
384
+ idx = Index.new
383
385
 
384
386
  Dir["#{cache_path}/*.gem"].each do |gemfile|
385
387
  s ||= Bundler.rubygems.spec_from_gem(gemfile)
@@ -392,35 +394,30 @@ module Bundler
392
394
  end
393
395
 
394
396
  def api_fetchers
395
- fetchers.select {|f| f.use_api && f.fetchers.first.api_fetcher? }
397
+ fetchers.select(&:api_fetcher?)
396
398
  end
397
399
 
398
400
  def remote_specs
399
401
  @remote_specs ||= Index.build do |idx|
400
402
  index_fetchers = fetchers - api_fetchers
401
403
 
402
- # gather lists from non-api sites
403
- fetch_names(index_fetchers, nil, idx, false)
404
-
405
- # legacy multi-remote sources need special logic to figure out
406
- # dependency names and that logic can be very costly if one remote
407
- # uses the dependency API but others don't. So use full indexes
408
- # consistently in that particular case.
409
- allow_api = !multiple_remotes?
410
-
411
- fetch_names(api_fetchers, allow_api && dependency_names, idx, false)
404
+ if index_fetchers.empty?
405
+ fetch_names(api_fetchers, dependency_names, idx)
406
+ else
407
+ fetch_names(fetchers, nil, idx)
408
+ end
412
409
  end
413
410
  end
414
411
 
415
- def fetch_names(fetchers, dependency_names, index, override_dupes)
412
+ def fetch_names(fetchers, dependency_names, index)
416
413
  fetchers.each do |f|
417
414
  if dependency_names
418
415
  Bundler.ui.info "Fetching gem metadata from #{URICredentialsFilter.credential_filtered_uri(f.uri)}", Bundler.ui.debug?
419
- index.use f.specs_with_retry(dependency_names, self), override_dupes
416
+ index.use f.specs_with_retry(dependency_names, self)
420
417
  Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
421
418
  else
422
419
  Bundler.ui.info "Fetching source index from #{URICredentialsFilter.credential_filtered_uri(f.uri)}"
423
- index.use f.specs_with_retry(nil, self), override_dupes
420
+ index.use f.specs_with_retry(nil, self)
424
421
  end
425
422
  end
426
423
  end
@@ -100,12 +100,12 @@ module Bundler
100
100
  end
101
101
  end
102
102
 
103
- def incomplete_ruby_specs?(deps)
103
+ def incomplete_for_platform?(deps, platform)
104
104
  return false if @specs.empty?
105
105
 
106
106
  @incomplete_specs = []
107
107
 
108
- self.for(deps, true, [Gem::Platform::RUBY])
108
+ self.for(deps, true, [platform])
109
109
 
110
110
  @incomplete_specs.any?
111
111
  end
@@ -16,7 +16,8 @@ module Bundler
16
16
  # Stub has no concept of source, which means that extension_dir may be wrong
17
17
  # This is the case for git-based gems. So, instead manually assign the extension dir
18
18
  return unless source.respond_to?(:extension_dir_name)
19
- path = File.join(stub.extensions_dir, source.extension_dir_name)
19
+ unique_extension_dir = [source.extension_dir_name, File.basename(full_gem_path)].uniq.join("-")
20
+ path = File.join(stub.extensions_dir, unique_extension_dir)
20
21
  stub.extension_dir = File.expand_path(path)
21
22
  end
22
23
 
@@ -56,7 +57,7 @@ module Bundler
56
57
  end
57
58
 
58
59
  def gem_build_complete_path
59
- File.join(extension_dir, "gem.build_complete")
60
+ stub.gem_build_complete_path
60
61
  end
61
62
 
62
63
  def default_gem?
@@ -108,6 +109,7 @@ module Bundler
108
109
  end
109
110
 
110
111
  rs.source = source
112
+ rs.base_dir = stub.base_dir
111
113
 
112
114
  rs
113
115
  end
@@ -46,7 +46,9 @@ require "rb_sys/extensiontask"
46
46
 
47
47
  task build: :compile
48
48
 
49
- RbSys::ExtensionTask.new(<%= config[:name].inspect %>) do |ext|
49
+ GEMSPEC = Gem::Specification.load("<%= config[:underscored_name] %>.gemspec")
50
+
51
+ RbSys::ExtensionTask.new(<%= config[:name].inspect %>, GEMSPEC) do |ext|
50
52
  ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
51
53
  end
52
54
  <% else -%>
@@ -54,7 +56,9 @@ require "rake/extensiontask"
54
56
 
55
57
  task build: :compile
56
58
 
57
- Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
59
+ GEMSPEC = Gem::Specification.load("<%= config[:underscored_name] %>.gemspec")
60
+
61
+ Rake::ExtensionTask.new("<%= config[:underscored_name] %>", GEMSPEC) do |ext|
58
62
  ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
59
63
  end
60
64
  <% end -%>
@@ -17,7 +17,7 @@ jobs:
17
17
  - '<%= RUBY_VERSION %>'
18
18
 
19
19
  steps:
20
- - uses: actions/checkout@v3
20
+ - uses: actions/checkout@v4
21
21
  <%- if config[:ext] == 'rust' -%>
22
22
  - name: Set up Ruby & Rust
23
23
  uses: oxidize-rb/actions/setup-ruby-and-rust@v1
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.4.19".freeze
4
+ VERSION = "2.4.21".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -54,8 +54,8 @@ module Bundler
54
54
  str.split(/\r?\n/).each do |line|
55
55
  if match = HASH_REGEX.match(line)
56
56
  indent, key, quote, val = match.captures
57
- key = convert_to_backward_compatible_key(key)
58
- depth = indent.scan(/ /).length
57
+ convert_to_backward_compatible_key!(key)
58
+ depth = indent.size / 2
59
59
  if quote.empty? && val.empty?
60
60
  new_hash = {}
61
61
  stack[depth][key] = new_hash
@@ -76,14 +76,13 @@ module Bundler
76
76
  end
77
77
 
78
78
  # for settings' keys
79
- def convert_to_backward_compatible_key(key)
80
- key = "#{key}/" if key =~ /https?:/i && key !~ %r{/\Z}
81
- key = key.gsub(".", "__") if key.include?(".")
82
- key
79
+ def convert_to_backward_compatible_key!(key)
80
+ key << "/" if /https?:/i.match?(key) && !%r{/\Z}.match?(key)
81
+ key.gsub!(".", "__")
83
82
  end
84
83
 
85
84
  class << self
86
- private :dump_hash, :convert_to_backward_compatible_key
85
+ private :dump_hash, :convert_to_backward_compatible_key!
87
86
  end
88
87
  end
89
88
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.19
4
+ version: 2.4.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -22,7 +22,7 @@ authors:
22
22
  autorequire:
23
23
  bindir: exe
24
24
  cert_chain: []
25
- date: 2023-08-17 00:00:00.000000000 Z
25
+ date: 2023-10-17 00:00:00.000000000 Z
26
26
  dependencies: []
27
27
  description: Bundler manages an application's dependencies through its entire life,
28
28
  across many machines, systematically and repeatably
@@ -381,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
381
381
  - !ruby/object:Gem::Version
382
382
  version: 3.0.1
383
383
  requirements: []
384
- rubygems_version: 3.4.19
384
+ rubygems_version: 3.4.21
385
385
  signing_key:
386
386
  specification_version: 4
387
387
  summary: The best way to manage your application's dependencies