Class: Guard::CoffeeScript

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/coffeescript.rb,
lib/guard/coffeescript/runner.rb,
lib/guard/coffeescript/formatter.rb,
lib/guard/coffeescript/inspector.rb

Defined Under Namespace

Modules: Formatter, Inspector, Runner

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ CoffeeScript

Returns a new instance of CoffeeScript.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/guard/coffeescript.rb', line 12

def initialize(watchers = [], options = {})
  watchers = [] if !watchers
  defaults = {
      :bare => false,
      :shallow => false,
      :hide_success => false,
  }

  if options[:input]
    defaults.merge!({ :output => options[:input] })
    watchers << ::Guard::Watcher.new(%r{^#{ options.delete(:input) }/(.+\.coffee)$})
  end

  super(watchers, defaults.merge(options))
end

Instance Method Details

#run_allObject



28
29
30
# File 'lib/guard/coffeescript.rb', line 28

def run_all
  run_on_change(Watcher.match_files(self, Dir.glob(File.join('**', '*.coffee'))))
end

#run_on_change(paths) ⇒ Object



32
33
34
35
36
37
# File 'lib/guard/coffeescript.rb', line 32

def run_on_change(paths)
  changed_files, success = Runner.run(Inspector.clean(paths), watchers, options)
  notify changed_files
  
  success
end