class SourceValidator
Attributes
private_sources[RW]
private_specs[RW]
Public Class Methods
new(private_specs, private_sources)
click to toggle source
# File lib/cocoapods-whitelist/validator/source_validator.rb, line 6 def initialize(private_specs, private_sources) @private_specs = private_specs @private_sources = private_sources end
Public Instance Methods
filter_dependency(pod, specifications)
click to toggle source
Filters the valids specifications for a given pod Params:
pod
-
podname to be validated
specifications
-
potencial unsecure specs
@returs valid specs
# File lib/cocoapods-whitelist/validator/source_validator.rb, line 16 def filter_dependency(pod, specifications) return specifications.select { |spec| spec_is_valid(pod, spec) } end
spec_is_valid(pod, spec)
click to toggle source
# File lib/cocoapods-whitelist/validator/source_validator.rb, line 20 def spec_is_valid(pod, spec) # Allow external dependencies (using :git or :path), which create a local podspec return true if !spec.defined_in_file.nil? && spec.defined_in_file.to_s.include?('/Pods/Local Podspecs') # Allow every dependency that comes from our privates sources return true if @private_sources.include? spec.spec_source.url # NO dependency that comes from a public source should be in our private specs return true if !@private_specs.include? spec.name return false end