Commit 65dcd5e2 authored by Fabio Pelosin's avatar Fabio Pelosin

[Validator] Minor fix.

parent cfa26784
...@@ -13,6 +13,11 @@ module Pod ...@@ -13,6 +13,11 @@ module Pod
include Config::Mixin include Config::Mixin
# @return [Specification::Linter] the linter instance from CocoaPods
# Core.
#
attr_reader :linter
# @param [Specification, Pathname, String] spec_or_path # @param [Specification, Pathname, String] spec_or_path
# the Specification or the path of the `podspec` file to lint. # the Specification or the path of the `podspec` file to lint.
# #
...@@ -20,6 +25,8 @@ module Pod ...@@ -20,6 +25,8 @@ module Pod
@linter = Specification::Linter.new(spec_or_path) @linter = Specification::Linter.new(spec_or_path)
end end
#-------------------------------------------------------------------------#
# @return [Specification] the specification to lint. # @return [Specification] the specification to lint.
# #
def spec def spec
...@@ -33,10 +40,11 @@ module Pod ...@@ -33,10 +40,11 @@ module Pod
@linter.file @linter.file
end end
# @return [Specification::Linter] the linter instance from CocoaPods # @return [Sandbox::FileAccessor] the file accessor for the spec.
# Core.
# #
attr_reader :linter attr_accessor :file_accessor
#-------------------------------------------------------------------------#
# Lints the specification adding a {Specification::Linter::Result} for any # Lints the specification adding a {Specification::Linter::Result} for any
# failed check to the {#results} list. # failed check to the {#results} list.
...@@ -226,7 +234,9 @@ module Pod ...@@ -226,7 +234,9 @@ module Pod
sandbox = Sandbox.new(config.project_pods_root) sandbox = Sandbox.new(config.project_pods_root)
installer = Installer.new(sandbox, podfile) installer = Installer.new(sandbox, podfile)
installer.install! installer.install!
@pod = installer.local_pods.find { |pod| pod.top_specification == spec }
file_accessors = installer.libraries.first.file_accessors
@file_accessor = file_accessors.find { |accessor| accessor.spec == spec }
config.silent config.silent
end end
...@@ -267,12 +277,12 @@ module Pod ...@@ -267,12 +277,12 @@ module Pod
def check_file_patterns def check_file_patterns
[:source_files, :resources, :preserve_paths].each do |attr_name| [:source_files, :resources, :preserve_paths].each do |attr_name|
attr = Specification::DSL.attributes.values.find{|attr| attr.name == attr_name } attr = Specification::DSL.attributes.values.find{|attr| attr.name == attr_name }
# if !attr.empty?(spec) && @pod.send(attr_name).empty? # if !attr.empty?(spec) && file_accessor.send(attr_name).empty?
# error "The `#{attr_name}` pattern did not match any file." # error "The `#{attr_name}` pattern did not match any file."
# end # end
end end
unless @pod.license_file || spec.license && ( spec.license[:type] == 'Public Domain' || spec.license[:text] ) unless file_accessor.license || spec.license && ( spec.license[:type] == 'Public Domain' || spec.license[:text] )
warning "Unable to find a license file" warning "Unable to find a license file"
end 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