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