Class: Pod::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-bb-bin/native/validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(spec_or_path, source_urls, platforms = [], use_cocoapods_validator = true) ⇒ Boolean

attr_accessor :use_cocoapods_validator



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cocoapods-bb-bin/native/validator.rb', line 8

def initialize(spec_or_path, source_urls, platforms = [], use_cocoapods_validator = true)
  @use_cocoapods_validator = use_cocoapods_validator
  UI.puts "use_cocoapods_validator = #{use_cocoapods_validator}"
  @use_frameworks = true
  @linter = Specification::Linter.new(spec_or_path)
  @source_urls = if @linter.spec && @linter.spec.dependencies.empty? && @linter.spec.recursive_subspecs.all? { |s| s.dependencies.empty? }
                   []
                 else
                   source_urls.map { |url| config.sources_manager.source_with_name_or_url(url) }.map(&:url)
                 end

  @platforms = platforms.map do |platform|
    result =  case platform.to_s.downcase
              # Platform doesn't recognize 'macos' as being the same as 'osx' when initializing
              when 'macos' then Platform.macos
              else Platform.new(platform, nil)
              end
    unless valid_platform?(result)
      raise Informative, "Unrecognized platform `#{platform}`. Valid platforms: #{VALID_PLATFORMS.join(', ')}"
    end
    result
  end
  @use_frameworks = true
end

Instance Method Details

#check_file_patternsObject

覆盖



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cocoapods-bb-bin/native/validator.rb', line 43

def check_file_patterns
  if @use_cocoapods_validator
    cocoapods_check_file_patterns
    return
  end
  # 二进制验证部分
  FILE_PATTERNS.each do |attr_name|
    next if %i(source_files resources).include? attr_name
      if respond_to?("_validate_#{attr_name}", true)
        send("_validate_#{attr_name}")
      else
        validate_nonempty_patterns(attr_name, :error)
      end
  end

  _validate_header_mappings_dir
  if consumer.spec.root?
    _validate_license
    _validate_module_map
  end
end

#perform_extensive_analysis(spec) ⇒ Object

Perform analysis for a given spec (or subspec)



35
36
37
38
39
40
# File 'lib/cocoapods-bb-bin/native/validator.rb', line 35

def perform_extensive_analysis(spec)
  if @use_cocoapods_validator
    return cocoapods_perform_extensive_analysis(spec) 
  end
  return true
end

#validate_source_url(spec) ⇒ Object



65
66
67
68
69
70
# File 'lib/cocoapods-bb-bin/native/validator.rb', line 65

def validate_source_url(spec)
  if @use_cocoapods_validator
    cocoapods_validate_source_url(spec)
    return
  end
end