Class: Pod::Command::RepoArt::Lint

Inherits:
Pod::Command::RepoArt show all
Defined in:
lib/pod/command/repo_art/lint.rb

Constant Summary

Constants inherited from Pod::Command::RepoArt

UTIL

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::RepoArt

#init

Constructor Details

#initialize(argv) ⇒ Lint

Returns a new instance of Lint



23
24
25
26
27
28
# File 'lib/pod/command/repo_art/lint.rb', line 23

def initialize(argv)
  init
  @name = argv.shift_argument
  @only_errors = argv.flag?('only-errors')
  super
end

Class Method Details

.optionsObject



17
18
19
20
21
# File 'lib/pod/command/repo_art/lint.rb', line 17

def self.options
  [
      ['--only-errors', 'Lint presents only the errors']
  ].concat(super)
end

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/pod/command/repo_art/lint.rb', line 30

def run
  repos = if @name
              UTIL.get_art_repo(@name)
            else
                UTIL.get_art_repos
            end

  repos.each do |repo|
    UI.puts "\nLinting spec repo `#{repo.name}`\n".yellow

    validator = Source::HealthReporter.new(repo.path)
    validator.pre_check do |_name, _version|
      UI.print '.'
    end
    report = validator.analyze
    UI.puts
    UI.puts

    report.pods_by_warning.each do |message, versions_by_name|
      UI.puts "-> #{message}".yellow
      versions_by_name.each { |name, versions| UI.puts "  - #{name} (#{versions * ', '})" }
      UI.puts
    end

    report.pods_by_error.each do |message, versions_by_name|
      UI.puts "-> #{message}".red
      versions_by_name.each { |name, versions| UI.puts "  - #{name} (#{versions * ', '})" }
      UI.puts
    end

    UI.puts "Analyzed #{report.analyzed_paths.count} podspecs files.\n\n"
    if report.pods_by_error.count.zero?
      UI.puts 'All the specs passed validation.'.green << "\n\n"
    else
      raise Informative, "#{report.pods_by_error.count} podspecs failed validation."
    end
  end
end