Module: Checker

Defined in:
lib/asker/checker.rb

Defined Under Namespace

Classes: Data

Class Method Summary collapse

Class Method Details

.check(filepath) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/asker/checker.rb', line 5

def self.check(filepath)
  unless File.exist? filepath
    puts Rainbow("File not found!").red.bright
    return false
  end
  unless File.extname(filepath) == '.haml'
    puts Rainbow("Only check HAML files!").yellow.bright
    return false
  end
  check_filepath(filepath)
end

.check_filepath(filepath) ⇒ Object



17
18
19
20
21
22
# File 'lib/asker/checker.rb', line 17

def self.check_filepath(filepath)
  data = Data.new(filepath)
  data.check
  data.show_errors
  data.is_ok?
end