-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathGuardfile
More file actions
31 lines (24 loc) · 712 Bytes
/
Guardfile
File metadata and controls
31 lines (24 loc) · 712 Bytes
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
@dir_path = File.dirname(__FILE__)
@output_dir = "#{@dir_path}/classes/"
@src_dir = "#{@dir_path}/src/"
@test_dir = "#{@dir_path}/test/"
@lib_dir = "#{@dir_path}/lib/"
@compile_cmd = "#{@dir_path}/compile.sh #{@src_dir} #{@test_dir} #{@output_dir} #{@lib_dir}"
@test_cmd = "#{@dir_path}/test.sh #{@output_dir} #{@lib_dir}"
guard :test do
watch(%r|^src/(.*).java$|) do |match|
executeTest("#{match[1]}Test")
end
watch(%r|^test/(.*Test).java$|) do |match|
executeTest(match[1])
end
watch(%r|^test/(RunJunit).java$|) do |match|
executeTest(match[1])
end
def executeTest(testName)
puts `#{@compile_cmd}`
if $?.success?
puts `#{@test_cmd} #{testName}`
end
end
end