summaryrefslogtreecommitdiff
path: root/lib/bundler/spec_set.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2021-07-23 23:49:13 +0200
committerHiroshi SHIBATA <[email protected]>2021-08-31 19:06:14 +0900
commit9a25a98c6b43ef32a8d2e36ef9fa4f5b00ad283c (patch)
treeb8148663e3e8e9cdf7e80a6777c2f4967af987f6 /lib/bundler/spec_set.rb
parentd298ef40f252165f76bfd8c677e1aa907e4c0007 (diff)
[rubygems/rubygems] Show all missing gems when using a bundle before installing it
Not only the first one that's missing. This also allows us to simplify things. https://github.com/rubygems/rubygems/commit/69718a9509
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4789
Diffstat (limited to 'lib/bundler/spec_set.rb')
-rw-r--r--lib/bundler/spec_set.rb26
1 files changed, 9 insertions, 17 deletions
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 1a8906c47e..7d41a2bc92 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -11,7 +11,7 @@ module Bundler
@specs = specs
end
- def for(dependencies, check = false, match_current_platform = false, raise_on_missing = true)
+ def for(dependencies, check = false, match_current_platform = false)
handled = []
deps = dependencies.dup
specs = []
@@ -33,11 +33,6 @@ module Bundler
end
elsif check
return false
- elsif raise_on_missing
- others = lookup[dep.name] if match_current_platform
- message = "Unable to find a spec satisfying #{dep} in the set. Perhaps the lockfile is corrupted?"
- message += " Found #{others.join(", ")} that did not match the current platform." if others && !others.empty?
- raise GemNotFound, message
end
end
@@ -71,8 +66,8 @@ module Bundler
lookup.dup
end
- def materialize(deps, missing_specs = nil)
- materialized = self.for(deps, false, true, !missing_specs)
+ def materialize(deps)
+ materialized = self.for(deps, false, true)
materialized.group_by(&:source).each do |source, specs|
next unless specs.any?{|s| s.is_a?(LazySpecification) }
@@ -84,16 +79,9 @@ module Bundler
materialized.map! do |s|
next s unless s.is_a?(LazySpecification)
- spec = s.__materialize__
- unless spec
- unless missing_specs
- raise GemNotFound, "Could not find #{s.full_name} in any of the sources"
- end
- missing_specs << s
- end
- spec
+ s.__materialize__ || s
end
- SpecSet.new(missing_specs ? materialized.compact : materialized)
+ SpecSet.new(materialized)
end
# Materialize for all the specs in the spec set, regardless of what platform they're for
@@ -117,6 +105,10 @@ module Bundler
end
end
+ def missing_specs
+ select {|s| s.is_a?(LazySpecification) }
+ end
+
def merge(set)
arr = sorted.dup
set.each do |set_spec|