Class: Sumodev::Commands::Hooks

Inherits:
Sumodev::Command show all
Defined in:
lib/sumodev/commands/hooks.rb

Instance Method Summary collapse

Methods inherited from Sumodev::Command

banner

Instance Method Details

#check(*files) ⇒ Object



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/sumodev/commands/hooks.rb', line 309

def check(*files)
  errors_and_warnings = {}

  # Check the CSS files
  css_files = find_files_by_extension(files, 'css')
  if css_files.any?
    results = check_css_files(css_files)
    errors_and_warnings['CSS'] = results unless results.empty?
  end

  # Check the SCSS files
  scss_files = find_files_by_extension(files, 's(c|a)ss')
  if scss_files.any?
    results = check_scss_files(scss_files)
    errors_and_warnings['SCSS'] = results unless results.empty?
  end

  # Check the Coffee files
  coffee_files = find_files_by_extension(files, 'coffee')
  if coffee_files.any?
    results = check_coffee_files(coffee_files)
    errors_and_warnings['Coffee'] = results unless results.empty?
  end

  # Check the JS files
  js_files = find_files_by_extension(files, 'js')
  if js_files.any?
    results = check_js_files(js_files)
    errors_and_warnings['JS'] = results unless results.empty?
  end

  # Check the php files
  php_files = find_files_by_extension(files, 'php')
  if php_files.any?
    results = check_php_files(php_files)
    errors_and_warnings['PHP'] = results unless results.empty?
  end

  output_results(errors_and_warnings)
end