-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathGuardfile
38 lines (35 loc) · 868 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
require 'open3'
require 'colored'
notification :tmux,
display_message: true
group :build do
guard :shell do
watch(/.*\.((l?hs)|cabal)$/) do |m|
puts "Building hailstorm...".cyan
cabal_command = "cabal build --ghc-options='-Wall'"
Open3.popen3(cabal_command) do |_, stdout, stderr, wait_thr|
if wait_thr.value != 0
puts "FAILURE".red
o = stdout.read
e = stderr.read
Notifier.notify("Build failed", {
title: "Hailstorm",
type: "failed"
})
puts o
puts e.red
else
puts "SUCCESS".green
end
end
end
end
end
group :demo do
guard :shell do
watch(/\.store\/.*/) do |m|
puts "Snapshot changed at #{Time.now.strftime("%I:%M:%S %p")}: #{m[0]}".cyan
puts IO.read(m[0]).yellow
end
end
end