Class: Guard::JslintOnRails

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/jslint-on-rails.rb

Constant Summary collapse

VERSION =
'0.0.6'

Instance Method Summary collapse

Instance Method Details

#run_on_change(paths) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/guard/jslint-on-rails.rb', line 10

def run_on_change(paths)
  error = nil
  begin
    output = capture_output do
      lint = JSLint::Lint.new(
        :paths => paths,
        :config_path => File.join(Dir.pwd, 'config', 'jslint.yml')
      )
      lint.run
    end
  rescue JSLint::LintCheckFailure => e
    error = e
  end
  Notifier.notify((error ? 'failed' : 'passed'), :title => 'JSLint results', :image => (error ? :failed : :success))
  true
end