Class: Pod::Installer::PodfileValidator
- Inherits:
-
Object
- Object
- Pod::Installer::PodfileValidator
- Defined in:
- lib/cocoapods/installer/podfile_validator.rb
Overview
Validate the podfile before installing to catch errors and problems
Instance Attribute Summary collapse
-
#errors ⇒ Array<String>
readonly
Any errors that have occurred during the validation.
-
#podfile ⇒ Podfile
readonly
The podfile being validated.
-
#warnings ⇒ Array<String>
readonly
Any warnings that have occurred during the validation.
Instance Method Summary collapse
-
#initialize(podfile, podfile_dependency_cache = Analyzer::PodfileDependencyCache.from_podfile(podfile)) ⇒ PodfileValidator
constructor
Initialize a new instance.
-
#message ⇒ Object
A message describing any errors in the validation.
-
#valid? ⇒ Boolean
Wether the podfile is valid is not NOTE: Will execute ‘validate` if the podfile has not yet been validated.
-
#validate ⇒ Object
Validate the podfile Errors are added to the errors array.
Constructor Details
#initialize(podfile, podfile_dependency_cache = Analyzer::PodfileDependencyCache.from_podfile(podfile)) ⇒ PodfileValidator
Initialize a new instance
27 28 29 30 31 32 33 |
# File 'lib/cocoapods/installer/podfile_validator.rb', line 27 def initialize(podfile, podfile_dependency_cache = Analyzer::PodfileDependencyCache.from_podfile(podfile)) @podfile = podfile @podfile_dependency_cache = podfile_dependency_cache @errors = [] @warnings = [] @validated = false end |
Instance Attribute Details
#errors ⇒ Array<String> (readonly)
Returns any errors that have occurred during the validation.
13 14 15 |
# File 'lib/cocoapods/installer/podfile_validator.rb', line 13 def errors @errors end |
#podfile ⇒ Podfile (readonly)
Returns The podfile being validated.
9 10 11 |
# File 'lib/cocoapods/installer/podfile_validator.rb', line 9 def podfile @podfile end |
#warnings ⇒ Array<String> (readonly)
Returns any warnings that have occurred during the validation.
17 18 19 |
# File 'lib/cocoapods/installer/podfile_validator.rb', line 17 def warnings @warnings end |
Instance Method Details
#message ⇒ Object
A message describing any errors in the validation
61 62 63 |
# File 'lib/cocoapods/installer/podfile_validator.rb', line 61 def errors.join("\n") end |
#valid? ⇒ Boolean
Wether the podfile is valid is not NOTE: Will execute ‘validate` if the podfile has not yet been validated
52 53 54 55 56 |
# File 'lib/cocoapods/installer/podfile_validator.rb', line 52 def valid? validate unless @validated @validated && errors.empty? end |
#validate ⇒ Object
Validate the podfile Errors are added to the errors array
38 39 40 41 42 43 44 45 46 |
# File 'lib/cocoapods/installer/podfile_validator.rb', line 38 def validate validate_pod_directives validate_no_abstract_only_pods! validate_dependencies_are_present! validate_no_duplicate_targets! @validated = true end |