5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/ecstatic/watcher.rb', line 5
def self.watch!
script = Watchr::Script.new
script.watch('site/pages/(.*)\.haml') do |m|
puts "Compiling page: #{m[0]}"
system("haml site/pages/#{m[1]}.haml gh-pages/#{m[1]}.html")
end
script.watch('site/assets/stylesheets/.*') { puts 'Compiling scss'; system('compass compile') }
script.watch('site/assets/scripts/(.*)\.coffee') do |m|
puts "Compiling CoffeeScript file: #{m[0]}"
system("coffee -o gh-pages/javascripts -c #{m[0]}")
end
script.watch('site/assets/scripts/(.*)\.js') do |m|
puts "Copying changed JavaScript: #{m[0]}"
system("cp #{m[0]} gh-pages/javascripts/#{m[1]}.js")
end
handler = Watchr.handler.new
controller = Watchr::Controller.new(script,handler)
controller.run
end
|