Class: Pod::Command::RepoHg::Lint

Inherits:
Pod::Command::RepoHg show all
Defined in:
lib/pod/command/repo_hg.rb

Overview

todo: lint is blowing up, fix it - dusty

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::RepoHg

#dir

Constructor Details

#initialize(argv) ⇒ Lint

Returns a new instance of Lint.



157
158
159
160
161
# File 'lib/pod/command/repo_hg.rb', line 157

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

Class Method Details

.optionsObject



153
154
155
# File 'lib/pod/command/repo_hg.rb', line 153

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

Instance Method Details

#runObject

TODO:

Part of this logic needs to be ported to cocoapods-core so web services can validate the repo.

TODO:

add UI.print and enable print statements again.



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/pod/command/repo_hg.rb', line 168

def run
  if @name
    dirs = File.exists?(@name) ? [ Pathname.new(@name) ] : [ dir ]
  else
    dirs = config.repos_dir.children.select {|c| c.directory?}
  end
  dirs.each do |dir|
    SourcesManager.check_version_information(dir) #todo: test me
    UI.puts "\nLinting spec repo `#{dir.realpath.basename}`\n".yellow

    validator = Source::HealthReporter.new(dir)
    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