Skip to content
Newer
Older
100644 48 lines (36 sloc) 930 Bytes
981f12d @rf- Add simple Guardfile
rf- authored Sep 8, 2012
1 require 'guard/guard'
2
3 module ::Guard
4 class Bacon < Guard
5 def run_all
6 system "bundle exec bacon -Itest -q -a"
7 puts
8 true
9 end
10
11 def run_spec(path)
12 if File.exists?(path)
a613c26 @rf- Make logic more confusing
rf- authored Sep 8, 2012
13 @success &&= system "bundle exec bacon -Itest -q #{path}"
981f12d @rf- Add simple Guardfile
rf- authored Sep 9, 2012
14 puts
15 end
16 end
17
18 def file_changed(path)
19 run_spec(path)
20 end
21
22 def run_on_changes(paths)
a613c26 @rf- Make logic more confusing
rf- authored Sep 9, 2012
23 @success = true
981f12d @rf- Add simple Guardfile
rf- authored Sep 9, 2012
24 paths.delete(:all)
25
26 paths.each do |path|
27 file_changed(path)
28 end
29
a613c26 @rf- Make logic more confusing
rf- authored Sep 9, 2012
30 run_all if @success
981f12d @rf- Add simple Guardfile
rf- authored Sep 9, 2012
31 end
32 end
33 end
34
35 guard 'bacon' do
36 # Example of mapping a lib file to one or more test files
37 watch('lib/pry/indent.rb') { 'test/test_indent.rb' }
38
735e057 @rf- Rearrange command tests to match command file layout
rf- authored Sep 15, 2012
39 watch(%r{^lib/pry/commands/([^.]+)\.rb}) { |m| "test/test_commands/test_#{m[1]}.rb" }
40
981f12d @rf- Add simple Guardfile
rf- authored Sep 9, 2012
41 # If no such mapping exists, just run all of them
42 watch(%r{^lib/}) { :all }
43
44 # If we modified one test file, run it
45 watch(%r{^test.*/test_.+\.rb$})
46 end
47
Something went wrong with that request. Please try again.