Class: Pod::Installer::PodfileValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/installer/podfile_validator.rb

Overview

Validate the podfile before installing to catch errors and problems

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(podfile) ⇒ PodfileValidator

Initialize a new instance



23
24
25
26
27
28
# File 'lib/cocoapods/installer/podfile_validator.rb', line 23

def initialize(podfile)
  @podfile = podfile
  @errors = []
  @warnings = []
  @validated = false
end

Instance Attribute Details

#errorsArray<String> (readonly)



13
14
15
# File 'lib/cocoapods/installer/podfile_validator.rb', line 13

def errors
  @errors
end

#podfilePodfile (readonly)



9
10
11
# File 'lib/cocoapods/installer/podfile_validator.rb', line 9

def podfile
  @podfile
end

#warningsArray<String> (readonly)



17
18
19
# File 'lib/cocoapods/installer/podfile_validator.rb', line 17

def warnings
  @warnings
end

Instance Method Details

#messageObject

A message describing any errors in the validation



55
56
57
# File 'lib/cocoapods/installer/podfile_validator.rb', line 55

def message
  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



46
47
48
49
50
# File 'lib/cocoapods/installer/podfile_validator.rb', line 46

def valid?
  validate unless @validated

  @validated && errors.empty?
end

#validateObject

Validate the podfile Errors are added to the errors array



33
34
35
36
37
38
39
40
# File 'lib/cocoapods/installer/podfile_validator.rb', line 33

def validate
  validate_pod_directives
  validate_no_abstract_only_pods!
  validate_dependencies_are_present!
  validate_no_duplicate_targets!

  @validated = true
end