bundler 4.1.0.beta3 → 4.1.0
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 +4 -4
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/checksum.rb +8 -2
- data/lib/bundler/cli/clean.rb +19 -3
- data/lib/bundler/cli/exec.rb +1 -1
- data/lib/bundler/cli/install.rb +1 -1
- data/lib/bundler/cli/lock.rb +12 -0
- data/lib/bundler/cli/update.rb +1 -1
- data/lib/bundler/cli.rb +2 -0
- data/lib/bundler/definition.rb +125 -3
- data/lib/bundler/dsl.rb +6 -2
- data/lib/bundler/errors.rb +8 -0
- data/lib/bundler/fetcher/downloader.rb +7 -3
- data/lib/bundler/index.rb +7 -2
- data/lib/bundler/inline.rb +16 -8
- data/lib/bundler/installer.rb +19 -0
- data/lib/bundler/lazy_specification.rb +42 -25
- data/lib/bundler/lockfile_generator.rb +21 -9
- data/lib/bundler/lockfile_parser.rb +21 -5
- data/lib/bundler/man/bundle-lock.1 +7 -1
- data/lib/bundler/man/bundle-lock.1.ronn +10 -0
- data/lib/bundler/man/bundle-plugin.1 +61 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +84 -0
- data/lib/bundler/man/gemfile.5 +3 -1
- data/lib/bundler/man/gemfile.5.ronn +11 -3
- data/lib/bundler/match_platform.rb +3 -3
- data/lib/bundler/mirror.rb +7 -5
- data/lib/bundler/resolver.rb +2 -0
- data/lib/bundler/ruby_dsl.rb +2 -1
- data/lib/bundler/rubygems_ext.rb +41 -9
- data/lib/bundler/rubygems_integration.rb +2 -4
- data/lib/bundler/runtime.rb +24 -10
- data/lib/bundler/source/git/git_proxy.rb +18 -6
- data/lib/bundler/source/git.rb +0 -2
- data/lib/bundler/spec_set.rb +26 -7
- data/lib/bundler/stub_specification.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +4 -0
- data/lib/bundler.rb +1 -1
- data/lib/rubygems/compact_index_client/http_fetcher.rb +3 -1
- data/lib/rubygems/yaml_serializer.rb +128 -46
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 95379a1f0c09158c2837a8cf2907618f7e4699b95cc0d01782e253d3aafce23c
|
|
4
|
+
data.tar.gz: aebc9136db0a2e12eb306d0d3b5b21a3fb308f764895babb5204c163149b4cf7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2568864dcb864f9693e423011f21102bac7e405fc387363c704b0f37cedaf88c85ee32d9d3523cf23f4b4d78ffc8eed4ca33347dc5ffc8c96ebc19d5f0c9cb2f
|
|
7
|
+
data.tar.gz: 528ce6fac35a18bfb6d7de70769affc32870ef22377a83789a08734cbdd82a17132da30315897d8e4c2f5816b16f3c988e5ecc3b0c3a480fe6770c29242c8bf8
|
|
@@ -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-
|
|
8
|
-
@git_commit_sha = "
|
|
7
|
+
@built_at = "2026-11-16".freeze
|
|
8
|
+
@git_commit_sha = "9af9267".freeze
|
|
9
9
|
# end ivars
|
|
10
10
|
|
|
11
11
|
# A hash representation of the build metadata.
|
data/lib/bundler/checksum.rb
CHANGED
|
@@ -206,13 +206,19 @@ module Bundler
|
|
|
206
206
|
end
|
|
207
207
|
|
|
208
208
|
def missing?(spec)
|
|
209
|
-
@store[spec.full_name].nil?
|
|
209
|
+
return false unless @store[spec.full_name].nil?
|
|
210
|
+
|
|
211
|
+
if spec.is_a?(LazySpecification)
|
|
212
|
+
spec.content_addressed_full_names.all? {|full_name| @store[full_name].nil? }
|
|
213
|
+
else
|
|
214
|
+
true
|
|
215
|
+
end
|
|
210
216
|
end
|
|
211
217
|
|
|
212
218
|
def empty?(spec)
|
|
213
219
|
return false unless spec.source.is_a?(Bundler::Source::Rubygems)
|
|
214
220
|
|
|
215
|
-
@store[spec.full_name]
|
|
221
|
+
@store[spec.full_name]&.empty? || false
|
|
216
222
|
end
|
|
217
223
|
|
|
218
224
|
def register(spec, checksum)
|
data/lib/bundler/cli/clean.rb
CHANGED
|
@@ -13,13 +13,29 @@ module Bundler
|
|
|
13
13
|
Bundler.load.clean(options[:"dry-run"])
|
|
14
14
|
return if options[:"dry-run"]
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
prune
|
|
17
|
+
rescue CleanError
|
|
18
|
+
# Everything that could be removed is gone, so the cache can be pruned
|
|
19
|
+
prune
|
|
20
|
+
raise
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Cleaning is incidental to install and update, so leftovers must not fail
|
|
24
|
+
# a command that installed everything it was asked to.
|
|
25
|
+
def run_after_install
|
|
26
|
+
run
|
|
27
|
+
rescue CleanError => e
|
|
28
|
+
Bundler.ui.warn e.message
|
|
19
29
|
end
|
|
20
30
|
|
|
21
31
|
protected
|
|
22
32
|
|
|
33
|
+
# Pruning last, because cleaning decides which cached .gem files are
|
|
34
|
+
# stale by reading them.
|
|
35
|
+
def prune
|
|
36
|
+
Bundler::CLI::Common.prune(options)
|
|
37
|
+
end
|
|
38
|
+
|
|
23
39
|
def require_path_or_force
|
|
24
40
|
return unless Bundler.use_system_gems? && !options[:force]
|
|
25
41
|
raise InvalidOption, "Cleaning all the gems on your system is dangerous! " \
|
data/lib/bundler/cli/exec.rb
CHANGED
data/lib/bundler/cli/install.rb
CHANGED
data/lib/bundler/cli/lock.rb
CHANGED
|
@@ -63,11 +63,23 @@ module Bundler
|
|
|
63
63
|
raise InvalidOption, "Removing all platforms from the bundle is not allowed"
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
options["remove-ruby-abi"].flatten.each do |ruby_abi|
|
|
67
|
+
definition.remove_ruby_abi(ruby_abi)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
options["add-ruby-abi"].flatten.each do |ruby_abi|
|
|
71
|
+
raise InvalidOption, "Expected `--add-ruby-abi` to be a Ruby ABI like `X.Y`, got #{ruby_abi.inspect}" unless Gem::ContentAddress.valid_ruby_abi?(ruby_abi)
|
|
72
|
+
|
|
73
|
+
definition.add_ruby_abi(ruby_abi)
|
|
74
|
+
end
|
|
75
|
+
|
|
66
76
|
# Adding checksums resolves the bundle to fetch them, so it has to
|
|
67
77
|
# run after every platform change above has been recorded, or the
|
|
68
78
|
# new platforms are listed in the lockfile without their specs.
|
|
69
79
|
definition.add_checksums if options["add-checksums"]
|
|
70
80
|
|
|
81
|
+
# Adding a Ruby ABI offline takes its content-addressed gems from the installed ones.
|
|
82
|
+
definition.with_cache! if options[:local] && options["add-ruby-abi"].any?
|
|
71
83
|
definition.remotely! unless options[:local]
|
|
72
84
|
|
|
73
85
|
if options["normalize-platforms"]
|
data/lib/bundler/cli/update.rb
CHANGED
data/lib/bundler/cli.rb
CHANGED
|
@@ -653,6 +653,8 @@ module Bundler
|
|
|
653
653
|
method_option "add-platform", type: :array, default: [], repeatable: true, banner: "Add a new platform to the lockfile"
|
|
654
654
|
method_option "remove-platform", type: :array, default: [], repeatable: true, banner: "Remove a platform from the lockfile"
|
|
655
655
|
method_option "normalize-platforms", type: :boolean, default: false, banner: "Normalize lockfile platforms"
|
|
656
|
+
method_option "add-ruby-abi", type: :array, default: [], repeatable: true, banner: "Lock the content-addressed gems for a Ruby ABI (X.Y)"
|
|
657
|
+
method_option "remove-ruby-abi", type: :array, default: [], repeatable: true, banner: "Drop the content-addressed gems for a Ruby ABI (X.Y) from the lockfile"
|
|
656
658
|
method_option "patch", type: :boolean, banner: "If updating, prefer updating only to next patch version"
|
|
657
659
|
method_option "minor", type: :boolean, banner: "If updating, prefer updating only to next minor version"
|
|
658
660
|
method_option "major", type: :boolean, banner: "If updating, prefer updating to latest major version (default)"
|
data/lib/bundler/definition.rb
CHANGED
|
@@ -104,6 +104,8 @@ module Bundler
|
|
|
104
104
|
@new_platforms = []
|
|
105
105
|
@removed_platforms = []
|
|
106
106
|
@originally_invalid_platforms = []
|
|
107
|
+
@new_ruby_abis = []
|
|
108
|
+
@removed_ruby_abis = []
|
|
107
109
|
|
|
108
110
|
if lockfile_exists?
|
|
109
111
|
@lockfile_contents = Bundler.read_file(lockfile)
|
|
@@ -111,6 +113,8 @@ module Bundler
|
|
|
111
113
|
@locked_platforms = @locked_gems.platforms
|
|
112
114
|
@most_specific_locked_platform = @locked_gems.most_specific_locked_platform
|
|
113
115
|
@platforms = @locked_platforms.dup
|
|
116
|
+
@locked_ruby_abis = @locked_gems.ruby_abis
|
|
117
|
+
@ruby_abis = @locked_ruby_abis.dup
|
|
114
118
|
@locked_bundler_version = @locked_gems.bundler_version
|
|
115
119
|
@locked_ruby_version = @locked_gems.ruby_version
|
|
116
120
|
@locked_deps = @locked_gems.dependencies
|
|
@@ -139,7 +143,9 @@ module Bundler
|
|
|
139
143
|
@locked_gems = nil
|
|
140
144
|
@locked_platforms = []
|
|
141
145
|
@most_specific_locked_platform = nil
|
|
142
|
-
@platforms
|
|
146
|
+
@platforms = []
|
|
147
|
+
@locked_ruby_abis = []
|
|
148
|
+
@ruby_abis = []
|
|
143
149
|
@locked_deps = {}
|
|
144
150
|
@locked_specs = SpecSet.new([])
|
|
145
151
|
@locked_sources = []
|
|
@@ -153,7 +159,11 @@ module Bundler
|
|
|
153
159
|
end
|
|
154
160
|
@unlocking ||= @unlocking_ruby ||= (!@locked_ruby_version ^ !@ruby_version)
|
|
155
161
|
|
|
162
|
+
@excluded_ruby_abis = @ruby_version && content_addressing_supported? ? @ruby_abis.select {|ruby_abi| ruby_abi_excluded?(ruby_abi) } : []
|
|
163
|
+
@ruby_abis -= @excluded_ruby_abis
|
|
164
|
+
|
|
156
165
|
@current_platform_missing = add_current_platform unless Bundler.frozen_bundle?
|
|
166
|
+
@current_ruby_abi_missing = add_current_ruby_abi unless Bundler.frozen_bundle?
|
|
157
167
|
|
|
158
168
|
@source_changes = converge_sources
|
|
159
169
|
@path_changes = converge_paths
|
|
@@ -370,6 +380,7 @@ module Bundler
|
|
|
370
380
|
start_resolution
|
|
371
381
|
end
|
|
372
382
|
warn_inert_overrides(@resolve)
|
|
383
|
+
@resolve.assign_content_addresses!(@ruby_abis, local: sources.local_mode?) if @removed_ruby_abis.any?
|
|
373
384
|
@resolve
|
|
374
385
|
end
|
|
375
386
|
|
|
@@ -543,6 +554,32 @@ module Bundler
|
|
|
543
554
|
resolve.normalize_platforms!(current_dependencies, platforms)
|
|
544
555
|
|
|
545
556
|
@resolve = SpecSet.new(resolve.for(current_dependencies, @platforms))
|
|
557
|
+
@resolve.assign_content_addresses!(@ruby_abis, normalize: true)
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
def ruby_abis
|
|
561
|
+
return [] unless content_addressing_supported? || content_addresses_carried_over?
|
|
562
|
+
|
|
563
|
+
@ruby_abis.sort_by {|ruby_abi| Gem::Version.new(ruby_abi) }
|
|
564
|
+
end
|
|
565
|
+
|
|
566
|
+
def add_ruby_abi(ruby_abi)
|
|
567
|
+
ensure_content_addressing_supported!
|
|
568
|
+
if @ruby_version && ruby_abi_excluded?(ruby_abi)
|
|
569
|
+
raise InvalidOption, "Unable to add the Ruby ABI `#{ruby_abi}` since your Gemfile requires #{@ruby_version}"
|
|
570
|
+
end
|
|
571
|
+
return if @locked_ruby_abis.include?(ruby_abi) || @new_ruby_abis.include?(ruby_abi)
|
|
572
|
+
|
|
573
|
+
@new_ruby_abis << ruby_abi
|
|
574
|
+
@ruby_abis |= [ruby_abi]
|
|
575
|
+
end
|
|
576
|
+
|
|
577
|
+
def remove_ruby_abi(ruby_abi)
|
|
578
|
+
ensure_content_addressing_supported!
|
|
579
|
+
raise InvalidOption, "Unable to remove the Ruby ABI `#{ruby_abi}` since the only Ruby ABIs are #{ruby_abis.join(", ")}" unless @ruby_abis.include?(ruby_abi)
|
|
580
|
+
|
|
581
|
+
@removed_ruby_abis << ruby_abi
|
|
582
|
+
@ruby_abis.delete(ruby_abi)
|
|
546
583
|
end
|
|
547
584
|
|
|
548
585
|
def add_platform(platform)
|
|
@@ -601,6 +638,8 @@ module Bundler
|
|
|
601
638
|
|
|
602
639
|
added.concat @new_platforms.map {|p| "* platform: #{p}" }
|
|
603
640
|
deleted.concat @removed_platforms.map {|p| "* platform: #{p}" }
|
|
641
|
+
added.concat @new_ruby_abis.map {|abi| "* ruby abi: #{abi}" }
|
|
642
|
+
deleted.concat @removed_ruby_abis.map {|abi| "* ruby abi: #{abi}" }
|
|
604
643
|
|
|
605
644
|
added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any?
|
|
606
645
|
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
|
@@ -660,6 +699,9 @@ module Bundler
|
|
|
660
699
|
@dependency_changes ||
|
|
661
700
|
@current_platform_missing ||
|
|
662
701
|
@new_platforms.any? ||
|
|
702
|
+
@current_ruby_abi_missing ||
|
|
703
|
+
@new_ruby_abis.any? ||
|
|
704
|
+
@excluded_ruby_abis.any? ||
|
|
663
705
|
@path_changes ||
|
|
664
706
|
@local_changes ||
|
|
665
707
|
@missing_lockfile_dep ||
|
|
@@ -787,7 +829,9 @@ module Bundler
|
|
|
787
829
|
loop do
|
|
788
830
|
break if incomplete_specs.empty?
|
|
789
831
|
|
|
790
|
-
Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though,
|
|
832
|
+
Bundler.ui.debug("The lockfile does not have all gems needed for the current platform (#{Bundler.local_platform}) though, " \
|
|
833
|
+
"Bundler will still re-resolve dependencies. The following locked gems could not be materialized for it: " \
|
|
834
|
+
"#{incomplete_specs.map(&:full_name).join(", ")}")
|
|
791
835
|
sources.remote!
|
|
792
836
|
reresolve_without(incomplete_specs)
|
|
793
837
|
specs = resolve.materialize(dependencies)
|
|
@@ -853,7 +897,22 @@ module Bundler
|
|
|
853
897
|
result.add_originally_invalid_platforms!(platforms, @originally_invalid_platforms)
|
|
854
898
|
end
|
|
855
899
|
|
|
856
|
-
SpecSet.new(result.for(dependencies, @platforms | [Gem::Platform::RUBY]))
|
|
900
|
+
specs = SpecSet.new(result.for(dependencies, @platforms | [Gem::Platform::RUBY]))
|
|
901
|
+
specs.assign_content_addresses!(@ruby_abis, local: sources.local_mode?)
|
|
902
|
+
|
|
903
|
+
if sources.local_mode?
|
|
904
|
+
# Only installed gems are in reach, so a Ruby is recorded once every row
|
|
905
|
+
# has its gem; the running Ruby otherwise waits for the next online resolution.
|
|
906
|
+
@ruby_abis.delete(Gem.ruby_abi) if @current_ruby_abi_missing && !specs.content_addresses_cover?(Gem.ruby_abi)
|
|
907
|
+
|
|
908
|
+
@new_ruby_abis.each do |ruby_abi|
|
|
909
|
+
next if specs.content_addresses_cover?(ruby_abi)
|
|
910
|
+
|
|
911
|
+
raise GemNotFound, "Could not find content-addressed gems for Ruby ABI #{ruby_abi} in locally installed gems"
|
|
912
|
+
end
|
|
913
|
+
end
|
|
914
|
+
|
|
915
|
+
specs
|
|
857
916
|
end
|
|
858
917
|
|
|
859
918
|
def precompute_source_requirements_for_indirect_dependencies?
|
|
@@ -894,6 +953,66 @@ module Bundler
|
|
|
894
953
|
true
|
|
895
954
|
end
|
|
896
955
|
|
|
956
|
+
def add_current_ruby_abi
|
|
957
|
+
return unless content_addressing_supported?
|
|
958
|
+
return if @ruby_abis.include?(Gem.ruby_abi)
|
|
959
|
+
|
|
960
|
+
@ruby_abis << Gem.ruby_abi
|
|
961
|
+
@locked_specs.any? {|spec| spec.content_addresses.any? }
|
|
962
|
+
end
|
|
963
|
+
|
|
964
|
+
# RubyGems before 4.1 can't lock content-addressed gems, so changing the
|
|
965
|
+
# locked Ruby ABIs there would leave CONTENT ADDRESSES out of step with them.
|
|
966
|
+
def content_addressing_supported?
|
|
967
|
+
Bundler.rubygems.provides?(">= 4.1.0.a")
|
|
968
|
+
end
|
|
969
|
+
|
|
970
|
+
def ensure_content_addressing_supported!
|
|
971
|
+
return if content_addressing_supported?
|
|
972
|
+
|
|
973
|
+
raise InvalidOption, "Changing the Ruby ABIs in the lockfile requires RubyGems 4.1.0 or later, but you are using RubyGems #{Bundler.rubygems.version}"
|
|
974
|
+
end
|
|
975
|
+
|
|
976
|
+
# Older RubyGems resolves platform gems without the content addresses the
|
|
977
|
+
# lockfile had for them, and may swap a locked one for its ruby variant. Unless
|
|
978
|
+
# every platform gem comes through as locked, the lockfile then drops its Ruby
|
|
979
|
+
# ABIs, so that RubyGems 4.1 resolves again and records the content addresses
|
|
980
|
+
# instead of falling back.
|
|
981
|
+
def content_addresses_carried_over?
|
|
982
|
+
locked = @originally_locked_specs.select {|spec| spec.platform != Gem::Platform::RUBY && resolve[spec.name].any? }
|
|
983
|
+
resolved = resolve.select {|spec| spec.platform != Gem::Platform::RUBY }
|
|
984
|
+
|
|
985
|
+
locked.to_h {|spec| [spec.full_name, spec.content_addresses] } == resolved.to_h {|spec| [spec.full_name, spec.content_addresses] }
|
|
986
|
+
end
|
|
987
|
+
|
|
988
|
+
def ruby_abi_excluded?(ruby_abi)
|
|
989
|
+
comparators = Gem::Requirement.new(@ruby_version.versions).requirements +
|
|
990
|
+
Gem::ContentAddress.ruby_abi_requirement(ruby_abi).requirements
|
|
991
|
+
|
|
992
|
+
lower = []
|
|
993
|
+
upper = []
|
|
994
|
+
comparators.each do |op, version|
|
|
995
|
+
case op
|
|
996
|
+
when ">=" then lower << [version, true]
|
|
997
|
+
when ">" then lower << [version, false]
|
|
998
|
+
when "<=" then upper << [version, true]
|
|
999
|
+
when "<" then upper << [version, false]
|
|
1000
|
+
when "="
|
|
1001
|
+
lower << [version, true]
|
|
1002
|
+
upper << [version, true]
|
|
1003
|
+
when "~>"
|
|
1004
|
+
lower << [version, true]
|
|
1005
|
+
upper << [Gem::Version.new("#{version.bump}.A"), false]
|
|
1006
|
+
end
|
|
1007
|
+
end
|
|
1008
|
+
return false if lower.empty? || upper.empty?
|
|
1009
|
+
|
|
1010
|
+
min, min_inclusive = lower.max_by {|version, inclusive| [version, inclusive ? 0 : 1] }
|
|
1011
|
+
max, max_inclusive = upper.min_by {|version, inclusive| [version, inclusive ? 1 : 0] }
|
|
1012
|
+
|
|
1013
|
+
min > max || (min == max && !(min_inclusive && max_inclusive))
|
|
1014
|
+
end
|
|
1015
|
+
|
|
897
1016
|
def find_most_specific_locked_platform
|
|
898
1017
|
return unless current_platform_locked?
|
|
899
1018
|
|
|
@@ -948,6 +1067,9 @@ module Bundler
|
|
|
948
1067
|
[@dependency_changes, "the dependencies in your gemfile changed"],
|
|
949
1068
|
[@current_platform_missing, "your lockfile is missing the current platform"],
|
|
950
1069
|
[@new_platforms.any?, "you are adding a new platform to your lockfile"],
|
|
1070
|
+
[@new_ruby_abis.any?, "you are adding a new Ruby ABI to your lockfile"],
|
|
1071
|
+
[@current_ruby_abi_missing, "your lockfile does not cover the current Ruby ABI"],
|
|
1072
|
+
[@excluded_ruby_abis.any?, "your Gemfile's ruby directive rules out Ruby ABIs in your lockfile"],
|
|
951
1073
|
[@path_changes, "the gemspecs for path gems changed"],
|
|
952
1074
|
[@local_changes, "the gemspecs for git local gems changed"],
|
|
953
1075
|
[@missing_lockfile_dep, "your lockfile is missing \"#{@missing_lockfile_dep}\""],
|
data/lib/bundler/dsl.rb
CHANGED
|
@@ -81,11 +81,15 @@ module Bundler
|
|
|
81
81
|
@gemspecs << spec
|
|
82
82
|
|
|
83
83
|
path path, "glob" => glob, "name" => spec.name, "gemspec" => spec do
|
|
84
|
-
|
|
84
|
+
options = {}
|
|
85
|
+
normalize_options(spec.name, [], options)
|
|
86
|
+
add_dependency spec.name, nil, options
|
|
85
87
|
end
|
|
86
88
|
|
|
87
89
|
spec.development_dependencies.each do |dep|
|
|
88
|
-
|
|
90
|
+
options = {}
|
|
91
|
+
normalize_options(dep.name, dep.requirement.as_list, options)
|
|
92
|
+
add_dependency dep.name, dep.requirement.as_list, options.merge("gemspec_dev_dep" => true, "group" => development_group)
|
|
89
93
|
end
|
|
90
94
|
when 0
|
|
91
95
|
raise InvalidOption, "There are no gemspecs at #{expanded_path}"
|
data/lib/bundler/errors.rb
CHANGED
|
@@ -303,4 +303,12 @@ module Bundler
|
|
|
303
303
|
|
|
304
304
|
status_code(41)
|
|
305
305
|
end
|
|
306
|
+
|
|
307
|
+
class CleanError < BundlerError
|
|
308
|
+
def initialize(errors)
|
|
309
|
+
super("Bundler could not remove some unused files:\n\n#{errors.map(&:message).uniq.join("\n")}")
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
status_code(44)
|
|
313
|
+
end
|
|
306
314
|
end
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "rubygems/text"
|
|
4
|
+
|
|
3
5
|
module Bundler
|
|
4
6
|
class Fetcher
|
|
5
7
|
class Downloader
|
|
8
|
+
include Gem::Text
|
|
9
|
+
|
|
6
10
|
HTTP_NON_RETRYABLE_ERRORS = [
|
|
7
11
|
SocketError,
|
|
8
12
|
Errno::EADDRNOTAVAIL,
|
|
@@ -72,9 +76,9 @@ module Bundler
|
|
|
72
76
|
new_headers.delete("Range")
|
|
73
77
|
fetch(uri, new_headers)
|
|
74
78
|
when Gem::Net::HTTPRequestEntityTooLarge
|
|
75
|
-
raise FallbackError, response.body
|
|
79
|
+
raise FallbackError, clean_text(response.body)
|
|
76
80
|
when Gem::Net::HTTPTooManyRequests
|
|
77
|
-
raise TooManyRequestsError, response.body
|
|
81
|
+
raise TooManyRequestsError, clean_text(response.body)
|
|
78
82
|
when Gem::Net::HTTPUnauthorized
|
|
79
83
|
raise BadAuthenticationError, uri.host if uri.userinfo
|
|
80
84
|
raise AuthenticationRequiredError, uri.host
|
|
@@ -123,7 +127,7 @@ module Bundler
|
|
|
123
127
|
|
|
124
128
|
def bad_response(response)
|
|
125
129
|
message = "Gem::#{response.class.name.gsub(/\AGem::/, "")}"
|
|
126
|
-
message += ": #{response.body}" unless response.body.empty?
|
|
130
|
+
message += ": #{clean_text(response.body)}" unless response.body.empty?
|
|
127
131
|
HTTPError.new(message)
|
|
128
132
|
end
|
|
129
133
|
|
data/lib/bundler/index.rb
CHANGED
|
@@ -188,8 +188,13 @@ module Bundler
|
|
|
188
188
|
EMPTY_SEARCH = [].freeze
|
|
189
189
|
|
|
190
190
|
def search_by_spec(spec)
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
specs_by_name = @specs[spec.name]
|
|
192
|
+
return EMPTY_SEARCH unless specs_by_name
|
|
193
|
+
|
|
194
|
+
full_names = [spec.full_name]
|
|
195
|
+
full_names.concat(spec.content_addressed_full_names) if spec.is_a?(LazySpecification)
|
|
196
|
+
|
|
197
|
+
full_names.filter_map {|full_name| specs_by_name[full_name] }
|
|
193
198
|
end
|
|
194
199
|
|
|
195
200
|
def find_by_spec(spec)
|
data/lib/bundler/inline.rb
CHANGED
|
@@ -72,18 +72,25 @@ def gemfile(force_latest_compatible = false, options = {}, &gemfile)
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# When possible we do the install in a subprocess because to install
|
|
75
|
-
# gems we need to require some default gems like `
|
|
75
|
+
# gems we need to require some default gems like `tempfile` etc
|
|
76
76
|
# which may later conflict with the Gemfile requirements.
|
|
77
77
|
installed_in_fork = false
|
|
78
78
|
if Process.respond_to?(:fork)
|
|
79
79
|
Gem.load_yaml # Avoid NameError on Ruby 3.2's safe_yaml.rb after Gem::Specification.reset
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
# exit! leaves the script's at_exit hooks to this process, which installs again on failure to raise the error here
|
|
81
|
+
pid = Process.fork do
|
|
82
|
+
$VERBOSE = nil
|
|
83
|
+
do_install.call
|
|
84
|
+
$stdout.flush
|
|
85
|
+
$stderr.flush
|
|
86
|
+
exit!(true)
|
|
87
|
+
rescue Exception # rubocop:disable Lint/RescueException
|
|
88
|
+
exit!(false)
|
|
89
|
+
end
|
|
90
|
+
installed_in_fork = Process.waitpid2(pid).last.success?
|
|
91
|
+
end
|
|
86
92
|
|
|
93
|
+
if installed_in_fork
|
|
87
94
|
Bundler.reset!
|
|
88
95
|
Gem::Specification.reset
|
|
89
96
|
Bundler.instance_variable_set(:@bundle_path, Pathname.new(Gem.dir))
|
|
@@ -110,7 +117,8 @@ def gemfile(force_latest_compatible = false, options = {}, &gemfile)
|
|
|
110
117
|
configure_forked_definition.call(definition) if installed_in_fork
|
|
111
118
|
|
|
112
119
|
begin
|
|
113
|
-
runtime = Bundler::Runtime.new(nil, definition)
|
|
120
|
+
runtime = Bundler::Runtime.new(nil, definition)
|
|
121
|
+
installed_in_fork ? Bundler.ui.silence { runtime.setup } : runtime.setup
|
|
114
122
|
rescue Gem::LoadError => e
|
|
115
123
|
name = e.name
|
|
116
124
|
version = e.requirement.requirements.first[1]
|
data/lib/bundler/installer.rb
CHANGED
|
@@ -80,6 +80,7 @@ module Bundler
|
|
|
80
80
|
ensure_specs_are_compatible!
|
|
81
81
|
load_plugins
|
|
82
82
|
end
|
|
83
|
+
warn_on_default_gem_downgrades
|
|
83
84
|
install(options)
|
|
84
85
|
|
|
85
86
|
Gem::Specification.reset # invalidate gem specification cache so that installed gems are immediately available
|
|
@@ -258,6 +259,24 @@ module Bundler
|
|
|
258
259
|
"to add it to the lockfile as a fallback, then commit the updated #{SharedHelpers.relative_lockfile_path}."
|
|
259
260
|
end
|
|
260
261
|
|
|
262
|
+
def warn_on_default_gem_downgrades
|
|
263
|
+
default_gems = Bundler.rubygems.default_stubs.to_h {|spec| [spec.name, spec] }
|
|
264
|
+
downgrades = @definition.specs.sort_by(&:name).filter_map do |spec|
|
|
265
|
+
# The specs always include the running Bundler, which the Gemfile does not choose.
|
|
266
|
+
next if spec.name == "bundler"
|
|
267
|
+
default_spec = default_gems[spec.name]
|
|
268
|
+
next unless default_spec && spec.version < default_spec.version
|
|
269
|
+
[spec, default_spec]
|
|
270
|
+
end
|
|
271
|
+
return if downgrades.empty?
|
|
272
|
+
|
|
273
|
+
message = "Your bundle downgrades the following default gems shipped with #{Bundler::RubyVersion.system}:\n"
|
|
274
|
+
downgrades.each do |spec, default_spec|
|
|
275
|
+
message += " * #{spec.name} #{spec.version} (default: #{default_spec.version})\n"
|
|
276
|
+
end
|
|
277
|
+
Bundler.ui.warn message.chomp
|
|
278
|
+
end
|
|
279
|
+
|
|
261
280
|
def lock
|
|
262
281
|
@definition.lock
|
|
263
282
|
end
|