-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guardfile
47 lines (36 loc) · 930 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
require 'guard/guard'
module ::Guard
class Bacon < Guard
def run_all
system "bundle exec bacon -Itest -q -a"
puts
true
end
def run_spec(path)
if File.exists?(path)
@success &&= system "bundle exec bacon -Itest -q #{path}"
puts
end
end
def file_changed(path)
run_spec(path)
end
def run_on_changes(paths)
@success = true
paths.delete(:all)
paths.each do |path|
file_changed(path)
end
run_all if @success
end
end
end
guard 'bacon' do
# Example of mapping a lib file to one or more test files
watch('lib/pry/indent.rb') { 'test/test_indent.rb' }
watch(%r{^lib/pry/commands/([^.]+)\.rb}) { |m| "test/test_commands/test_#{m[1]}.rb" }
# If no such mapping exists, just run all of them
watch(%r{^lib/}) { :all }
# If we modified one test file, run it
watch(%r{^test.*/test_.+\.rb$})
end