-
Notifications
You must be signed in to change notification settings - Fork 3
/
Guardfile
49 lines (43 loc) · 1.23 KB
/
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
require 'guard/plugin'
module ::Guard
class MoonBuild < ::Guard::Plugin
def exec_build(*args)
system('bundle', 'exec', 'rake', *args)
end
def do_tests
Guard::Notifier.notify 'Testing', title: 'moon', image: :pending
if exec_build('--verbose', 'test')
Guard::Notifier.notify 'Tests Passed', title: 'moon', image: :success
true
else
Guard::Notifier.notify 'Tests Failed', title: 'moon', image: :failed
false
end
end
def do_build
Guard::Notifier.notify 'Building', title: 'moon', image: :pending
if exec_build('--verbose', 'build')
Guard::Notifier.notify 'Build Successful', title: 'moon', image: :success
true
else
Guard::Notifier.notify 'Build Failed', title: 'moon', image: :failed
false
end
end
def run_all
do_build and do_tests
end
def run_on_changes(paths)
do_build and do_tests
end
end
end
guard :moon_build do
watch(/modules\/(.+)\/(?:src|include|tools)\/(.+\.(?:cpp|cxx|cc|c|hpp|hxx|hh|h))/)
watch(/modules\/(.+)\/(?:mrblib|docstub)\/(.+\.rb)/)
watch(/(.+\.rake)/)
watch(/CMakeLists.txt/)
watch(/mrb_config.rb/)
watch(/Rakefile/)
watch(/test\/(.+\.rb)/)
end