Class: Guard::Mustachejs

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/mustachejs.rb

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Mustachejs.



7
8
9
10
11
12
# File 'lib/guard/mustachejs.rb', line 7

def initialize(watchers = [], options = {})
  super(watchers, {
    :variable => 'mustache_templates',
    :output => 'public/javascripts/mustache-templates.js'
  }.merge(options))
end

Instance Method Details

#run_allObject



22
23
24
25
# File 'lib/guard/mustachejs.rb', line 22

def run_all
  paths = Watcher.match_files(self, Dir.glob(File.join('**', '*'))).uniq
  write_template paths
end

#run_on_changes(paths) ⇒ Object



18
19
20
# File 'lib/guard/mustachejs.rb', line 18

def run_on_changes(paths)
  run_all
end

#startObject



14
15
16
# File 'lib/guard/mustachejs.rb', line 14

def start
  write_template([]) unless File.exists?(options[:output])
end