-
Notifications
You must be signed in to change notification settings - Fork 0
/
watchr.rb
34 lines (29 loc) · 1.05 KB
/
watchr.rb
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
# Run me with:
# $ watchr watchr.rb
# --------------------------------------------------
# Rules
# --------------------------------------------------
watch( '^test.*/*_test.*\.rb' ) { rake } # or run specific one { |m| ruby m[0] }
watch( '^lib/(.*)\.rb' ) { rake } # { |m| ruby "test/test_#{m[1]}.rb" }
watch( '^test/test_helper\.rb' ) { rake }
watch( '^web/views/(.*)\.(.*)' ) { rake }
watch( '^web/public/css/(.*)\.scss' ) { sass }
# --------------------------------------------------
# Signal Handling
# --------------------------------------------------
Signal.trap('QUIT') { rake } # Ctrl-\
Signal.trap('INT' ) { abort("\n") } # Ctrl-C
# --------------------------------------------------
# Helpers
# --------------------------------------------------
def rake
run "clear"
run "bundle exec rake"
end
def sass
run "bundle exec sass --style compressed --scss -I web/public/css/ web/public/css/elefant.scss web/public/css/elefant.css"
end
def run( cmd )
puts cmd
system cmd
end