Commit 3c674bbc authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Resolver] Extract LazySpecification code into resolver/lazy_specification.rb

parent e9667506
module Pod
class Specification::Set
class LazySpecification < BasicObject
attr_reader :name, :version, :source
def initialize(name, version, source)
@name = name
@version = version
@source = source
end
def method_missing(method, *args, &block)
specification.send(method, *args, &block)
end
def subspec_by_name(name = nil)
if !name || name == self.name
self
else
specification.subspec_by_name(name)
end
end
def specification
@specification ||= source.specification(name, version)
end
end
def all_specifications
@all_specifications ||= versions_by_source.map do |source, versions|
versions.map { |version| LazySpecification.new(name, version, source) }
end.flatten
end
end
class Specification::Set::External
def all_specifications
[specification]
end
end
require 'resolver'
require 'cocoapods/resolver/lazy_specification'
module Pod
# The resolver is responsible of generating a list of specifications grouped
# by target for a given Podfile.
#
class Resolver
require 'resolver'
include ::Resolver::UI
include ::Resolver::SpecificationProvider
......
module Pod
class Specification::Set
class LazySpecification < BasicObject
attr_reader :name, :version, :source
def initialize(name, version, source)
@name = name
@version = version
@source = source
end
def method_missing(method, *args, &block)
specification.send(method, *args, &block)
end
def subspec_by_name(name = nil)
if !name || name == self.name
self
else
specification.subspec_by_name(name)
end
end
def specification
@specification ||= source.specification(name, version)
end
end
class External
def all_specifications
[specification]
end
end
def all_specifications
@all_specifications ||= versions_by_source.map do |source, versions|
versions.map { |version| LazySpecification.new(name, version, source) }
end.flatten
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment