Class: Pod::Source::HealthReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-core/source/health_reporter.rb

Overview

Checks a source for errors and warnings.

Defined Under Namespace

Classes: HealthReport

Actions collapse

Instance Attribute Summary collapse

Configuration collapse

Actions collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ HealthReporter



12
13
14
15
16
# File 'lib/cocoapods-core/source/health_reporter.rb', line 12

def initialize(repo)
  @source = Source.new(repo)
  @errors = {}
  @linter_results = {}
end

Instance Attribute Details

#reportHealtReport (readonly)



65
66
67
# File 'lib/cocoapods-core/source/health_reporter.rb', line 65

def report
  @report
end

#sourceSource (readonly)



8
9
10
# File 'lib/cocoapods-core/source/health_reporter.rb', line 8

def source
  @source
end

Instance Method Details

#analyzeHealthReport

Analyzes all the specification files in the source.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/cocoapods-core/source/health_reporter.rb', line 46

def analyze
  @report = HealthReport.new(source)

  source.pods.each do |name|
    source.versions(name).each do |version|
      @pre_check_callback.call(name, version) if @pre_check_callback
      spec_path = source.specification_path(name, version)
      spec = lint_spec(name, version, spec_path)
      check_spec_path(name, version, spec) if spec
      report.analyzed_paths << spec_path
    end
  end

  check_stray_specs
  report
end

#pre_check(&block) ⇒ void

This method returns an undefined value.

Allows to specify an optional callback which is called before analysing every spec. Suitable for UI.



32
33
34
# File 'lib/cocoapods-core/source/health_reporter.rb', line 32

def pre_check(&block)
  @pre_check_callback = block
end