rubygems-update 3.2.12 → 3.2.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/bundler/CHANGELOG.md +10 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/gem.rb +23 -17
- data/bundler/lib/bundler/definition.rb +24 -23
- data/bundler/lib/bundler/dsl.rb +36 -22
- data/bundler/lib/bundler/inline.rb +1 -0
- data/bundler/lib/bundler/lockfile_parser.rb +12 -8
- data/bundler/lib/bundler/plugin.rb +1 -0
- data/bundler/lib/bundler/plugin/installer.rb +8 -10
- data/bundler/lib/bundler/plugin/source_list.rb +4 -0
- data/bundler/lib/bundler/resolver.rb +34 -36
- data/bundler/lib/bundler/source_list.rb +15 -18
- data/bundler/lib/bundler/templates/newgem/README.md.tt +5 -3
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems.rb +1 -1
- data/lib/rubygems/core_ext/tcpsocket_init.rb +4 -1
- data/lib/rubygems/platform.rb +7 -3
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/test_gem.rb +2 -8
- data/test/rubygems/test_gem_platform.rb +29 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 666dcbc545356912c49ba537a3964a73cf66167dae38bd44a1ef874c24939d09
|
4
|
+
data.tar.gz: 63c0da17d148277c4d34d63354fda167768b64d1349a4cb9b4175c74f918a9f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d99946c2c1d0ce009b4864fa1ab4bde104e70ba20d9b859cb5ad377e83a969d420a3abbe517c91290b788a83b8886e0e1403de15177dd0d5bd0d53583737e73
|
7
|
+
data.tar.gz: aa89692b9cdbb6c4220a6c51b3b0fdd07c2187ec1d71e83db17bd216ce26a1fc29912fff748409f44fbfff830dc998c888005c98851615369462de3a1ee5e620
|
data/CHANGELOG.md
CHANGED
data/bundler/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# 2.2.13 (March 3, 2021)
|
2
|
+
|
3
|
+
## Enhancements:
|
4
|
+
|
5
|
+
- Respect user configured default branch in README links in new generated gems [#4303](https://github.com/rubygems/rubygems/pull/4303)
|
6
|
+
|
7
|
+
## Bug fixes:
|
8
|
+
|
9
|
+
- Fix gems sometimes being pulled from irrelevant sources [#4418](https://github.com/rubygems/rubygems/pull/4418)
|
10
|
+
|
1
11
|
# 2.2.12 (March 1, 2021)
|
2
12
|
|
3
13
|
## Bug fixes:
|
@@ -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 = "2021-03-
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2021-03-03".freeze
|
8
|
+
@git_commit_sha = "9b15ab18c4".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
@@ -39,11 +39,11 @@ module Bundler
|
|
39
39
|
constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
|
40
40
|
constant_array = constant_name.split("::")
|
41
41
|
|
42
|
-
|
42
|
+
use_git = Bundler.git_present? && options[:git]
|
43
43
|
|
44
|
-
git_author_name =
|
45
|
-
github_username =
|
46
|
-
git_user_email =
|
44
|
+
git_author_name = use_git ? `git config user.name`.chomp : ""
|
45
|
+
github_username = use_git ? `git config github.user`.chomp : ""
|
46
|
+
git_user_email = use_git ? `git config user.email`.chomp : ""
|
47
47
|
|
48
48
|
config = {
|
49
49
|
:name => name,
|
@@ -58,6 +58,7 @@ module Bundler
|
|
58
58
|
:ext => options[:ext],
|
59
59
|
:exe => options[:exe],
|
60
60
|
:bundler_version => bundler_dependency_version,
|
61
|
+
:git => use_git,
|
61
62
|
:github_username => github_username.empty? ? "[USERNAME]" : github_username,
|
62
63
|
:required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
|
63
64
|
}
|
@@ -79,7 +80,7 @@ module Bundler
|
|
79
80
|
bin/setup
|
80
81
|
]
|
81
82
|
|
82
|
-
templates.merge!("gitignore.tt" => ".gitignore") if
|
83
|
+
templates.merge!("gitignore.tt" => ".gitignore") if use_git
|
83
84
|
|
84
85
|
if test_framework = ask_and_set_test_framework
|
85
86
|
config[:test] = test_framework
|
@@ -175,24 +176,31 @@ module Bundler
|
|
175
176
|
)
|
176
177
|
end
|
177
178
|
|
179
|
+
if File.exist?(target) && !File.directory?(target)
|
180
|
+
Bundler.ui.error "Couldn't create a new gem named `#{gem_name}` because there's an existing file named `#{gem_name}`."
|
181
|
+
exit Bundler::BundlerError.all_errors[Bundler::GenericSystemCallError]
|
182
|
+
end
|
183
|
+
|
184
|
+
if use_git
|
185
|
+
Bundler.ui.info "Initializing git repo in #{target}"
|
186
|
+
`git init #{target}`
|
187
|
+
|
188
|
+
config[:git_default_branch] = File.read("#{target}/.git/HEAD").split("/").last.chomp
|
189
|
+
end
|
190
|
+
|
178
191
|
templates.each do |src, dst|
|
179
192
|
destination = target.join(dst)
|
180
|
-
|
181
|
-
thor.template("newgem/#{src}", destination, config)
|
182
|
-
end
|
193
|
+
thor.template("newgem/#{src}", destination, config)
|
183
194
|
end
|
184
195
|
|
185
196
|
executables.each do |file|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
end
|
197
|
+
path = target.join(file)
|
198
|
+
executable = (path.stat.mode | 0o111)
|
199
|
+
path.chmod(executable)
|
190
200
|
end
|
191
201
|
|
192
|
-
if
|
193
|
-
Bundler.ui.info "Initializing git repo in #{target}"
|
202
|
+
if use_git
|
194
203
|
Dir.chdir(target) do
|
195
|
-
`git init`
|
196
204
|
`git add .`
|
197
205
|
end
|
198
206
|
end
|
@@ -202,8 +210,6 @@ module Bundler
|
|
202
210
|
|
203
211
|
Bundler.ui.info "Gem '#{name}' was successfully created. " \
|
204
212
|
"For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
|
205
|
-
rescue Errno::EEXIST => e
|
206
|
-
raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
|
207
213
|
end
|
208
214
|
|
209
215
|
private
|
@@ -264,7 +264,7 @@ module Bundler
|
|
264
264
|
# Run a resolve against the locally available gems
|
265
265
|
Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
|
266
266
|
expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
|
267
|
-
Resolver.resolve(expanded_dependencies,
|
267
|
+
Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
|
268
268
|
end
|
269
269
|
end
|
270
270
|
end
|
@@ -656,19 +656,20 @@ module Bundler
|
|
656
656
|
def converge_rubygems_sources
|
657
657
|
return false if Bundler.feature_flag.disable_multisource?
|
658
658
|
|
659
|
-
changes = false
|
660
|
-
|
661
659
|
# Get the RubyGems sources from the Gemfile.lock
|
662
660
|
locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
|
661
|
+
return false if locked_gem_sources.empty?
|
662
|
+
|
663
663
|
# Get the RubyGems remotes from the Gemfile
|
664
664
|
actual_remotes = sources.rubygems_remotes
|
665
|
+
return false if actual_remotes.empty?
|
666
|
+
|
667
|
+
changes = false
|
665
668
|
|
666
669
|
# If there is a RubyGems source in both
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
|
671
|
-
end
|
670
|
+
locked_gem_sources.each do |locked_gem|
|
671
|
+
# Merge the remotes from the Gemfile into the Gemfile.lock
|
672
|
+
changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
|
672
673
|
end
|
673
674
|
|
674
675
|
changes
|
@@ -893,30 +894,18 @@ module Bundler
|
|
893
894
|
# Record the specs available in each gem's source, so that those
|
894
895
|
# specs will be available later when the resolver knows where to
|
895
896
|
# look for that gemspec (or its dependencies)
|
896
|
-
|
897
|
-
source_requirements = { :default => default }
|
898
|
-
default = nil unless Bundler.feature_flag.disable_multisource?
|
899
|
-
dependencies.each do |dep|
|
900
|
-
next unless source = dep.source || default
|
901
|
-
source_requirements[dep.name] = source
|
902
|
-
end
|
897
|
+
source_requirements = { :default => sources.default_source }.merge(dependency_source_requirements)
|
903
898
|
metadata_dependencies.each do |dep|
|
904
899
|
source_requirements[dep.name] = sources.metadata_source
|
905
900
|
end
|
901
|
+
source_requirements[:global] = index unless Bundler.feature_flag.disable_multisource?
|
906
902
|
source_requirements[:default_bundler] = source_requirements["bundler"] || source_requirements[:default]
|
907
903
|
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
908
904
|
source_requirements
|
909
905
|
end
|
910
906
|
|
911
907
|
def pinned_spec_names(skip = nil)
|
912
|
-
|
913
|
-
default = Bundler.feature_flag.disable_multisource? && sources.default_source
|
914
|
-
@dependencies.each do |dep|
|
915
|
-
next unless dep_source = dep.source || default
|
916
|
-
next if dep_source == skip
|
917
|
-
pinned_names << dep.name
|
918
|
-
end
|
919
|
-
pinned_names
|
908
|
+
dependency_source_requirements.reject {|_, source| source == skip }.keys
|
920
909
|
end
|
921
910
|
|
922
911
|
def requested_groups
|
@@ -973,5 +962,17 @@ module Bundler
|
|
973
962
|
|
974
963
|
Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes)
|
975
964
|
end
|
965
|
+
|
966
|
+
def dependency_source_requirements
|
967
|
+
@dependency_source_requirements ||= begin
|
968
|
+
source_requirements = {}
|
969
|
+
default = sources.default_source
|
970
|
+
dependencies.each do |dep|
|
971
|
+
dep_source = dep.source || default
|
972
|
+
source_requirements[dep.name] = dep_source
|
973
|
+
end
|
974
|
+
source_requirements
|
975
|
+
end
|
976
|
+
end
|
976
977
|
end
|
977
978
|
end
|
data/bundler/lib/bundler/dsl.rb
CHANGED
@@ -24,6 +24,9 @@ module Bundler
|
|
24
24
|
def initialize
|
25
25
|
@source = nil
|
26
26
|
@sources = SourceList.new
|
27
|
+
|
28
|
+
@global_rubygems_sources = []
|
29
|
+
|
27
30
|
@git_sources = {}
|
28
31
|
@dependencies = []
|
29
32
|
@groups = []
|
@@ -45,6 +48,7 @@ module Bundler
|
|
45
48
|
@gemfiles << expanded_gemfile_path
|
46
49
|
contents ||= Bundler.read_file(@gemfile.to_s)
|
47
50
|
instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
|
51
|
+
check_primary_source_safety
|
48
52
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
49
53
|
message = "There was an error " \
|
50
54
|
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
|
@@ -164,8 +168,7 @@ module Bundler
|
|
164
168
|
elsif block_given?
|
165
169
|
with_source(@sources.add_rubygems_source("remotes" => source), &blk)
|
166
170
|
else
|
167
|
-
|
168
|
-
@sources.global_rubygems_source = source
|
171
|
+
@global_rubygems_sources << source
|
169
172
|
end
|
170
173
|
end
|
171
174
|
|
@@ -183,24 +186,14 @@ module Bundler
|
|
183
186
|
end
|
184
187
|
|
185
188
|
def path(path, options = {}, &blk)
|
186
|
-
unless block_given?
|
187
|
-
msg = "You can no longer specify a path source by itself. Instead, \n" \
|
188
|
-
"either use the :path option on a gem, or specify the gems that \n" \
|
189
|
-
"bundler should find in the path source by passing a block to \n" \
|
190
|
-
"the path method, like: \n\n" \
|
191
|
-
" path 'dir/containing/rails' do\n" \
|
192
|
-
" gem 'rails'\n" \
|
193
|
-
" end\n\n"
|
194
|
-
|
195
|
-
raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource?
|
196
|
-
SharedHelpers.major_deprecation(2, msg.strip)
|
197
|
-
end
|
198
|
-
|
199
189
|
source_options = normalize_hash(options).merge(
|
200
190
|
"path" => Pathname.new(path),
|
201
191
|
"root_path" => gemfile_root,
|
202
192
|
"gemspec" => gemspecs.find {|g| g.name == options["name"] }
|
203
193
|
)
|
194
|
+
|
195
|
+
source_options["global"] = true unless block_given?
|
196
|
+
|
204
197
|
source = @sources.add_path_source(source_options)
|
205
198
|
with_source(source, &blk)
|
206
199
|
end
|
@@ -279,6 +272,11 @@ module Bundler
|
|
279
272
|
raise GemfileError, "Undefined local variable or method `#{name}' for Gemfile"
|
280
273
|
end
|
281
274
|
|
275
|
+
def check_primary_source_safety
|
276
|
+
check_path_source_safety
|
277
|
+
check_rubygems_source_safety
|
278
|
+
end
|
279
|
+
|
282
280
|
private
|
283
281
|
|
284
282
|
def add_git_sources
|
@@ -440,17 +438,33 @@ repo_name ||= user_name
|
|
440
438
|
end
|
441
439
|
end
|
442
440
|
|
443
|
-
def
|
444
|
-
return if
|
441
|
+
def check_path_source_safety
|
442
|
+
return if @sources.global_path_source.nil?
|
443
|
+
|
444
|
+
msg = "You can no longer specify a path source by itself. Instead, \n" \
|
445
|
+
"either use the :path option on a gem, or specify the gems that \n" \
|
446
|
+
"bundler should find in the path source by passing a block to \n" \
|
447
|
+
"the path method, like: \n\n" \
|
448
|
+
" path 'dir/containing/rails' do\n" \
|
449
|
+
" gem 'rails'\n" \
|
450
|
+
" end\n\n"
|
451
|
+
|
452
|
+
SharedHelpers.major_deprecation(2, msg.strip)
|
453
|
+
end
|
454
|
+
|
455
|
+
def check_rubygems_source_safety
|
456
|
+
@sources.global_rubygems_source = @global_rubygems_sources.shift
|
457
|
+
return if @global_rubygems_sources.empty?
|
458
|
+
|
459
|
+
@global_rubygems_sources.each do |source|
|
460
|
+
@sources.add_rubygems_remote(source)
|
461
|
+
end
|
445
462
|
|
446
463
|
if Bundler.feature_flag.disable_multisource?
|
447
464
|
msg = "This Gemfile contains multiple primary sources. " \
|
448
465
|
"Each source after the first must include a block to indicate which gems " \
|
449
|
-
"should come from that source"
|
450
|
-
|
451
|
-
msg += ". To downgrade this error to a warning, run " \
|
452
|
-
"`bundle config unset disable_multisource`"
|
453
|
-
end
|
466
|
+
"should come from that source. To downgrade this error to a warning, run " \
|
467
|
+
"`bundle config unset disable_multisource`"
|
454
468
|
raise GemfileEvalError, msg
|
455
469
|
else
|
456
470
|
Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
|
@@ -50,6 +50,7 @@ def gemfile(install = false, options = {}, &gemfile)
|
|
50
50
|
Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
|
51
51
|
builder = Bundler::Dsl.new
|
52
52
|
builder.instance_eval(&gemfile)
|
53
|
+
builder.check_primary_source_safety
|
53
54
|
|
54
55
|
Bundler.settings.temporary(:frozen => false) do
|
55
56
|
definition = builder.to_definition(nil, true)
|
@@ -64,8 +64,6 @@ module Bundler
|
|
64
64
|
@state = nil
|
65
65
|
@specs = {}
|
66
66
|
|
67
|
-
@rubygems_aggregate = Source::Rubygems.new
|
68
|
-
|
69
67
|
if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
|
70
68
|
raise LockfileError, "Your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} contains merge conflicts.\n" \
|
71
69
|
"Run `git checkout HEAD -- #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` first to get a clean lock."
|
@@ -89,7 +87,6 @@ module Bundler
|
|
89
87
|
send("parse_#{@state}", line)
|
90
88
|
end
|
91
89
|
end
|
92
|
-
@sources << @rubygems_aggregate unless Bundler.feature_flag.disable_multisource?
|
93
90
|
@specs = @specs.values.sort_by(&:identifier)
|
94
91
|
warn_for_outdated_bundler_version
|
95
92
|
rescue ArgumentError => e
|
@@ -134,16 +131,19 @@ module Bundler
|
|
134
131
|
@sources << @current_source
|
135
132
|
end
|
136
133
|
when GEM
|
137
|
-
|
134
|
+
source_remotes = Array(@opts["remote"])
|
135
|
+
|
136
|
+
if source_remotes.size == 1
|
138
137
|
@opts["remotes"] = @opts.delete("remote")
|
139
138
|
@current_source = TYPES[@type].from_lock(@opts)
|
140
|
-
@sources << @current_source
|
141
139
|
else
|
142
|
-
|
143
|
-
|
140
|
+
source_remotes.each do |url|
|
141
|
+
rubygems_aggregate.add_remote(url)
|
144
142
|
end
|
145
|
-
@current_source =
|
143
|
+
@current_source = rubygems_aggregate
|
146
144
|
end
|
145
|
+
|
146
|
+
@sources << @current_source
|
147
147
|
when PLUGIN
|
148
148
|
@current_source = Plugin.source_from_lock(@opts)
|
149
149
|
@sources << @current_source
|
@@ -245,5 +245,9 @@ module Bundler
|
|
245
245
|
def parse_ruby(line)
|
246
246
|
@ruby_version = line.strip
|
247
247
|
end
|
248
|
+
|
249
|
+
def rubygems_aggregate
|
250
|
+
@rubygems_aggregate ||= Source::Rubygems.new
|
251
|
+
end
|
248
252
|
end
|
249
253
|
end
|
@@ -16,15 +16,13 @@ module Bundler
|
|
16
16
|
|
17
17
|
version = options[:version] || [">= 0"]
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
install_rubygems(names, version, sources)
|
27
|
-
end
|
19
|
+
if options[:git]
|
20
|
+
install_git(names, version, options)
|
21
|
+
elsif options[:local_git]
|
22
|
+
install_local_git(names, version, options)
|
23
|
+
else
|
24
|
+
sources = options[:source] || Bundler.rubygems.sources
|
25
|
+
install_rubygems(names, version, sources)
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
@@ -79,7 +77,7 @@ module Bundler
|
|
79
77
|
source_list = SourceList.new
|
80
78
|
|
81
79
|
source_list.add_git_source(git_source_options) if git_source_options
|
82
|
-
source_list.
|
80
|
+
source_list.global_rubygems_source = rubygems_source if rubygems_source
|
83
81
|
|
84
82
|
deps = names.map {|name| Dependency.new name, version }
|
85
83
|
|
@@ -17,16 +17,21 @@ module Bundler
|
|
17
17
|
# ==== Returns
|
18
18
|
# <GemBundle>,nil:: If the list of dependencies can be resolved, a
|
19
19
|
# collection of gemspecs is returned. Otherwise, nil is returned.
|
20
|
-
def self.resolve(requirements,
|
20
|
+
def self.resolve(requirements, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
|
21
21
|
base = SpecSet.new(base) unless base.is_a?(SpecSet)
|
22
|
-
resolver = new(
|
22
|
+
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
23
23
|
result = resolver.start(requirements)
|
24
24
|
SpecSet.new(result)
|
25
25
|
end
|
26
26
|
|
27
|
-
def initialize(
|
28
|
-
@index = index
|
27
|
+
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
29
28
|
@source_requirements = source_requirements
|
29
|
+
|
30
|
+
@index_requirements = source_requirements.each_with_object({}) do |source_requirement, index_requirements|
|
31
|
+
name, source = source_requirement
|
32
|
+
index_requirements[name] = name == :global ? source : source.specs
|
33
|
+
end
|
34
|
+
|
30
35
|
@base = base
|
31
36
|
@resolver = Molinillo::Resolver.new(self, self)
|
32
37
|
@search_for = {}
|
@@ -40,7 +45,7 @@ module Bundler
|
|
40
45
|
@resolving_only_for_ruby = platforms == [Gem::Platform::RUBY]
|
41
46
|
@gem_version_promoter = gem_version_promoter
|
42
47
|
@use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
|
43
|
-
@
|
48
|
+
@no_aggregate_global_source = @source_requirements[:global].nil?
|
44
49
|
|
45
50
|
@variant_specific_names = []
|
46
51
|
@generic_names = ["Ruby\0", "RubyGems\0"]
|
@@ -125,8 +130,7 @@ module Bundler
|
|
125
130
|
dependency = dependency_proxy.dep
|
126
131
|
name = dependency.name
|
127
132
|
search_result = @search_for[dependency_proxy] ||= begin
|
128
|
-
|
129
|
-
results = index.search(dependency, @base[name])
|
133
|
+
results = results_for(dependency, @base[name])
|
130
134
|
|
131
135
|
if vertex = @base_dg.vertex_named(name)
|
132
136
|
locked_requirement = vertex.payload.requirement
|
@@ -196,22 +200,22 @@ module Bundler
|
|
196
200
|
end
|
197
201
|
|
198
202
|
def index_for(dependency)
|
199
|
-
source = @
|
203
|
+
source = @index_requirements[dependency.name]
|
200
204
|
if source
|
201
|
-
source
|
202
|
-
elsif @
|
205
|
+
source
|
206
|
+
elsif @no_aggregate_global_source
|
203
207
|
Index.build do |idx|
|
204
|
-
|
205
|
-
dependency.all_sources.each {|s| idx.add_source(s.specs) if s }
|
206
|
-
else
|
207
|
-
idx.add_source @source_requirements[:default].specs
|
208
|
-
end
|
208
|
+
dependency.all_sources.each {|s| idx.add_source(s.specs) }
|
209
209
|
end
|
210
210
|
else
|
211
|
-
@
|
211
|
+
@index_requirements[:global]
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
215
|
+
def results_for(dependency, base)
|
216
|
+
index_for(dependency).search(dependency, base)
|
217
|
+
end
|
218
|
+
|
215
219
|
def name_for(dependency)
|
216
220
|
dependency.name
|
217
221
|
end
|
@@ -239,18 +243,20 @@ module Bundler
|
|
239
243
|
def relevant_sources_for_vertex(vertex)
|
240
244
|
if vertex.root?
|
241
245
|
[@source_requirements[vertex.name]]
|
242
|
-
elsif @
|
246
|
+
elsif @no_aggregate_global_source
|
243
247
|
vertex.recursive_predecessors.map do |v|
|
244
248
|
@source_requirements[v.name]
|
245
|
-
end << @source_requirements[:default]
|
249
|
+
end.compact << @source_requirements[:default]
|
250
|
+
else
|
251
|
+
[]
|
246
252
|
end
|
247
253
|
end
|
248
254
|
|
249
255
|
def sort_dependencies(dependencies, activated, conflicts)
|
250
256
|
dependencies.sort_by do |dependency|
|
251
|
-
dependency.all_sources = relevant_sources_for_vertex(activated.vertex_named(dependency.name))
|
252
257
|
name = name_for(dependency)
|
253
258
|
vertex = activated.vertex_named(name)
|
259
|
+
dependency.all_sources = relevant_sources_for_vertex(vertex)
|
254
260
|
[
|
255
261
|
@base_dg.vertex_named(name) ? 0 : 1,
|
256
262
|
vertex.payload ? 0 : 1,
|
@@ -317,7 +323,7 @@ module Bundler
|
|
317
323
|
"If you are updating multiple gems in your Gemfile at once,\n" \
|
318
324
|
"try passing them all to `bundle update`"
|
319
325
|
elsif source = @source_requirements[name]
|
320
|
-
specs = source.specs
|
326
|
+
specs = source.specs.search(name)
|
321
327
|
versions_with_platforms = specs.map {|s| [s.version, s.platform] }
|
322
328
|
message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
|
323
329
|
message << if versions_with_platforms.any?
|
@@ -326,7 +332,7 @@ module Bundler
|
|
326
332
|
"The source does not contain any versions of '#{name}'"
|
327
333
|
end
|
328
334
|
else
|
329
|
-
message = "Could not find gem '#{requirement}' in any of the gem sources " \
|
335
|
+
message = "Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in any of the gem sources " \
|
330
336
|
"listed in your Gemfile#{cache_message}."
|
331
337
|
end
|
332
338
|
raise GemNotFound, message
|
@@ -392,7 +398,7 @@ module Bundler
|
|
392
398
|
if other_bundler_required
|
393
399
|
o << "\n\n"
|
394
400
|
|
395
|
-
candidate_specs = @
|
401
|
+
candidate_specs = @index_requirements[:default_bundler].search(conflict_dependency)
|
396
402
|
if candidate_specs.any?
|
397
403
|
target_version = candidate_specs.last.version
|
398
404
|
new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
|
@@ -411,14 +417,8 @@ module Bundler
|
|
411
417
|
|
412
418
|
relevant_sources = if conflict.requirement.source
|
413
419
|
[conflict.requirement.source]
|
414
|
-
elsif conflict.requirement.all_sources
|
415
|
-
conflict.requirement.all_sources
|
416
|
-
elsif @lockfile_uses_separate_rubygems_sources
|
417
|
-
# every conflict should have an explicit group of sources when we
|
418
|
-
# enforce strict pinning
|
419
|
-
raise "no source set for #{conflict}"
|
420
420
|
else
|
421
|
-
|
421
|
+
conflict.requirement.all_sources
|
422
422
|
end.compact.map(&:to_s).uniq.sort
|
423
423
|
|
424
424
|
metadata_requirement = name.end_with?("\0")
|
@@ -455,23 +455,21 @@ module Bundler
|
|
455
455
|
def validate_resolved_specs!(resolved_specs)
|
456
456
|
resolved_specs.each do |v|
|
457
457
|
name = v.name
|
458
|
-
|
459
|
-
sources.
|
458
|
+
sources = relevant_sources_for_vertex(v)
|
459
|
+
next unless sources.any?
|
460
460
|
if default_index = sources.index(@source_requirements[:default])
|
461
461
|
sources.delete_at(default_index)
|
462
462
|
end
|
463
|
-
sources.reject! {|s| s.specs
|
463
|
+
sources.reject! {|s| s.specs.search(name).empty? }
|
464
464
|
sources.uniq!
|
465
465
|
next if sources.size <= 1
|
466
466
|
|
467
|
-
multisource_disabled = Bundler.feature_flag.disable_multisource?
|
468
|
-
|
469
467
|
msg = ["The gem '#{name}' was found in multiple relevant sources."]
|
470
468
|
msg.concat sources.map {|s| " * #{s}" }.sort
|
471
|
-
msg << "You #{
|
469
|
+
msg << "You #{@no_aggregate_global_source ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
|
472
470
|
msg = msg.join("\n")
|
473
471
|
|
474
|
-
raise SecurityError, msg if
|
472
|
+
raise SecurityError, msg if @no_aggregate_global_source
|
475
473
|
Bundler.ui.warn "Warning: #{msg}"
|
476
474
|
end
|
477
475
|
end
|
@@ -5,15 +5,19 @@ module Bundler
|
|
5
5
|
attr_reader :path_sources,
|
6
6
|
:git_sources,
|
7
7
|
:plugin_sources,
|
8
|
-
:
|
8
|
+
:global_path_source,
|
9
9
|
:metadata_source
|
10
10
|
|
11
|
+
def global_rubygems_source
|
12
|
+
@global_rubygems_source ||= rubygems_aggregate_class.new
|
13
|
+
end
|
14
|
+
|
11
15
|
def initialize
|
12
16
|
@path_sources = []
|
13
17
|
@git_sources = []
|
14
18
|
@plugin_sources = []
|
15
19
|
@global_rubygems_source = nil
|
16
|
-
@
|
20
|
+
@global_path_source = nil
|
17
21
|
@rubygems_sources = []
|
18
22
|
@metadata_source = Source::Metadata.new
|
19
23
|
end
|
@@ -22,7 +26,9 @@ module Bundler
|
|
22
26
|
if options["gemspec"]
|
23
27
|
add_source_to_list Source::Gemspec.new(options), path_sources
|
24
28
|
else
|
25
|
-
add_source_to_list Source::Path.new(options), path_sources
|
29
|
+
path_source = add_source_to_list Source::Path.new(options), path_sources
|
30
|
+
@global_path_source ||= path_source if options["global"]
|
31
|
+
path_source
|
26
32
|
end
|
27
33
|
end
|
28
34
|
|
@@ -41,24 +47,20 @@ module Bundler
|
|
41
47
|
end
|
42
48
|
|
43
49
|
def global_rubygems_source=(uri)
|
44
|
-
|
45
|
-
@global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
|
46
|
-
end
|
47
|
-
add_rubygems_remote(uri)
|
50
|
+
@global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
|
48
51
|
end
|
49
52
|
|
50
53
|
def add_rubygems_remote(uri)
|
51
|
-
|
52
|
-
|
53
|
-
@rubygems_aggregate
|
54
|
+
global_rubygems_source.add_remote(uri)
|
55
|
+
global_rubygems_source
|
54
56
|
end
|
55
57
|
|
56
58
|
def default_source
|
57
|
-
|
59
|
+
global_path_source || global_rubygems_source
|
58
60
|
end
|
59
61
|
|
60
62
|
def rubygems_sources
|
61
|
-
@rubygems_sources + [
|
63
|
+
@rubygems_sources + [global_rubygems_source]
|
62
64
|
end
|
63
65
|
|
64
66
|
def rubygems_remotes
|
@@ -94,10 +96,9 @@ module Bundler
|
|
94
96
|
|
95
97
|
replacement_rubygems = !Bundler.feature_flag.disable_multisource? &&
|
96
98
|
replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
|
97
|
-
@
|
99
|
+
@global_rubygems_source = replacement_rubygems if replacement_rubygems
|
98
100
|
|
99
101
|
return true if !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
|
100
|
-
return true if replacement_rubygems && rubygems_remotes.sort_by(&:to_s) != replacement_rubygems.remotes.sort_by(&:to_s)
|
101
102
|
|
102
103
|
false
|
103
104
|
end
|
@@ -110,10 +111,6 @@ module Bundler
|
|
110
111
|
all_sources.each(&:remote!)
|
111
112
|
end
|
112
113
|
|
113
|
-
def rubygems_primary_remotes
|
114
|
-
@rubygems_aggregate.remotes
|
115
|
-
end
|
116
|
-
|
117
114
|
private
|
118
115
|
|
119
116
|
def rubygems_aggregate_class
|
@@ -29,19 +29,21 @@ TODO: Write usage instructions here
|
|
29
29
|
After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
|
30
30
|
|
31
31
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
<% if config[:git] -%>
|
32
33
|
|
33
34
|
## Contributing
|
34
35
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).<% end %>
|
37
|
+
<% end -%>
|
36
38
|
<% if config[:mit] -%>
|
37
39
|
|
38
40
|
## License
|
39
41
|
|
40
42
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
43
|
<% end -%>
|
42
|
-
<% if config[:coc] -%>
|
44
|
+
<% if config[:git] && config[:coc] -%>
|
43
45
|
|
44
46
|
## Code of Conduct
|
45
47
|
|
46
|
-
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob
|
48
|
+
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).
|
47
49
|
<% end -%>
|
data/lib/rubygems.rb
CHANGED
@@ -13,12 +13,13 @@ module CoreExtensions
|
|
13
13
|
def initialize(host, serv, *rest)
|
14
14
|
mutex = Mutex.new
|
15
15
|
addrs = []
|
16
|
+
threads = []
|
16
17
|
cond_var = ConditionVariable.new
|
17
18
|
|
18
19
|
Addrinfo.foreach(host, serv, nil, :STREAM) do |addr|
|
19
20
|
Thread.report_on_exception = false if defined? Thread.report_on_exception = ()
|
20
21
|
|
21
|
-
Thread.new(addr) do
|
22
|
+
threads << Thread.new(addr) do
|
22
23
|
# give head start to ipv6 addresses
|
23
24
|
sleep IPV4_DELAY_SECONDS if addr.ipv4?
|
24
25
|
|
@@ -40,6 +41,8 @@ module CoreExtensions
|
|
40
41
|
host = addrs.shift unless addrs.empty?
|
41
42
|
end
|
42
43
|
|
44
|
+
threads.each {|t| t.kill.join if t.alive? }
|
45
|
+
|
43
46
|
super(host, serv, *rest)
|
44
47
|
end
|
45
48
|
end
|
data/lib/rubygems/platform.rb
CHANGED
@@ -66,7 +66,7 @@ class Gem::Platform
|
|
66
66
|
when String then
|
67
67
|
arch = arch.split '-'
|
68
68
|
|
69
|
-
if arch.length > 2 and arch.last !~ /\d
|
69
|
+
if arch.length > 2 and arch.last !~ /\d+(\.\d+)?$/ # reassemble x86-linux-{libc}
|
70
70
|
extra = arch.pop
|
71
71
|
arch.last << "-#{extra}"
|
72
72
|
end
|
@@ -146,7 +146,8 @@ class Gem::Platform
|
|
146
146
|
##
|
147
147
|
# Does +other+ match this platform? Two platforms match if they have the
|
148
148
|
# same CPU, or either has a CPU of 'universal', they have the same OS, and
|
149
|
-
# they have the same version, or either has no version
|
149
|
+
# they have the same version, or either has no version (except for 'linux'
|
150
|
+
# where the version is the libc name, with no version standing for 'gnu')
|
150
151
|
#
|
151
152
|
# Additionally, the platform will match if the local CPU is 'arm' and the
|
152
153
|
# other CPU starts with "arm" (for generic ARM family support).
|
@@ -162,7 +163,10 @@ class Gem::Platform
|
|
162
163
|
@os == other.os and
|
163
164
|
|
164
165
|
# version
|
165
|
-
(
|
166
|
+
(
|
167
|
+
(@os != 'linux' and (@version.nil? or other.version.nil?)) or
|
168
|
+
@version == other.version
|
169
|
+
)
|
166
170
|
end
|
167
171
|
|
168
172
|
##
|
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.2.
|
5
|
+
s.version = "3.2.13"
|
6
6
|
s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
|
7
7
|
s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
|
8
8
|
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -1958,15 +1958,9 @@ class TestGem < Gem::TestCase
|
|
1958
1958
|
io.write 'gem "a"'
|
1959
1959
|
end
|
1960
1960
|
|
1961
|
-
platform = Bundler::GemHelpers.generic_local_platform
|
1962
|
-
if platform == Gem::Platform::RUBY
|
1963
|
-
platform = ''
|
1964
|
-
else
|
1965
|
-
platform = " #{platform}"
|
1966
|
-
end
|
1967
|
-
|
1968
1961
|
expected = <<-EXPECTED
|
1969
|
-
Could not find gem 'a
|
1962
|
+
Could not find gem 'a' in locally installed gems.
|
1963
|
+
The source does not contain any versions of 'a'
|
1970
1964
|
You may need to `gem install -g` to install missing gems
|
1971
1965
|
|
1972
1966
|
EXPECTED
|
@@ -134,7 +134,9 @@ class TestGemPlatform < Gem::TestCase
|
|
134
134
|
'i386-solaris2.8' => ['x86', 'solaris', '2.8'],
|
135
135
|
'mswin32' => ['x86', 'mswin32', nil],
|
136
136
|
'x86_64-linux' => ['x86_64', 'linux', nil],
|
137
|
+
'x86_64-linux-gnu' => ['x86_64', 'linux', nil],
|
137
138
|
'x86_64-linux-musl' => ['x86_64', 'linux', 'musl'],
|
139
|
+
'x86_64-linux-uclibc' => ['x86_64', 'linux', 'uclibc'],
|
138
140
|
'x86_64-openbsd3.9' => ['x86_64', 'openbsd', '3.9'],
|
139
141
|
'x86_64-openbsd4.0' => ['x86_64', 'openbsd', '4.0'],
|
140
142
|
'x86_64-openbsd' => ['x86_64', 'openbsd', nil],
|
@@ -143,6 +145,7 @@ class TestGemPlatform < Gem::TestCase
|
|
143
145
|
test_cases.each do |arch, expected|
|
144
146
|
platform = Gem::Platform.new arch
|
145
147
|
assert_equal expected, platform.to_a, arch.inspect
|
148
|
+
assert_equal expected, Gem::Platform.new(platform.to_s).to_a, arch.inspect
|
146
149
|
end
|
147
150
|
end
|
148
151
|
|
@@ -261,6 +264,32 @@ class TestGemPlatform < Gem::TestCase
|
|
261
264
|
assert((with_x86_arch === with_nil_arch), 'x86 =~ nil')
|
262
265
|
end
|
263
266
|
|
267
|
+
def test_nil_version_is_treated_as_any_version
|
268
|
+
x86_darwin_8 = Gem::Platform.new 'i686-darwin8.0'
|
269
|
+
x86_darwin_nil = Gem::Platform.new 'i686-darwin'
|
270
|
+
|
271
|
+
assert((x86_darwin_8 === x86_darwin_nil), '8.0 =~ nil')
|
272
|
+
assert((x86_darwin_nil === x86_darwin_8), 'nil =~ 8.0')
|
273
|
+
end
|
274
|
+
|
275
|
+
def test_nil_version_is_stricter_for_linux_os
|
276
|
+
x86_linux = Gem::Platform.new 'i686-linux'
|
277
|
+
x86_linux_gnu = Gem::Platform.new 'i686-linux-gnu'
|
278
|
+
x86_linux_musl = Gem::Platform.new 'i686-linux-musl'
|
279
|
+
x86_linux_uclibc = Gem::Platform.new 'i686-linux-uclibc'
|
280
|
+
|
281
|
+
assert((x86_linux === x86_linux_gnu), 'linux =~ linux-gnu')
|
282
|
+
assert((x86_linux_gnu === x86_linux), 'linux-gnu =~ linux')
|
283
|
+
assert(!(x86_linux_gnu === x86_linux_musl), 'linux-gnu =~ linux-musl')
|
284
|
+
assert(!(x86_linux_musl === x86_linux_gnu), 'linux-musl =~ linux-gnu')
|
285
|
+
assert(!(x86_linux_uclibc === x86_linux_musl), 'linux-uclibc =~ linux-musl')
|
286
|
+
assert(!(x86_linux_musl === x86_linux_uclibc), 'linux-musl =~ linux-uclibc')
|
287
|
+
assert(!(x86_linux === x86_linux_musl), 'linux =~ linux-musl')
|
288
|
+
assert(!(x86_linux_musl === x86_linux), 'linux-musl =~ linux')
|
289
|
+
assert(!(x86_linux === x86_linux_uclibc), 'linux =~ linux-uclibc')
|
290
|
+
assert(!(x86_linux_uclibc === x86_linux), 'linux-uclibc =~ linux')
|
291
|
+
end
|
292
|
+
|
264
293
|
def test_equals3_cpu_arm
|
265
294
|
arm = Gem::Platform.new 'arm-linux'
|
266
295
|
armv5 = Gem::Platform.new 'armv5-linux'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubygems-update
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Weirich
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date: 2021-03-
|
19
|
+
date: 2021-03-03 00:00:00.000000000 Z
|
20
20
|
dependencies: []
|
21
21
|
description: |-
|
22
22
|
A package (also known as a library) contains a set of functionality
|
@@ -768,7 +768,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
768
768
|
- !ruby/object:Gem::Version
|
769
769
|
version: '0'
|
770
770
|
requirements: []
|
771
|
-
rubygems_version: 3.2.
|
771
|
+
rubygems_version: 3.2.13
|
772
772
|
signing_key:
|
773
773
|
specification_version: 4
|
774
774
|
summary: RubyGems is a package management framework for Ruby.
|