summaryrefslogtreecommitdiff
path: root/lib/bundler/spec_set.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-03-23 12:31:15 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-04-06 13:07:16 +0900
commitc257380965bcf93c9bef330faa6762ed0be494b5 (patch)
tree5448d6dda45c6ebabfdeacf14ffa19be89734e2a /lib/bundler/spec_set.rb
parent192a3a6bfb6b69d1673ffa918bc78184de871c65 (diff)
Revert "Refactor incomplete specs handling"
This reverts commit 69580f8b72f41c58cae57d1ada4db909922b3891.
Diffstat (limited to 'lib/bundler/spec_set.rb')
-rw-r--r--lib/bundler/spec_set.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 2361fc356c..cf63c16a70 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -7,8 +7,11 @@ module Bundler
include Enumerable
include TSort
- def initialize(specs)
+ attr_reader :incomplete_specs
+
+ def initialize(specs, incomplete_specs = [])
@specs = specs
+ @incomplete_specs = incomplete_specs
end
def for(dependencies, check = false, platforms = [nil])
@@ -42,7 +45,7 @@ module Bundler
end
if incomplete && check
- specs << IncompleteSpecification.new(name, lookup[name])
+ @incomplete_specs += lookup[name].any? ? lookup[name] : [LazySpecification.new(name, nil, nil)]
end
end
@@ -81,7 +84,7 @@ module Bundler
def materialize(deps)
materialized = self.for(deps, true)
- SpecSet.new(materialized)
+ SpecSet.new(materialized, incomplete_specs)
end
# Materialize for all the specs in the spec set, regardless of what platform they're for
@@ -100,19 +103,17 @@ module Bundler
def incomplete_ruby_specs?(deps)
return false if @specs.empty?
- materialized = self.for(deps, true, [Gem::Platform::RUBY])
+ @incomplete_specs = []
+
+ self.for(deps, true, [Gem::Platform::RUBY])
- SpecSet.new(materialized).incomplete_specs.any?
+ @incomplete_specs.any?
end
def missing_specs
@specs.select {|s| s.is_a?(LazySpecification) }
end
- def incomplete_specs
- @specs.select {|s| s.is_a?(IncompleteSpecification) }
- end
-
def merge(set)
arr = sorted.dup
set.each do |set_spec|