-
Notifications
You must be signed in to change notification settings - Fork 3
/
Guardfile
39 lines (36 loc) · 805 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 "guard/guard"
module ::Guard
class Haskell < Guard
def initialize(watchers=[], options={})
@options = options
super(watchers, options)
end
def run_on_change(paths)
paths.each do |path|
run(path)
end
end
def run_on_additions(paths)
run_on_change(paths)
end
def start
run_all
end
def run_all
Dir["spec/**/*[Ss]pec.*"].each do |path|
run(path)
end
end
def run(path)
cmd = "echo ----------------------------------------\nrunhaskell"
cmd << " #{@options[:cli]}" if @options[:cli]
cmd << " #{path}"
puts cmd
system cmd
end
end
end
guard "haskell" do
watch(%r{^spec/.*spec.*$}i)
watch(%r{^(TTT/.*)\.([^./]+)$}) { |m| "spec/#{m[1]}_spec.#{m[2]}" }
end