rubygems-update 3.6.8 → 3.7.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/CHANGELOG.md +874 -787
- data/CONTRIBUTING.md +9 -0
- data/Manifest.txt +6 -22
- data/README.md +1 -1
- data/SECURITY.md +7 -0
- data/bundler/CHANGELOG.md +1103 -1030
- data/bundler/README.md +7 -7
- data/bundler/bundler.gemspec +2 -2
- data/bundler/lib/bundler/build_metadata.rb +10 -11
- data/bundler/lib/bundler/cli/common.rb +1 -1
- data/bundler/lib/bundler/cli/config.rb +2 -2
- data/bundler/lib/bundler/cli/doctor/diagnose.rb +167 -0
- data/bundler/lib/bundler/cli/doctor/ssl.rb +249 -0
- data/bundler/lib/bundler/cli/doctor.rb +27 -155
- data/bundler/lib/bundler/cli/gem.rb +62 -30
- data/bundler/lib/bundler/cli/install.rb +4 -4
- data/bundler/lib/bundler/cli/issue.rb +2 -2
- data/bundler/lib/bundler/cli/outdated.rb +1 -1
- data/bundler/lib/bundler/cli/update.rb +2 -2
- data/bundler/lib/bundler/cli.rb +12 -25
- data/bundler/lib/bundler/compact_index_client.rb +1 -5
- data/bundler/lib/bundler/current_ruby.rb +27 -3
- data/bundler/lib/bundler/definition.rb +55 -58
- data/bundler/lib/bundler/dependency.rb +1 -1
- data/bundler/lib/bundler/dsl.rb +33 -23
- data/bundler/lib/bundler/feature_flag.rb +15 -12
- data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
- data/bundler/lib/bundler/fetcher/downloader.rb +33 -7
- data/bundler/lib/bundler/fetcher.rb +49 -19
- data/bundler/lib/bundler/friendly_errors.rb +2 -1
- data/bundler/lib/bundler/index.rb +7 -2
- data/bundler/lib/bundler/installer.rb +5 -4
- data/bundler/lib/bundler/lazy_specification.rb +29 -18
- data/bundler/lib/bundler/lockfile_parser.rb +21 -5
- data/bundler/lib/bundler/man/bundle-add.1 +1 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +172 -126
- data/bundler/lib/bundler/man/bundle-config.1.ronn +91 -91
- data/bundler/lib/bundler/man/bundle-console.1 +1 -1
- data/bundler/lib/bundler/man/bundle-doctor.1 +43 -4
- data/bundler/lib/bundler/man/bundle-doctor.1.ronn +48 -4
- data/bundler/lib/bundler/man/bundle-env.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
- data/bundler/lib/bundler/man/bundle-fund.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +67 -44
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +8 -4
- data/bundler/lib/bundler/man/bundle-help.1 +1 -1
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +2 -2
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +1 -1
- data/bundler/lib/bundler/man/bundle-issue.1 +1 -1
- data/bundler/lib/bundler/man/bundle-licenses.1 +1 -1
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
- data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-version.1 +1 -1
- data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +1 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/match_platform.rb +31 -12
- data/bundler/lib/bundler/materialization.rb +2 -2
- data/bundler/lib/bundler/resolver/package.rb +1 -1
- data/bundler/lib/bundler/resolver.rb +11 -9
- data/bundler/lib/bundler/rubygems_ext.rb +116 -120
- data/bundler/lib/bundler/rubygems_integration.rb +11 -6
- data/bundler/lib/bundler/runtime.rb +1 -1
- data/bundler/lib/bundler/self_manager.rb +32 -42
- data/bundler/lib/bundler/settings/validator.rb +0 -23
- data/bundler/lib/bundler/settings.rb +4 -6
- data/bundler/lib/bundler/shared_helpers.rb +6 -4
- data/bundler/lib/bundler/source/git/git_proxy.rb +3 -3
- data/bundler/lib/bundler/source/path.rb +7 -0
- data/bundler/lib/bundler/source_list.rb +1 -5
- data/bundler/lib/bundler/source_map.rb +1 -1
- data/bundler/lib/bundler/spec_set.rb +28 -6
- data/bundler/lib/bundler/templates/Executable +0 -11
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -5
- data/bundler/lib/bundler/ui/shell.rb +2 -2
- data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +81 -42
- data/bundler/lib/bundler/version.rb +10 -2
- data/bundler/lib/bundler/worker.rb +1 -1
- data/bundler/lib/bundler.rb +14 -12
- data/doc/bundler/UPGRADING.md +137 -127
- data/doc/rubygems/CONTRIBUTING.md +1 -1
- data/lib/rubygems/basic_specification.rb +7 -0
- data/lib/rubygems/commands/pristine_command.rb +9 -12
- data/lib/rubygems/commands/push_command.rb +2 -1
- data/lib/rubygems/commands/setup_command.rb +2 -2
- data/lib/rubygems/core_ext/kernel_require.rb +5 -2
- data/lib/rubygems/ext/builder.rb +15 -4
- data/lib/rubygems/ext/cargo_builder.rb +7 -5
- data/lib/rubygems/ext/rake_builder.rb +1 -3
- data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +10 -3
- data/lib/rubygems/gemcutter_utilities.rb +5 -2
- data/lib/rubygems/installer.rb +45 -50
- data/lib/rubygems/package/tar_writer.rb +5 -4
- data/lib/rubygems/platform.rb +142 -39
- data/lib/rubygems/remote_fetcher.rb +3 -3
- data/lib/rubygems/request_set.rb +3 -6
- data/lib/rubygems/resolver/best_set.rb +1 -1
- data/lib/rubygems/resolver/source_set.rb +1 -1
- data/lib/rubygems/resolver.rb +1 -1
- data/lib/rubygems/s3_uri_signer.rb +5 -3
- data/lib/rubygems/source.rb +28 -22
- data/lib/rubygems/specification.rb +2 -2
- data/lib/rubygems/uri_formatter.rb +2 -1
- data/lib/rubygems/util/licenses.rb +21 -0
- data/lib/rubygems/vendor/net-http/lib/net/http.rb +14 -19
- data/lib/rubygems/vendor/resolv/lib/resolv.rb +50 -22
- data/lib/rubygems.rb +65 -7
- data/rubygems-update.gemspec +2 -2
- data/setup.rb +1 -1
- metadata +9 -25
- data/bundler/lib/bundler/gem_helpers.rb +0 -144
- data/bundler/lib/bundler/templates/Executable.bundler +0 -109
- data/bundler/lib/bundler/vendor/fileutils/.document +0 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/.document +0 -1
- data/bundler/lib/bundler/vendor/pub_grub/.document +0 -1
- data/bundler/lib/bundler/vendor/securerandom/.document +0 -1
- data/bundler/lib/bundler/vendor/thor/.document +0 -1
- data/bundler/lib/bundler/vendor/tsort/.document +0 -1
- data/bundler/lib/bundler/vendor/uri/.document +0 -1
- data/lib/rubygems/shellwords.rb +0 -3
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/rubygems/vendor/molinillo/.document +0 -1
- data/lib/rubygems/vendor/net-http/.document +0 -1
- data/lib/rubygems/vendor/net-protocol/.document +0 -1
- data/lib/rubygems/vendor/optparse/.document +0 -1
- data/lib/rubygems/vendor/resolv/.document +0 -1
- data/lib/rubygems/vendor/securerandom/.document +0 -1
- data/lib/rubygems/vendor/timeout/.document +0 -1
- data/lib/rubygems/vendor/tsort/.document +0 -1
- data/lib/rubygems/vendor/uri/.document +0 -1
- /data/lib/rubygems/ssl_certs/rubygems.org/{GlobalSignRootCA_R3.pem → GlobalSign.pem} +0 -0
- /data/{bundler/lib/bundler/vendor/connection_pool → lib/rubygems/vendor}/.document +0 -0
@@ -4,8 +4,6 @@ require_relative "lockfile_parser"
|
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
class Definition
|
7
|
-
include GemHelpers
|
8
|
-
|
9
7
|
class << self
|
10
8
|
# Do not create or modify a lockfile (Makes #lock a noop)
|
11
9
|
attr_accessor :no_lock
|
@@ -62,6 +60,7 @@ module Bundler
|
|
62
60
|
|
63
61
|
if unlock == true
|
64
62
|
@unlocking_all = true
|
63
|
+
strict = false
|
65
64
|
@unlocking_bundler = false
|
66
65
|
@unlocking = unlock
|
67
66
|
@sources_to_unlock = []
|
@@ -70,6 +69,7 @@ module Bundler
|
|
70
69
|
conservative = false
|
71
70
|
else
|
72
71
|
@unlocking_all = false
|
72
|
+
strict = unlock.delete(:strict)
|
73
73
|
@unlocking_bundler = unlock.delete(:bundler)
|
74
74
|
@unlocking = unlock.any? {|_k, v| !Array(v).empty? }
|
75
75
|
@sources_to_unlock = unlock.delete(:sources) || []
|
@@ -99,7 +99,7 @@ module Bundler
|
|
99
99
|
|
100
100
|
if lockfile_exists?
|
101
101
|
@lockfile_contents = Bundler.read_file(lockfile)
|
102
|
-
@locked_gems = LockfileParser.new(@lockfile_contents)
|
102
|
+
@locked_gems = LockfileParser.new(@lockfile_contents, strict: strict)
|
103
103
|
@locked_platforms = @locked_gems.platforms
|
104
104
|
@most_specific_locked_platform = @locked_gems.most_specific_locked_platform
|
105
105
|
@platforms = @locked_platforms.dup
|
@@ -257,7 +257,7 @@ module Bundler
|
|
257
257
|
rescue BundlerError => e
|
258
258
|
@resolve = nil
|
259
259
|
@resolver = nil
|
260
|
-
@
|
260
|
+
@resolution_base = nil
|
261
261
|
@source_requirements = nil
|
262
262
|
@specs = nil
|
263
263
|
|
@@ -282,7 +282,7 @@ module Bundler
|
|
282
282
|
end
|
283
283
|
|
284
284
|
def filter_relevant(dependencies)
|
285
|
-
platforms_array = [generic_local_platform].freeze
|
285
|
+
platforms_array = [Bundler.generic_local_platform].freeze
|
286
286
|
dependencies.select do |d|
|
287
287
|
d.should_include? && !d.gem_platforms(platforms_array).empty?
|
288
288
|
end
|
@@ -456,8 +456,8 @@ module Bundler
|
|
456
456
|
return if current_platform_locked? || @platforms.include?(Gem::Platform::RUBY)
|
457
457
|
|
458
458
|
raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
|
459
|
-
"but your local platform is #{local_platform}. " \
|
460
|
-
"Add the current platform to the lockfile with\n`bundle lock --add-platform #{local_platform}` and try again."
|
459
|
+
"but your local platform is #{Bundler.local_platform}. " \
|
460
|
+
"Add the current platform to the lockfile with\n`bundle lock --add-platform #{Bundler.local_platform}` and try again."
|
461
461
|
end
|
462
462
|
|
463
463
|
def normalize_platforms
|
@@ -568,7 +568,7 @@ module Bundler
|
|
568
568
|
end
|
569
569
|
|
570
570
|
def should_add_extra_platforms?
|
571
|
-
!lockfile_exists? && generic_local_platform_is_ruby? && !Bundler.settings[:force_ruby_platform]
|
571
|
+
!lockfile_exists? && Bundler::MatchPlatform.generic_local_platform_is_ruby? && !Bundler.settings[:force_ruby_platform]
|
572
572
|
end
|
573
573
|
|
574
574
|
def lockfile_exists?
|
@@ -614,7 +614,7 @@ module Bundler
|
|
614
614
|
end
|
615
615
|
|
616
616
|
def resolver
|
617
|
-
@resolver ||= Resolver.new(
|
617
|
+
@resolver ||= Resolver.new(resolution_base, gem_version_promoter, @most_specific_locked_platform)
|
618
618
|
end
|
619
619
|
|
620
620
|
def expanded_dependencies
|
@@ -628,15 +628,15 @@ module Bundler
|
|
628
628
|
[Dependency.new("bundler", @unlocking_bundler)] + dependencies
|
629
629
|
end
|
630
630
|
|
631
|
-
def
|
632
|
-
@
|
631
|
+
def resolution_base
|
632
|
+
@resolution_base ||= begin
|
633
633
|
last_resolve = converge_locked_specs
|
634
634
|
remove_invalid_platforms!
|
635
|
-
new_resolution_platforms = @current_platform_missing ? @new_platforms + [local_platform] : @new_platforms
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
635
|
+
new_resolution_platforms = @current_platform_missing ? @new_platforms + [Bundler.local_platform] : @new_platforms
|
636
|
+
base = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @unlocking_all || @gems_to_unlock, prerelease: gem_version_promoter.pre?, prefer_local: @prefer_local, new_platforms: new_resolution_platforms)
|
637
|
+
base = additional_base_requirements_to_prevent_downgrades(base)
|
638
|
+
base = additional_base_requirements_to_force_updates(base)
|
639
|
+
base
|
640
640
|
end
|
641
641
|
end
|
642
642
|
|
@@ -711,8 +711,7 @@ module Bundler
|
|
711
711
|
still_incomplete_specs = resolve.incomplete_specs
|
712
712
|
|
713
713
|
if still_incomplete_specs == incomplete_specs
|
714
|
-
|
715
|
-
resolver.raise_not_found! package
|
714
|
+
resolver.raise_incomplete! incomplete_specs
|
716
715
|
end
|
717
716
|
|
718
717
|
incomplete_specs = still_incomplete_specs
|
@@ -734,24 +733,32 @@ module Bundler
|
|
734
733
|
end
|
735
734
|
|
736
735
|
def reresolve_without(incomplete_specs)
|
737
|
-
|
736
|
+
resolution_base.delete(incomplete_specs)
|
738
737
|
@resolve = start_resolution
|
739
738
|
end
|
740
739
|
|
741
740
|
def start_resolution
|
742
|
-
local_platform_needed_for_resolvability = @most_specific_non_local_locked_platform && !@platforms.include?(local_platform)
|
743
|
-
@platforms << local_platform if local_platform_needed_for_resolvability
|
741
|
+
local_platform_needed_for_resolvability = @most_specific_non_local_locked_platform && !@platforms.include?(Bundler.local_platform)
|
742
|
+
@platforms << Bundler.local_platform if local_platform_needed_for_resolvability
|
744
743
|
add_platform(Gem::Platform::RUBY) if RUBY_ENGINE == "truffleruby"
|
745
744
|
|
746
745
|
result = SpecSet.new(resolver.start)
|
747
746
|
|
748
747
|
@resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
|
749
748
|
|
749
|
+
@new_platforms.each do |platform|
|
750
|
+
incomplete_specs = result.incomplete_specs_for_platform(current_dependencies, platform)
|
751
|
+
|
752
|
+
if incomplete_specs.any?
|
753
|
+
resolver.raise_incomplete! incomplete_specs
|
754
|
+
end
|
755
|
+
end
|
756
|
+
|
750
757
|
if @most_specific_non_local_locked_platform
|
751
|
-
if
|
758
|
+
if result.incomplete_for_platform?(current_dependencies, @most_specific_non_local_locked_platform)
|
752
759
|
@platforms.delete(@most_specific_non_local_locked_platform)
|
753
760
|
elsif local_platform_needed_for_resolvability
|
754
|
-
@platforms.delete(local_platform)
|
761
|
+
@platforms.delete(Bundler.local_platform)
|
755
762
|
end
|
756
763
|
end
|
757
764
|
|
@@ -770,17 +777,17 @@ module Bundler
|
|
770
777
|
|
771
778
|
def current_platform_locked?
|
772
779
|
@platforms.any? do |bundle_platform|
|
773
|
-
generic_local_platform == bundle_platform || local_platform === bundle_platform
|
780
|
+
Bundler.generic_local_platform == bundle_platform || Bundler.local_platform === bundle_platform
|
774
781
|
end
|
775
782
|
end
|
776
783
|
|
777
784
|
def add_current_platform
|
778
|
-
return if @platforms.include?(local_platform)
|
785
|
+
return if @platforms.include?(Bundler.local_platform)
|
779
786
|
|
780
787
|
@most_specific_non_local_locked_platform = find_most_specific_locked_platform
|
781
788
|
return if @most_specific_non_local_locked_platform
|
782
789
|
|
783
|
-
@platforms << local_platform
|
790
|
+
@platforms << Bundler.local_platform
|
784
791
|
true
|
785
792
|
end
|
786
793
|
|
@@ -1030,17 +1037,16 @@ module Bundler
|
|
1030
1037
|
lockfile_source = s.source
|
1031
1038
|
|
1032
1039
|
if dep
|
1033
|
-
|
1034
|
-
|
1035
|
-
deps << dep if !dep.source || lockfile_source.include?(dep.source) || new_deps.include?(dep)
|
1040
|
+
replacement_source = dep.source
|
1036
1041
|
|
1037
|
-
|
1038
|
-
s.source = gemfile_source
|
1042
|
+
deps << dep if !replacement_source || lockfile_source.include?(replacement_source) || new_deps.include?(dep)
|
1039
1043
|
else
|
1040
|
-
|
1041
|
-
s.source = default_source unless sources.get(lockfile_source)
|
1044
|
+
replacement_source = sources.get(lockfile_source)
|
1042
1045
|
end
|
1043
1046
|
|
1047
|
+
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
1048
|
+
s.source = replacement_source || default_source
|
1049
|
+
|
1044
1050
|
source = s.source
|
1045
1051
|
next if @sources_to_unlock.include?(source.name)
|
1046
1052
|
|
@@ -1124,27 +1130,27 @@ module Bundler
|
|
1124
1130
|
current == proposed
|
1125
1131
|
end
|
1126
1132
|
|
1127
|
-
def additional_base_requirements_to_prevent_downgrades(
|
1128
|
-
return
|
1133
|
+
def additional_base_requirements_to_prevent_downgrades(resolution_base)
|
1134
|
+
return resolution_base unless @locked_gems && !sources.expired_sources?(@locked_gems.sources)
|
1129
1135
|
@originally_locked_specs.each do |locked_spec|
|
1130
1136
|
next if locked_spec.source.is_a?(Source::Path)
|
1131
1137
|
|
1132
1138
|
name = locked_spec.name
|
1133
1139
|
next if @changed_dependencies.include?(name)
|
1134
1140
|
|
1135
|
-
|
1141
|
+
resolution_base.base_requirements[name] = Gem::Requirement.new(">= #{locked_spec.version}")
|
1136
1142
|
end
|
1137
|
-
|
1143
|
+
resolution_base
|
1138
1144
|
end
|
1139
1145
|
|
1140
|
-
def additional_base_requirements_to_force_updates(
|
1141
|
-
return
|
1146
|
+
def additional_base_requirements_to_force_updates(resolution_base)
|
1147
|
+
return resolution_base if @explicit_unlocks.empty?
|
1142
1148
|
full_update = dup_for_full_unlock.resolve
|
1143
1149
|
@explicit_unlocks.each do |name|
|
1144
1150
|
version = full_update.version_for(name)
|
1145
|
-
|
1151
|
+
resolution_base.base_requirements[name] = Gem::Requirement.new("= #{version}") if version
|
1146
1152
|
end
|
1147
|
-
|
1153
|
+
resolution_base
|
1148
1154
|
end
|
1149
1155
|
|
1150
1156
|
def dup_for_full_unlock
|
@@ -1161,25 +1167,16 @@ module Bundler
|
|
1161
1167
|
def remove_invalid_platforms!
|
1162
1168
|
return if Bundler.frozen_bundle?
|
1163
1169
|
|
1164
|
-
|
1165
|
-
next if local_platform == platform ||
|
1166
|
-
@new_platforms.include?(platform)
|
1167
|
-
|
1168
|
-
# We should probably avoid removing non-ruby platforms, since that means
|
1169
|
-
# lockfile will no longer install on those platforms, so a error to give
|
1170
|
-
# heads up to the user may be better. However, we have tests expecting
|
1171
|
-
# non ruby platform autoremoval to work, so leaving that in place for
|
1172
|
-
# now.
|
1173
|
-
next if @dependency_changes && platform != Gem::Platform::RUBY
|
1170
|
+
skips = (@new_platforms + [Bundler.local_platform]).uniq
|
1174
1171
|
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1172
|
+
# We should probably avoid removing non-ruby platforms, since that means
|
1173
|
+
# lockfile will no longer install on those platforms, so a error to give
|
1174
|
+
# heads up to the user may be better. However, we have tests expecting
|
1175
|
+
# non ruby platform autoremoval to work, so leaving that in place for
|
1176
|
+
# now.
|
1177
|
+
skips |= platforms - [Gem::Platform::RUBY] if @dependency_changes
|
1180
1178
|
|
1181
|
-
|
1182
|
-
spec_set.incomplete_for_platform?(current_dependencies, platform)
|
1179
|
+
@originally_invalid_platforms = @originally_locked_specs.remove_invalid_platforms!(current_dependencies, platforms, skips: skips)
|
1183
1180
|
end
|
1184
1181
|
|
1185
1182
|
def source_map
|
@@ -99,7 +99,7 @@ module Bundler
|
|
99
99
|
return RUBY_PLATFORM_ARRAY if force_ruby_platform
|
100
100
|
return valid_platforms if platforms.empty?
|
101
101
|
|
102
|
-
valid_platforms.select {|p| expanded_platforms.include?(
|
102
|
+
valid_platforms.select {|p| expanded_platforms.include?(Gem::Platform.generic(p)) }
|
103
103
|
end
|
104
104
|
|
105
105
|
def expanded_platforms
|
data/bundler/lib/bundler/dsl.rb
CHANGED
@@ -73,7 +73,7 @@ module Bundler
|
|
73
73
|
case specs_by_name_and_version.size
|
74
74
|
when 1
|
75
75
|
specs = specs_by_name_and_version.values.first
|
76
|
-
spec = specs.find {|s| s.
|
76
|
+
spec = specs.find {|s| s.installable_on_platform?(Bundler.local_platform) } || specs.first
|
77
77
|
|
78
78
|
@gemspecs << spec
|
79
79
|
|
@@ -240,28 +240,27 @@ module Bundler
|
|
240
240
|
dep = Dependency.new(name, version, options)
|
241
241
|
|
242
242
|
# if there's already a dependency with this name we try to prefer one
|
243
|
-
if current = @dependencies.find {|d| d.name ==
|
243
|
+
if current = @dependencies.find {|d| d.name == name }
|
244
244
|
if current.requirement != dep.requirement
|
245
245
|
current_requirement_open = current.requirements_list.include?(">= 0")
|
246
246
|
|
247
247
|
gemspec_dep = [dep, current].find(&:gemspec_dev_dep?)
|
248
248
|
if gemspec_dep
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
dep = Dependency.new(name, current.requirement.as_list + dep.requirement.as_list, options)
|
249
|
+
require_relative "vendor/pub_grub/lib/pub_grub/version_range"
|
250
|
+
require_relative "vendor/pub_grub/lib/pub_grub/version_constraint"
|
251
|
+
require_relative "vendor/pub_grub/lib/pub_grub/version_union"
|
252
|
+
require_relative "vendor/pub_grub/lib/pub_grub/rubygems"
|
253
|
+
|
254
|
+
current_gemspec_range = PubGrub::RubyGems.requirement_to_range(current.requirement)
|
255
|
+
next_gemspec_range = PubGrub::RubyGems.requirement_to_range(dep.requirement)
|
256
|
+
|
257
|
+
if current_gemspec_range.intersects?(next_gemspec_range)
|
258
|
+
dep = Dependency.new(name, current.requirement.as_list + dep.requirement.as_list, options)
|
259
|
+
else
|
260
|
+
gemfile_dep = [dep, current].find(&:gemfile_dep?)
|
261
|
+
|
262
|
+
if gemfile_dep
|
263
|
+
raise GemfileError, "The #{name} dependency has conflicting requirements in Gemfile (#{gemfile_dep.requirement}) and gemspec (#{gemspec_dep.requirement})"
|
265
264
|
else
|
266
265
|
raise GemfileError, "Two gemspec development dependencies have conflicting requirements on the same gem: #{dep} and #{current}"
|
267
266
|
end
|
@@ -273,14 +272,14 @@ module Bundler
|
|
273
272
|
if dep.requirements_list.include?(">= 0") && !current_requirement_open
|
274
273
|
update_prompt = ". Gem already added"
|
275
274
|
else
|
276
|
-
update_prompt = ". If you want to update the gem version, run `bundle update #{
|
275
|
+
update_prompt = ". If you want to update the gem version, run `bundle update #{name}`"
|
277
276
|
|
278
277
|
update_prompt += ". You may also need to change the version requirement specified in the Gemfile if it's too restrictive." unless current_requirement_open
|
279
278
|
end
|
280
279
|
end
|
281
280
|
|
282
281
|
raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
|
283
|
-
"You specified: #{
|
282
|
+
"You specified: #{name} (#{current.requirement}) and #{name} (#{dep.requirement})" \
|
284
283
|
"#{update_prompt}"
|
285
284
|
end
|
286
285
|
end
|
@@ -293,10 +292,10 @@ module Bundler
|
|
293
292
|
return
|
294
293
|
elsif current.source != dep.source
|
295
294
|
raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
|
296
|
-
"You specified that #{
|
295
|
+
"You specified that #{name} (#{dep.requirement}) should come from " \
|
297
296
|
"#{current.source || "an unspecified source"} and #{dep.source}\n"
|
298
297
|
else
|
299
|
-
Bundler.ui.warn "Your Gemfile lists the gem #{
|
298
|
+
Bundler.ui.warn "Your Gemfile lists the gem #{name} (#{current.requirement}) more than once.\n" \
|
300
299
|
"You should probably keep only one of them.\n" \
|
301
300
|
"Remove any duplicate entries and specify the gem only once.\n" \
|
302
301
|
"While it's not a problem now, it could cause errors if you change the version of one of them later."
|
@@ -412,6 +411,7 @@ module Bundler
|
|
412
411
|
next if VALID_PLATFORMS.include?(p)
|
413
412
|
raise GemfileError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}"
|
414
413
|
end
|
414
|
+
deprecate_legacy_windows_platforms(platforms)
|
415
415
|
|
416
416
|
# Save sources passed in a key
|
417
417
|
if opts.key?("source")
|
@@ -492,6 +492,16 @@ module Bundler
|
|
492
492
|
end
|
493
493
|
end
|
494
494
|
|
495
|
+
def deprecate_legacy_windows_platforms(platforms)
|
496
|
+
windows_platforms = platforms.select {|pl| pl.to_s.match?(/mingw|mswin/) }
|
497
|
+
return if windows_platforms.empty?
|
498
|
+
|
499
|
+
windows_platforms = windows_platforms.map! {|pl| ":#{pl}" }.join(", ")
|
500
|
+
message = "Platform #{windows_platforms} is deprecated. Please use platform :windows instead."
|
501
|
+
removed_message = "Platform #{windows_platforms} has been removed. Please use platform :windows instead."
|
502
|
+
Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
|
503
|
+
end
|
504
|
+
|
495
505
|
def check_path_source_safety
|
496
506
|
return if @sources.global_path_source.nil?
|
497
507
|
|
@@ -511,7 +521,7 @@ module Bundler
|
|
511
521
|
end
|
512
522
|
|
513
523
|
def multiple_global_source_warning
|
514
|
-
if Bundler.feature_flag.
|
524
|
+
if Bundler.feature_flag.bundler_4_mode?
|
515
525
|
msg = "This Gemfile contains multiple global sources. " \
|
516
526
|
"Each source after the first must include a block to indicate which gems " \
|
517
527
|
"should come from that source"
|
@@ -27,20 +27,23 @@ module Bundler
|
|
27
27
|
|
28
28
|
(1..10).each {|v| define_method("bundler_#{v}_mode?") { @major_version >= v } }
|
29
29
|
|
30
|
-
settings_flag(:allow_offline_install) {
|
31
|
-
settings_flag(:
|
32
|
-
settings_flag(:
|
33
|
-
settings_flag(:
|
34
|
-
settings_flag(:
|
35
|
-
settings_flag(:global_gem_cache) { bundler_3_mode? }
|
36
|
-
settings_flag(:lockfile_checksums) { bundler_3_mode? }
|
37
|
-
settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
|
30
|
+
settings_flag(:allow_offline_install) { bundler_4_mode? }
|
31
|
+
settings_flag(:cache_all) { bundler_4_mode? }
|
32
|
+
settings_flag(:forget_cli_options) { bundler_4_mode? }
|
33
|
+
settings_flag(:global_gem_cache) { bundler_4_mode? }
|
34
|
+
settings_flag(:lockfile_checksums) { bundler_4_mode? }
|
38
35
|
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
|
39
|
-
settings_flag(:
|
40
|
-
settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
|
41
|
-
settings_flag(:update_requires_all_flag) { bundler_4_mode? }
|
36
|
+
settings_flag(:update_requires_all_flag) { bundler_5_mode? }
|
42
37
|
|
43
|
-
settings_option(:default_cli_command) {
|
38
|
+
settings_option(:default_cli_command) { bundler_4_mode? ? :cli_help : :install }
|
39
|
+
|
40
|
+
def removed_major?(target_major_version)
|
41
|
+
@major_version > target_major_version
|
42
|
+
end
|
43
|
+
|
44
|
+
def deprecated_major?(target_major_version)
|
45
|
+
@major_version >= target_major_version
|
46
|
+
end
|
44
47
|
|
45
48
|
def initialize(bundler_version)
|
46
49
|
@bundler_version = Gem::Version.create(bundler_version)
|
@@ -3,6 +3,28 @@
|
|
3
3
|
module Bundler
|
4
4
|
class Fetcher
|
5
5
|
class Downloader
|
6
|
+
HTTP_NON_RETRYABLE_ERRORS = [
|
7
|
+
SocketError,
|
8
|
+
Errno::EADDRNOTAVAIL,
|
9
|
+
Errno::ENETDOWN,
|
10
|
+
Errno::ENETUNREACH,
|
11
|
+
Gem::Net::HTTP::Persistent::Error,
|
12
|
+
Errno::EHOSTUNREACH,
|
13
|
+
].freeze
|
14
|
+
|
15
|
+
HTTP_RETRYABLE_ERRORS = [
|
16
|
+
Gem::Timeout::Error,
|
17
|
+
EOFError,
|
18
|
+
Errno::EINVAL,
|
19
|
+
Errno::ECONNRESET,
|
20
|
+
Errno::ETIMEDOUT,
|
21
|
+
Errno::EAGAIN,
|
22
|
+
Gem::Net::HTTPBadResponse,
|
23
|
+
Gem::Net::HTTPHeaderSyntaxError,
|
24
|
+
Gem::Net::ProtocolError,
|
25
|
+
Zlib::BufError,
|
26
|
+
].freeze
|
27
|
+
|
6
28
|
attr_reader :connection
|
7
29
|
attr_reader :redirect_limit
|
8
30
|
|
@@ -67,15 +89,19 @@ module Bundler
|
|
67
89
|
connection.request(uri, req)
|
68
90
|
rescue OpenSSL::SSL::SSLError
|
69
91
|
raise CertificateFailureError.new(uri)
|
70
|
-
rescue *
|
92
|
+
rescue *HTTP_NON_RETRYABLE_ERRORS => e
|
71
93
|
Bundler.ui.trace e
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
94
|
+
|
95
|
+
host = uri.host
|
96
|
+
host_port = "#{host}:#{uri.port}"
|
97
|
+
host = host_port if filtered_uri.to_s.include?(host_port)
|
98
|
+
raise NetworkDownError, "Could not reach host #{host}. Check your network " \
|
99
|
+
"connection and try again."
|
100
|
+
rescue *HTTP_RETRYABLE_ERRORS => e
|
101
|
+
Bundler.ui.trace e
|
102
|
+
|
103
|
+
raise HTTPError, "Network error while fetching #{filtered_uri}" \
|
77
104
|
" (#{e})"
|
78
|
-
end
|
79
105
|
end
|
80
106
|
|
81
107
|
private
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require_relative "vendored_persistent"
|
4
4
|
require_relative "vendored_timeout"
|
5
|
-
require "cgi"
|
6
5
|
require_relative "vendored_securerandom"
|
7
6
|
require "zlib"
|
8
7
|
|
@@ -73,19 +72,57 @@ module Bundler
|
|
73
72
|
end
|
74
73
|
end
|
75
74
|
|
75
|
+
HTTP_ERRORS = (Downloader::HTTP_RETRYABLE_ERRORS + Downloader::HTTP_NON_RETRYABLE_ERRORS).freeze
|
76
|
+
deprecate_constant :HTTP_ERRORS
|
77
|
+
|
78
|
+
NET_ERRORS = [
|
79
|
+
:HTTPBadGateway,
|
80
|
+
:HTTPBadRequest,
|
81
|
+
:HTTPFailedDependency,
|
82
|
+
:HTTPForbidden,
|
83
|
+
:HTTPInsufficientStorage,
|
84
|
+
:HTTPMethodNotAllowed,
|
85
|
+
:HTTPMovedPermanently,
|
86
|
+
:HTTPNoContent,
|
87
|
+
:HTTPNotFound,
|
88
|
+
:HTTPNotImplemented,
|
89
|
+
:HTTPPreconditionFailed,
|
90
|
+
:HTTPRequestEntityTooLarge,
|
91
|
+
:HTTPRequestURITooLong,
|
92
|
+
:HTTPUnauthorized,
|
93
|
+
:HTTPUnprocessableEntity,
|
94
|
+
:HTTPUnsupportedMediaType,
|
95
|
+
:HTTPVersionNotSupported,
|
96
|
+
].freeze
|
97
|
+
deprecate_constant :NET_ERRORS
|
98
|
+
|
76
99
|
# Exceptions classes that should bypass retry attempts. If your password didn't work the
|
77
100
|
# first time, it's not going to the third time.
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
101
|
+
FAIL_ERRORS = [
|
102
|
+
AuthenticationRequiredError,
|
103
|
+
BadAuthenticationError,
|
104
|
+
AuthenticationForbiddenError,
|
105
|
+
FallbackError,
|
106
|
+
SecurityError,
|
107
|
+
Gem::Requirement::BadRequirementError,
|
108
|
+
Gem::Net::HTTPBadGateway,
|
109
|
+
Gem::Net::HTTPBadRequest,
|
110
|
+
Gem::Net::HTTPFailedDependency,
|
111
|
+
Gem::Net::HTTPForbidden,
|
112
|
+
Gem::Net::HTTPInsufficientStorage,
|
113
|
+
Gem::Net::HTTPMethodNotAllowed,
|
114
|
+
Gem::Net::HTTPMovedPermanently,
|
115
|
+
Gem::Net::HTTPNoContent,
|
116
|
+
Gem::Net::HTTPNotFound,
|
117
|
+
Gem::Net::HTTPNotImplemented,
|
118
|
+
Gem::Net::HTTPPreconditionFailed,
|
119
|
+
Gem::Net::HTTPRequestEntityTooLarge,
|
120
|
+
Gem::Net::HTTPRequestURITooLong,
|
121
|
+
Gem::Net::HTTPUnauthorized,
|
122
|
+
Gem::Net::HTTPUnprocessableEntity,
|
123
|
+
Gem::Net::HTTPUnsupportedMediaType,
|
124
|
+
Gem::Net::HTTPVersionNotSupported,
|
125
|
+
].freeze
|
89
126
|
|
90
127
|
class << self
|
91
128
|
attr_accessor :disable_endpoint, :api_timeout, :redirect_limit, :max_retries
|
@@ -294,13 +331,6 @@ module Bundler
|
|
294
331
|
paths.find {|path| File.file? path }
|
295
332
|
end
|
296
333
|
|
297
|
-
HTTP_ERRORS = [
|
298
|
-
Gem::Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
|
299
|
-
Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
|
300
|
-
Gem::Net::HTTPBadResponse, Gem::Net::HTTPHeaderSyntaxError, Gem::Net::ProtocolError,
|
301
|
-
Gem::Net::HTTP::Persistent::Error, Zlib::BufError, Errno::EHOSTUNREACH
|
302
|
-
].freeze
|
303
|
-
|
304
334
|
def bundler_cert_store
|
305
335
|
store = OpenSSL::X509::Store.new
|
306
336
|
ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
|
@@ -102,7 +102,8 @@ module Bundler
|
|
102
102
|
def issues_url(exception)
|
103
103
|
message = exception.message.lines.first.tr(":", " ").chomp
|
104
104
|
message = message.split("-").first if exception.is_a?(Errno)
|
105
|
-
require "cgi"
|
105
|
+
require "cgi/escape"
|
106
|
+
require "cgi/util" unless defined?(CGI::EscapeExt)
|
106
107
|
"https://github.com/rubygems/rubygems/search?q=" \
|
107
108
|
"#{CGI.escape(message)}&type=Issues"
|
108
109
|
end
|
@@ -131,6 +131,11 @@ module Bundler
|
|
131
131
|
return unless other
|
132
132
|
other.each do |spec|
|
133
133
|
if existing = find_by_spec(spec)
|
134
|
+
unless dependencies_eql?(existing, spec)
|
135
|
+
Bundler.ui.warn "Local specification for #{spec.full_name} has different dependencies than the remote gem, ignoring it"
|
136
|
+
next
|
137
|
+
end
|
138
|
+
|
134
139
|
add_duplicate(existing)
|
135
140
|
end
|
136
141
|
add spec
|
@@ -153,8 +158,8 @@ module Bundler
|
|
153
158
|
end
|
154
159
|
|
155
160
|
def dependencies_eql?(spec, other_spec)
|
156
|
-
deps = spec.
|
157
|
-
other_deps = other_spec.
|
161
|
+
deps = spec.runtime_dependencies
|
162
|
+
other_deps = other_spec.runtime_dependencies
|
158
163
|
deps.sort == other_deps.sort
|
159
164
|
end
|
160
165
|
|
@@ -91,6 +91,11 @@ module Bundler
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def generate_bundler_executable_stubs(spec, options = {})
|
94
|
+
if spec.name == "bundler"
|
95
|
+
Bundler.ui.warn "Bundler itself does not use binstubs because its version is selected by RubyGems"
|
96
|
+
return
|
97
|
+
end
|
98
|
+
|
94
99
|
if options[:binstubs_cmd] && spec.executables.empty?
|
95
100
|
options = {}
|
96
101
|
spec.runtime_dependencies.each do |dep|
|
@@ -115,10 +120,6 @@ module Bundler
|
|
115
120
|
ruby_command = Thor::Util.ruby_command
|
116
121
|
ruby_command = ruby_command
|
117
122
|
template_path = File.expand_path("templates/Executable", __dir__)
|
118
|
-
if spec.name == "bundler"
|
119
|
-
template_path += ".bundler"
|
120
|
-
spec.executables = %(bundle)
|
121
|
-
end
|
122
123
|
template = File.read(template_path)
|
123
124
|
|
124
125
|
exists = []
|