Class: Pod::Command::Repo::Lint
- Inherits:
-
Pod::Command::Repo
- Object
- CLAide::Command
- Pod::Command
- Pod::Command::Repo
- Pod::Command::Repo::Lint
- Defined in:
- lib/cocoapods/command/repo/lint.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Lint
constructor
A new instance of Lint.
-
#run ⇒ Object
Run the command.
Methods inherited from Pod::Command::Repo
Methods included from Executable
#executable, execute_command, which
Methods inherited from Pod::Command
#ensure_master_spec_repo_exists!, report_error, run
Methods included from Pod::Config::Mixin
Constructor Details
#initialize(argv) ⇒ Lint
Returns a new instance of Lint.
21 22 23 24 25 |
# File 'lib/cocoapods/command/repo/lint.rb', line 21 def initialize(argv) @name = argv.shift_argument @only_errors = argv.flag?('only-errors') super end |
Class Method Details
.options ⇒ Object
17 18 19 |
# File 'lib/cocoapods/command/repo/lint.rb', line 17 def self. [['--only-errors', 'Lint presents only the errors']].concat(super) end |
Instance Method Details
#run ⇒ Object
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.
Run the command
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 68 69 70 71 |
# File 'lib/cocoapods/command/repo/lint.rb', line 34 def run if @name dirs = File.exist?(@name) ? [Pathname.new(@name)] : [dir] else dirs = config.repos_dir.children.select(&:directory?) end dirs.each do |dir| SourcesManager.check_version_information(dir) 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 |, versions_by_name| UI.puts "-> #{}".yellow versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" } UI.puts end report.pods_by_error.each do |, versions_by_name| UI.puts "-> #{}".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 |