Class: Simplabs::Excellent::CommandLineRunner

Inherits:
Runner
  • Object
show all
Defined in:
lib/simplabs/excellent/command_line_runner.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Runner

Runner::DEFAULT_CONFIG

Instance Attribute Summary

Attributes inherited from Runner

#config

Instance Method Summary collapse

Methods inherited from Runner

#check, #check_code, #warnings

Constructor Details

#initialize(*checks) ⇒ CommandLineRunner

Returns a new instance of CommandLineRunner.



10
11
12
13
14
# File 'lib/simplabs/excellent/command_line_runner.rb', line 10

def initialize(*checks)
  super
  @formatter = Formatters::Text.new
  @formatter.start
end

Instance Method Details

#check_file(filename) ⇒ Object



28
29
30
31
# File 'lib/simplabs/excellent/command_line_runner.rb', line 28

def check_file(filename)
  super
  @formatter.file(filename, (@checks || []).collect { |check| check.warnings }.flatten)
end

#check_paths(paths) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/simplabs/excellent/command_line_runner.rb', line 16

def check_paths(paths)
  paths.each do |path|
    if File.file?(path)
      check_file(path)
    elsif File.directory?(path)
      Dir.glob(File.join(path, '**/*.rb')).each { |file| check_file(file) }
    else
      next
    end
  end
end