bundler 2.5.17 → 2.5.18

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60cb5ee8526a6f8eb3c413e7d3d2ae8c9b32315685862943fc2a956f2fdcd5a1
4
- data.tar.gz: 52aa4c3a435ed97c8dbc2adcfa51dc6d2113fefcb5020df0a5b0be3b605cc49f
3
+ metadata.gz: 5385db419c628f24a112828aaa2154b615e4654418efcd0ca7429b15bf3849e5
4
+ data.tar.gz: f8854df0d8ba8b5b93b0f2984d0f640a8582cae6aca768fbd1a71d9652ac4b78
5
5
  SHA512:
6
- metadata.gz: afafe4e932d1840de3938e609f45555b1fbdf3fea481ee6d395a1f1458d579606d2f5ac64edc90d74799d9b117aae3fd1028b6d3a660df97e087bb9f6475d583
7
- data.tar.gz: fd8907298e40c98124857ea7bf2594953d962946b66da695ce929db2623e67dacbee7dec6500a3dfb89cb6308377a26c305a25cd28a7083432ec10baf0d59810
6
+ metadata.gz: 0aea6d055bd4fab23aa27f322af55f1b021155d80a0352e40d7025e99006ee88843db327ed7bab1e2210d3c065bf201e11cc31a9fa46075e6abf2b67f85b6821
7
+ data.tar.gz: 041fcf5abd1f69f26fdf3f11eb4fced176c30ac3f0dbfb47df1c40d5308dacc9179ae32438737db6a5d9300a20b0f6bc4122c0fb762ee83b442144f969c328e4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # 2.5.18 (August 26, 2024)
2
+
3
+ ## Enhancements:
4
+
5
+ - Don't remove existing platform gems when PLATFORMS section is badly indented [#7916](https://github.com/rubygems/rubygems/pull/7916)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Fix error message when Bundler refuses to install due to frozen being set without a lockfile [#7955](https://github.com/rubygems/rubygems/pull/7955)
10
+ - Fix several issues with the `--prefer-local` flag [#7951](https://github.com/rubygems/rubygems/pull/7951)
11
+ - Restore support for passing relative paths to `git:` sources [#7950](https://github.com/rubygems/rubygems/pull/7950)
12
+ - Regenerate previous git application caches that didn't include bare repos [#7926](https://github.com/rubygems/rubygems/pull/7926)
13
+ - Fix `bundle update <indirect_dep>` failing to upgrade when versions present in two different sources [#7915](https://github.com/rubygems/rubygems/pull/7915)
14
+
15
+ ## Documentation:
16
+
17
+ - Change new gem README template to have copyable code blocks [#7935](https://github.com/rubygems/rubygems/pull/7935)
18
+
1
19
  # 2.5.17 (August 1, 2024)
2
20
 
3
21
  ## Enhancements:
@@ -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 = "2024-08-01".freeze
8
- @git_commit_sha = "74d92b2502".freeze
7
+ @built_at = "2024-08-26".freeze
8
+ @git_commit_sha = "c218aab519".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -25,9 +25,10 @@ module Bundler
25
25
 
26
26
  if options[:deployment] || options[:frozen] || Bundler.frozen_bundle?
27
27
  unless Bundler.default_lockfile.exist?
28
- flag = "--deployment flag" if options[:deployment]
29
- flag ||= "--frozen flag" if options[:frozen]
30
- flag ||= "deployment setting"
28
+ flag = "--deployment flag" if options[:deployment]
29
+ flag ||= "--frozen flag" if options[:frozen]
30
+ flag ||= "deployment setting" if Bundler.settings[:deployment]
31
+ flag ||= "frozen setting" if Bundler.settings[:frozen]
31
32
  raise ProductionError, "The #{flag} requires a lockfile. Please make " \
32
33
  "sure you have checked your #{SharedHelpers.relative_lockfile_path} into version control " \
33
34
  "before deploying."
@@ -214,6 +214,7 @@ module Bundler
214
214
  @resolve = nil
215
215
  @resolver = nil
216
216
  @resolution_packages = nil
217
+ @source_requirements = nil
217
218
  @specs = nil
218
219
 
219
220
  Bundler.ui.debug "The definition is missing dependencies, failed to resolve & materialize locally (#{e})"
@@ -476,9 +477,6 @@ module Bundler
476
477
  end
477
478
  end
478
479
 
479
- attr_reader :sources
480
- private :sources
481
-
482
480
  def nothing_changed?
483
481
  return false unless lockfile_exists?
484
482
 
@@ -502,8 +500,12 @@ module Bundler
502
500
  @unlocking
503
501
  end
504
502
 
503
+ attr_writer :source_requirements
504
+
505
505
  private
506
506
 
507
+ attr_reader :sources
508
+
507
509
  def should_add_extra_platforms?
508
510
  !lockfile_exists? && generic_local_platform_is_ruby? && !Bundler.settings[:force_ruby_platform]
509
511
  end
@@ -569,7 +571,7 @@ module Bundler
569
571
  @resolution_packages ||= begin
570
572
  last_resolve = converge_locked_specs
571
573
  remove_invalid_platforms!
572
- packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @gems_to_unlock, prerelease: gem_version_promoter.pre?)
574
+ packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @gems_to_unlock, prerelease: gem_version_promoter.pre?, prefer_local: @prefer_local)
573
575
  packages = additional_base_requirements_to_prevent_downgrades(packages, last_resolve)
574
576
  packages = additional_base_requirements_to_force_updates(packages)
575
577
  packages
@@ -653,19 +655,6 @@ module Bundler
653
655
  sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
654
656
  end
655
657
 
656
- def pin_locally_available_names(source_requirements)
657
- source_requirements.each_with_object({}) do |(name, original_source), new_source_requirements|
658
- local_source = original_source.dup
659
- local_source.local_only!
660
-
661
- new_source_requirements[name] = if local_source.specs.search(name).any?
662
- local_source
663
- else
664
- original_source
665
- end
666
- end
667
- end
668
-
669
658
  def current_platform_locked?
670
659
  @platforms.any? do |bundle_platform|
671
660
  MatchPlatform.platforms_match?(bundle_platform, local_platform)
@@ -972,12 +961,15 @@ module Bundler
972
961
  end
973
962
 
974
963
  def source_requirements
964
+ @source_requirements ||= find_source_requirements
965
+ end
966
+
967
+ def find_source_requirements
975
968
  # Record the specs available in each gem's source, so that those
976
969
  # specs will be available later when the resolver knows where to
977
970
  # look for that gemspec (or its dependencies)
978
971
  source_requirements = if precompute_source_requirements_for_indirect_dependencies?
979
972
  all_requirements = source_map.all_requirements
980
- all_requirements = pin_locally_available_names(all_requirements) if @prefer_local
981
973
  { default: default_source }.merge(all_requirements)
982
974
  else
983
975
  { default: Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
@@ -1053,6 +1045,7 @@ module Bundler
1053
1045
 
1054
1046
  def dup_for_full_unlock
1055
1047
  unlocked_definition = self.class.new(@lockfile, @dependencies, @sources, true, @ruby_version, @optional_groups, @gemfiles)
1048
+ unlocked_definition.source_requirements = source_requirements
1056
1049
  unlocked_definition.gem_version_promoter.tap do |gvp|
1057
1050
  gvp.level = gem_version_promoter.level
1058
1051
  gvp.strict = gem_version_promoter.strict
@@ -272,7 +272,7 @@ module Bundler
272
272
  end
273
273
 
274
274
  def parse_platform(line)
275
- @platforms << Gem::Platform.new($1) if line =~ /^ (.*)$/
275
+ @platforms << Gem::Platform.new($1.strip) if line =~ /^ (.*)$/
276
276
  end
277
277
 
278
278
  def parse_bundled_with(line)
@@ -72,6 +72,12 @@ module Bundler
72
72
  end
73
73
  end
74
74
 
75
+ def include_remote_specs(names)
76
+ names.each do |name|
77
+ get_package(name).consider_remote_versions!
78
+ end
79
+ end
80
+
75
81
  private
76
82
 
77
83
  def indirect_pins(names)
@@ -15,7 +15,7 @@ module Bundler
15
15
  class Package
16
16
  attr_reader :name, :platforms, :dependency, :locked_version
17
17
 
18
- def initialize(name, platforms, locked_specs:, unlock:, prerelease: false, dependency: nil)
18
+ def initialize(name, platforms, locked_specs:, unlock:, prerelease: false, prefer_local: false, dependency: nil)
19
19
  @name = name
20
20
  @platforms = platforms
21
21
  @locked_version = locked_specs[name].first&.version
@@ -23,6 +23,7 @@ module Bundler
23
23
  @dependency = dependency || Dependency.new(name, @locked_version)
24
24
  @top_level = !dependency.nil?
25
25
  @prerelease = @dependency.prerelease? || @locked_version&.prerelease? || prerelease ? :consider_first : :ignore
26
+ @prefer_local = prefer_local
26
27
  end
27
28
 
28
29
  def platform_specs(specs)
@@ -69,6 +70,14 @@ module Bundler
69
70
  @prerelease = :consider_last
70
71
  end
71
72
 
73
+ def prefer_local?
74
+ @prefer_local
75
+ end
76
+
77
+ def consider_remote_versions!
78
+ @prefer_local = false
79
+ end
80
+
72
81
  def force_ruby_platform?
73
82
  @dependency.force_ruby_platform
74
83
  end
@@ -84,9 +84,9 @@ module Bundler
84
84
  rescue PubGrub::SolveFailure => e
85
85
  incompatibility = e.incompatibility
86
86
 
87
- names_to_unlock, names_to_allow_prereleases_for, extended_explanation = find_names_to_relax(incompatibility)
87
+ names_to_unlock, names_to_allow_prereleases_for, names_to_allow_remote_specs_for, extended_explanation = find_names_to_relax(incompatibility)
88
88
 
89
- names_to_relax = names_to_unlock + names_to_allow_prereleases_for
89
+ names_to_relax = names_to_unlock + names_to_allow_prereleases_for + names_to_allow_remote_specs_for
90
90
 
91
91
  if names_to_relax.any?
92
92
  if names_to_unlock.any?
@@ -96,11 +96,17 @@ module Bundler
96
96
  end
97
97
 
98
98
  if names_to_allow_prereleases_for.any?
99
- Bundler.ui.debug "Found conflicts with dependencies with prereleases. Will retrying considering prereleases for #{names_to_allow_prereleases_for.join(", ")}...", true
99
+ Bundler.ui.debug "Found conflicts with dependencies with prereleases. Will retry considering prereleases for #{names_to_allow_prereleases_for.join(", ")}...", true
100
100
 
101
101
  @base.include_prereleases(names_to_allow_prereleases_for)
102
102
  end
103
103
 
104
+ if names_to_allow_remote_specs_for.any?
105
+ Bundler.ui.debug "Found conflicts with local versions of #{names_to_allow_remote_specs_for.join(", ")}. Will retry considering remote versions...", true
106
+
107
+ @base.include_remote_specs(names_to_allow_remote_specs_for)
108
+ end
109
+
104
110
  root, logger = setup_solver
105
111
 
106
112
  Bundler.ui.debug "Retrying resolution...", true
@@ -120,6 +126,7 @@ module Bundler
120
126
  def find_names_to_relax(incompatibility)
121
127
  names_to_unlock = []
122
128
  names_to_allow_prereleases_for = []
129
+ names_to_allow_remote_specs_for = []
123
130
  extended_explanation = nil
124
131
 
125
132
  while incompatibility.conflict?
@@ -134,6 +141,8 @@ module Bundler
134
141
  names_to_unlock << name
135
142
  elsif package.ignores_prereleases? && @all_specs[name].any? {|s| s.version.prerelease? }
136
143
  names_to_allow_prereleases_for << name
144
+ elsif package.prefer_local? && @all_specs[name].any? {|s| !s.is_a?(StubSpecification) }
145
+ names_to_allow_remote_specs_for << name
137
146
  end
138
147
 
139
148
  no_versions_incompat = [cause.incompatibility, cause.satisfier].find {|incompat| incompat.cause.is_a?(PubGrub::Incompatibility::NoVersions) }
@@ -143,7 +152,7 @@ module Bundler
143
152
  end
144
153
  end
145
154
 
146
- [names_to_unlock.uniq, names_to_allow_prereleases_for.uniq, extended_explanation]
155
+ [names_to_unlock.uniq, names_to_allow_prereleases_for.uniq, names_to_allow_remote_specs_for.uniq, extended_explanation]
147
156
  end
148
157
 
149
158
  def parse_dependency(package, dependency)
@@ -244,7 +253,7 @@ module Bundler
244
253
 
245
254
  def all_versions_for(package)
246
255
  name = package.name
247
- results = (@base[name] + filter_prereleases(@all_specs[name], package)).uniq {|spec| [spec.version.hash, spec.platform] }
256
+ results = (@base[name] + filter_specs(@all_specs[name], package)).uniq {|spec| [spec.version.hash, spec.platform] }
248
257
 
249
258
  if name == "bundler" && !bundler_pinned_to_current_version?
250
259
  bundler_spec = Gem.loaded_specs["bundler"]
@@ -368,12 +377,22 @@ module Bundler
368
377
  end
369
378
  end
370
379
 
380
+ def filter_specs(specs, package)
381
+ filter_remote_specs(filter_prereleases(specs, package), package)
382
+ end
383
+
371
384
  def filter_prereleases(specs, package)
372
385
  return specs unless package.ignores_prereleases? && specs.size > 1
373
386
 
374
387
  specs.reject {|s| s.version.prerelease? }
375
388
  end
376
389
 
390
+ def filter_remote_specs(specs, package)
391
+ return specs unless package.prefer_local?
392
+
393
+ specs.select {|s| s.is_a?(StubSpecification) }
394
+ end
395
+
377
396
  # Ignore versions that depend on themselves incorrectly
378
397
  def filter_invalid_self_dependencies(specs, name)
379
398
  specs.reject do |s|
@@ -405,10 +424,13 @@ module Bundler
405
424
 
406
425
  dep_range = dep_constraint.range
407
426
  versions = select_sorted_versions(dep_package, dep_range)
408
- if versions.empty? && dep_package.ignores_prereleases?
409
- @all_versions.delete(dep_package)
410
- @sorted_versions.delete(dep_package)
411
- dep_package.consider_prereleases!
427
+ if versions.empty?
428
+ if dep_package.ignores_prereleases? || dep_package.prefer_local?
429
+ @all_versions.delete(dep_package)
430
+ @sorted_versions.delete(dep_package)
431
+ end
432
+ dep_package.consider_prereleases! if dep_package.ignores_prereleases?
433
+ dep_package.consider_remote_versions! if dep_package.prefer_local?
412
434
  versions = select_sorted_versions(dep_package, dep_range)
413
435
  end
414
436
 
@@ -84,6 +84,10 @@ module Bundler
84
84
  end
85
85
  end
86
86
 
87
+ def not_a_bare_repository?
88
+ git_local("rev-parse", "--is-bare-repository", dir: path).strip == "false"
89
+ end
90
+
87
91
  def contains?(commit)
88
92
  allowed_with_path do
89
93
  result, status = git_null("branch", "--contains", commit, dir: path)
@@ -332,8 +336,6 @@ module Bundler
332
336
  config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
333
337
  remote.userinfo ||= config_auth
334
338
  remote.to_s
335
- elsif File.exist?(uri)
336
- "file://#{uri}"
337
339
  else
338
340
  uri.to_s
339
341
  end
@@ -188,9 +188,11 @@ module Bundler
188
188
  end
189
189
 
190
190
  def specs(*)
191
- set_cache_path!(app_cache_path) if has_app_cache? && !local?
191
+ set_cache_path!(app_cache_path) if use_app_cache?
192
192
 
193
193
  if requires_checkout? && !@copied
194
+ FileUtils.rm_rf(app_cache_path) if use_app_cache? && git_proxy.not_a_bare_repository?
195
+
194
196
  fetch
195
197
  checkout
196
198
  end
@@ -321,6 +323,10 @@ module Bundler
321
323
  cached_revision && super
322
324
  end
323
325
 
326
+ def use_app_cache?
327
+ has_app_cache? && !local?
328
+ end
329
+
324
330
  def requires_checkout?
325
331
  allow_git_ops? && !local? && !cached_revision_checked_out?
326
332
  end
@@ -10,11 +10,15 @@ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_O
10
10
 
11
11
  Install the gem and add to the application's Gemfile by executing:
12
12
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
14
16
 
15
17
  If bundler is not being used to manage dependencies, install the gem by executing:
16
18
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
18
22
 
19
23
  ## Usage
20
24
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.5.17".freeze
4
+ VERSION = "2.5.18".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
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.5.17
4
+ version: 2.5.18
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: 2024-08-01 00:00:00.000000000 Z
25
+ date: 2024-08-26 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
@@ -400,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
400
400
  - !ruby/object:Gem::Version
401
401
  version: 3.2.3
402
402
  requirements: []
403
- rubygems_version: 3.5.17
403
+ rubygems_version: 3.5.18
404
404
  signing_key:
405
405
  specification_version: 4
406
406
  summary: The best way to manage your application's dependencies