Commit ed1b63ca authored by Samuel Giddins's avatar Samuel Giddins

[AbstractExternalSource] Quickly validate specs

parent 76a401c0
......@@ -141,17 +141,29 @@ module Pod
# @return [void]
#
def store_podspec(sandbox, spec, json = false)
if spec.is_a? Pathname
spec = Specification.from_file(spec).to_pretty_json
json = true
elsif spec.is_a?(String) && !json
spec = Specification.from_string(spec, 'spec.podspec').to_pretty_json
json = true
elsif spec.is_a?(Specification)
spec = spec.to_pretty_json
json = true
case spec
when Pathname
spec = Specification.from_file(spec)
when String
path = "#{name}.podspec"
path << '.json' if json
spec = Specification.from_string(spec, path)
end
validate_podspec(spec)
sandbox.store_podspec(name, spec.to_pretty_json, true, true)
end
def validate_podspec(podspec)
validator = Validator.new(podspec, [])
validator.quick = true
validator.allow_warnings = true
validator.ignore_public_only_results = true
Config.instance.with_changes(:silent => true) do
validator.validate
end
unless validator.validated?
raise Informative, "The `#{name}` pod failed to validate due to #{validator.failure_reason}:\n#{validator.results_message}"
end
sandbox.store_podspec(name, spec, true, json)
end
end
end
......
......@@ -88,6 +88,11 @@ module Pod
# @return [void]
#
def print_results
UI.puts results_message
end
def results_message
message = ''
results.each do |result|
if result.platforms == [:ios]
platform_message = '[iOS] '
......@@ -114,9 +119,9 @@ module Pod
when :warning then type = 'WARN'
when :note then type = 'NOTE'
else raise "#{result.type}" end
UI.puts " - #{type.ljust(5)} | #{platform_message}#{subspecs_message}#{result.attribute_name}: #{result.message}"
message << " - #{type.ljust(5)} | #{platform_message}#{subspecs_message}#{result.attribute_name}: #{result.message}\n"
end
UI.puts
message << "\n"
end
def failure_reason
......
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