Class: Pod::Specification::Set
- Inherits:
-
Object
- Object
- Pod::Specification::Set
- Defined in:
- lib/cocoapods/resolver/lazy_specification.rb
Defined Under Namespace
Classes: External, LazySpecification, SpecWithSource
Instance Method Summary collapse
-
#all_specifications(warn_for_multiple_pod_sources, requirement) ⇒ Object
returns the highest versioned spec last.
Instance Method Details
#all_specifications(warn_for_multiple_pod_sources, requirement) ⇒ Object
returns the highest versioned spec last
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/cocoapods/resolver/lazy_specification.rb', line 55 def all_specifications(warn_for_multiple_pod_sources, requirement) @all_specifications ||= {} @all_specifications[requirement] ||= begin sources_by_version = {} versions_by_source.each do |source, versions| versions.each do |v| next unless requirement.satisfied_by?(v) (sources_by_version[v] ||= []) << source end end if warn_for_multiple_pod_sources duplicate_versions = sources_by_version.select { |_version, sources| sources.count > 1 } duplicate_versions.each do |version, sources| UI.warn "Found multiple specifications for `#{name} (#{version})`:\n" + sources. map { |s| s.specification_path(name, version) }. map { |v| "- #{v}" }.join("\n") end end # sort versions from high to low sources_by_version.sort_by(&:first).flat_map do |version, sources| # within each version, we want the prefered (first-specified) source # to be the _last_ one sources.reverse_each.map { |source| LazySpecification.new(name, version, source) } end end end |