Commit 4f14c872 authored by Samuel Giddins's avatar Samuel Giddins

[Sandbox] Cache “Local Podspec” specs

parent 505f9395
...@@ -170,8 +170,10 @@ module Pod ...@@ -170,8 +170,10 @@ module Pod
rescue Pod::DSLError => e rescue Pod::DSLError => e
raise Informative, "Failed to load '#{name}' podspec: #{e.message}" raise Informative, "Failed to load '#{name}' podspec: #{e.message}"
end end
defined_in_file = spec.defined_in_file
spec.defined_in_file = nil spec.defined_in_file = nil
validate_podspec(spec) validate_podspec(spec)
spec.defined_in_file = defined_in_file
sandbox.store_podspec(name, spec, true, true) sandbox.store_podspec(name, spec, true, true)
end end
......
...@@ -62,6 +62,7 @@ module Pod ...@@ -62,6 +62,7 @@ module Pod
@checkout_sources = {} @checkout_sources = {}
@development_pods = {} @development_pods = {}
@pods_with_absolute_path = [] @pods_with_absolute_path = []
@stored_podspecs = {}
end end
# @return [Lockfile] the manifest which contains the information about the # @return [Lockfile] the manifest which contains the information about the
...@@ -209,7 +210,7 @@ module Pod ...@@ -209,7 +210,7 @@ module Pod
# @return [Specification] the specification if the file is found. # @return [Specification] the specification if the file is found.
# #
def specification(name) def specification(name)
if file = specification_path(name) @stored_podspecs[name] ||= if file = specification_path(name)
original_path = development_pods[name] original_path = development_pods[name]
Specification.from_file(original_path || file) Specification.from_file(original_path || file)
end end
...@@ -262,20 +263,19 @@ module Pod ...@@ -262,20 +263,19 @@ module Pod
end end
FileUtils.copy(podspec, output_path) FileUtils.copy(podspec, output_path)
when Specification when Specification
raise ArgumentError unless json
output_path.open('w') { |f| f.puts(podspec.to_pretty_json) } output_path.open('w') { |f| f.puts(podspec.to_pretty_json) }
spec = podspec.dup spec = podspec.dup
spec.defined_in_file = output_path spec.defined_in_file = output_path
else raise ArgumentError
end end
spec ||= Dir.chdir(podspec.is_a?(Pathname) ? File.dirname(podspec) : Dir.pwd) do spec ||= Specification.from_file(output_path)
spec = Specification.from_file(output_path)
unless spec.name == name unless spec.name == name
raise Informative, "The name of the given podspec `#{spec.name}` doesn't match the expected one `#{name}`" raise Informative, "The name of the given podspec `#{spec.name}` doesn't match the expected one `#{name}`"
end
spec
end end
@stored_podspecs[spec.name] = spec
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