Class: Pod::Specification::Set

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/resolver/lazy_specification.rb

Defined Under Namespace

Classes: External, LazySpecification

Instance Method Summary collapse

Instance Method Details

#all_specificationsObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/cocoapods/resolver/lazy_specification.rb', line 36

def all_specifications
  @all_specifications ||= begin
    sources_by_version = {}
    versions_by_source.each do |source, versions|
      versions.each { |v| (sources_by_version[v] ||= []) << source }
      sources_by_version
    end

    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

    versions_by_source.flat_map do |source, versions|
      versions.map { |version| LazySpecification.new(name, version, source) }
    end
  end
end