forked from commandprompt/osem-pg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guardfile
64 lines (55 loc) · 1.39 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/ruby
#
# More info at https://github.com/guard/guard#readme
guard_opts = {
all_on_start: true,
all_after_pass: true,
cmd: 'spring rspec'
}
def model_specs ; 'spec/models' end
def model_spec(model)
"spec/models/#{model}_spec.rb"
end
def all_testunit_tests
[
model_tests,
controller_tests,
helper_tests,
integration_tests,
]
end
def all_specs
[
model_specs,
]
end
def startup_guards
watch(%r{^Gemfile$}) { yield }
watch(%r{^Gemfile.lock$}) { yield }
watch(%r{^config/routes.rb$}) { yield }
watch(%r{^config/application\.rb$}) { yield }
watch(%r{^config/environment\.rb$}) { yield }
watch(%r{^config/environments/.+\.rb$}) { yield }
watch(%r{^config/initializers/.+\.rb$}) { yield }
watch(%r{^db/schema\.rb$}) { yield }
watch(%r{^spec/spec_helper\.rb$}) { yield }
end
def rspec_guards
watch(%r{^spec/factories/.+\.rb$}) { all_specs }
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
end
group :rspec do
guard 'rspec', guard_opts do
#startup_guards { all_specs }
rspec_guards
#all_specs
end
end
# group :bundler do
# guard 'bundler' do
# watch('Gemfile')
# # Uncomment next line if Gemfile contain `gemspec' command
# # watch(/^.+\.gemspec/)
# end
# end