-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
56 lines (42 loc) · 1.11 KB
/
Rakefile
1
2
3
4
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
require 'rake/clean'
require 'fileutils'
RAKEFILE = 'Rakefile'
###############################################################################
# CoffeeScript
COFFEE = FileList['**/*.coffee']
JS = COFFEE.ext('js')
CLOBBER.include(JS)
rule '.js' => '.coffee' do |t|
puts "COFFEE #{t.source}"
sh 'coffee', '-c', t.source
end
rule 'bin/rejoice' => ['lib/rejoice-bin.js'] do |t|
data = File.read(t.source)
File.open t.name, 'w' do |file|
file.puts "#! /usr/bin/env node"
file.write data
end
end
###############################################################################
# watch
desc "Continuously watch for changes and rebuild files"
task :watch => [:default] do
require 'rubygems'
require 'fssm'
def rebuild
sh 'rake'
puts " OK"
rescue
nil
end
begin
FSSM.monitor(nil, [RAKEFILE, '**/*.coffee', '**/*.haml', '**/*.less']) do
update { rebuild }
delete { rebuild }
create { rebuild }
end
rescue FSSM::CallbackError => e
Process.exit
end
end
task :default => (JS + ['bin/rejoice'])