-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guardfile
58 lines (49 loc) · 939 Bytes
/
Guardfile
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
57
58
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require "guard/guard"
module ::Guard
class InlineGuard < ::Guard::Guard
def start
UI.info "Starting up server..."
if running?
UI.error "Another instance of server is running."
false
else
@pid = fork
raise "Fork failed." if @pid == -1
unless @pid
exec "rake server"
end
@pid
end
end
def run_on_change(paths)
`rake`
end
def stop
UI.info "Shutting down server..."
Process.kill("TERM", @pid)
@pid = nil
true
end
def reload
true
end
def running?
begin
if @pid
Process.getpgid @pid
true
else
false
end
rescue Errno::ESRCH
false
end
end
end
end
guard 'inlineGuard' do
watch /\.scss|\.haml$/
end
# vim: ft=ruby: