Module: Jasmine::Headless::FileChecker

Included in:
CSSTemplate, CoffeeTemplate, FilesList, JSTTemplate, JSTemplate
Defined in:
lib/jasmine/headless/file_checker.rb

Instance Method Summary collapse

Instance Method Details

#alert_bad_format(file) ⇒ Object



10
11
12
# File 'lib/jasmine/headless/file_checker.rb', line 10

def alert_bad_format(file)
  puts "[%s] %s: %s" % [ 'Skipping File'.color(:red), file.color(:yellow), "unsupported format".color(:white) ]
end

#alert_if_bad_format?(file) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
# File 'lib/jasmine/headless/file_checker.rb', line 14

def alert_if_bad_format?(file)
  if result = bad_format?(file)
    alert_bad_format(file)
  end

  result
end

#bad_format?(file) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
5
6
7
8
# File 'lib/jasmine/headless/file_checker.rb', line 2

def bad_format?(file)
  return if file.nil?

  ::Jasmine::Headless::EXCLUDED_FORMATS.any? do |format|
    file[%r{\.#{format}(\.|$)}]
  end
end