Class: Guard::JslintOnRails
Constant Summary collapse
- VERSION =
'0.2.0'
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ JslintOnRails
constructor
A new instance of JslintOnRails.
- #run_on_change(paths) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(watchers = [], options = {}) ⇒ JslintOnRails
Returns a new instance of JslintOnRails.
10 11 12 13 |
# File 'lib/guard/jslint-on-rails.rb', line 10 def initialize(watchers=[], ={}) super @config_path = File.join(Dir.pwd, [:config_path] || 'config/jslint.yml') end |
Instance Method Details
#run_on_change(paths) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/guard/jslint-on-rails.rb', line 19 def run_on_change(paths) error = nil begin output = capture_output do lint = ::JSLint::Lint.new( :paths => paths, :config_path => @config_path ) lint.run end rescue ::JSLint::LintCheckFailure => e error = e end Notifier.notify((error ? 'failed' : 'passed'), :title => 'JSLint results', :image => (error ? :failed : :success)) true end |
#start ⇒ Object
15 16 17 |
# File 'lib/guard/jslint-on-rails.rb', line 15 def start UI.info "Guard::JsLintOnRails started using config: #{@config_path}" end |