Skip to content

Commit 041b5d6

Browse files
committed
Adding guard
1 parent 5dc27dd commit 041b5d6

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed

Gemfile.lock

+39
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ GEM
1616
timers (~> 4.0.0)
1717
codeclimate-test-reporter (0.4.7)
1818
simplecov (>= 0.7.1, < 1.0.0)
19+
coderay (1.1.0)
1920
colored (1.2)
2021
commander (4.3.2)
2122
highline (~> 1.7.1)
@@ -26,16 +27,49 @@ GEM
2627
unf (>= 0.0.5, < 1.0.0)
2728
factor-connector-api (0.0.14)
2829
celluloid (~> 0.16.0)
30+
ffi (1.9.8)
31+
formatador (0.2.5)
32+
guard (2.12.5)
33+
formatador (>= 0.2.4)
34+
listen (~> 2.7)
35+
lumberjack (~> 1.0)
36+
nenv (~> 0.1)
37+
notiffany (~> 0.0)
38+
pry (>= 0.9.12)
39+
shellany (~> 0.0)
40+
thor (>= 0.18.1)
41+
guard-compat (1.2.1)
42+
guard-rspec (4.5.0)
43+
guard (~> 2.1)
44+
guard-compat (~> 1.1)
45+
rspec (>= 2.99.0, < 4.0)
2946
highline (1.7.1)
3047
hitimes (1.2.2)
3148
http-cookie (1.0.2)
3249
domain_name (~> 0.5)
3350
liquid (3.0.1)
51+
listen (2.10.0)
52+
celluloid (~> 0.16.0)
53+
rb-fsevent (>= 0.9.3)
54+
rb-inotify (>= 0.9)
55+
lumberjack (1.0.9)
56+
method_source (0.8.2)
3457
mime-types (2.4.3)
3558
multi_json (1.11.0)
59+
nenv (0.2.0)
3660
netrc (0.10.3)
61+
notiffany (0.0.6)
62+
nenv (~> 0.1)
63+
shellany (~> 0.0)
3764
predicated (0.2.6)
65+
pry (0.10.1)
66+
coderay (~> 1.1.0)
67+
method_source (~> 0.8.1)
68+
slop (~> 3.4)
3869
rake (10.4.2)
70+
rb-fsevent (0.9.4)
71+
rb-inotify (0.9.5)
72+
ffi (>= 0.5.0)
3973
rest-client (1.8.0)
4074
http-cookie (>= 1.0.2, < 2.0)
4175
mime-types (>= 1.16, < 3.0)
@@ -59,11 +93,14 @@ GEM
5993
ruby_parser (3.6.5)
6094
sexp_processor (~> 4.1)
6195
sexp_processor (4.5.0)
96+
shellany (0.0.1)
6297
simplecov (0.9.2)
6398
docile (~> 1.1.0)
6499
multi_json (~> 1.0)
65100
simplecov-html (~> 0.9.0)
66101
simplecov-html (0.9.0)
102+
slop (3.6.0)
103+
thor (0.19.1)
67104
timers (4.0.1)
68105
hitimes
69106
unf (0.1.4)
@@ -82,6 +119,8 @@ PLATFORMS
82119
DEPENDENCIES
83120
codeclimate-test-reporter (~> 0.4.7)
84121
factor!
122+
guard (~> 2.12.5)
123+
guard-rspec (~> 4.5.0)
85124
rake (~> 10.4.2)
86125
rspec (~> 3.2.0)
87126
wrong (~> 0.7.1)

Guardfile

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# A sample Guardfile
2+
# More info at https://github.com/guard/guard#readme
3+
4+
## Uncomment and set this to only include directories you want to watch
5+
# directories %w(app lib config test spec features)
6+
7+
## Uncomment to clear the screen before every task
8+
# clearing :on
9+
10+
## Guard internally checks for changes in the Guardfile and exits.
11+
## If you want Guard to automatically start up again, run guard in a
12+
## shell loop, e.g.:
13+
##
14+
## $ while bundle exec guard; do echo "Restarting Guard..."; done
15+
##
16+
## Note: if you are using the `directories` clause above and you are not
17+
## watching the project directory ('.'), then you will want to move
18+
## the Guardfile to a watched dir and symlink it back, e.g.
19+
#
20+
# $ mkdir config
21+
# $ mv Guardfile config/
22+
# $ ln -s config/Guardfile .
23+
#
24+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
25+
26+
# Note: The cmd option is now required due to the increasing number of ways
27+
# rspec may be run, below are examples of the most common uses.
28+
# * bundler: 'bundle exec rspec'
29+
# * bundler binstubs: 'bin/rspec'
30+
# * spring: 'bin/rspec' (This will use spring if running and you have
31+
# installed the spring binstubs per the docs)
32+
# * zeus: 'zeus rspec' (requires the server to be started separately)
33+
# * 'just' rspec: 'rspec'
34+
35+
guard :rspec, cmd: "bundle exec rspec --color" do
36+
require "guard/rspec/dsl"
37+
dsl = Guard::RSpec::Dsl.new(self)
38+
39+
# Feel free to open issues for suggestions and improvements
40+
41+
# RSpec files
42+
rspec = dsl.rspec
43+
watch(rspec.spec_helper) { rspec.spec_dir }
44+
watch(rspec.spec_support) { rspec.spec_dir }
45+
watch(rspec.spec_files)
46+
47+
# Ruby files
48+
ruby = dsl.ruby
49+
dsl.watch_spec_files_for(ruby.lib_files)
50+
51+
# Rails files
52+
rails = dsl.rails(view_extensions: %w(erb haml slim))
53+
dsl.watch_spec_files_for(rails.app_files)
54+
dsl.watch_spec_files_for(rails.views)
55+
56+
watch(rails.controllers) do |m|
57+
[
58+
rspec.spec.("routing/#{m[1]}_routing"),
59+
rspec.spec.("controllers/#{m[1]}_controller"),
60+
rspec.spec.("acceptance/#{m[1]}")
61+
]
62+
end
63+
64+
# Rails config changes
65+
watch(rails.spec_helper) { rspec.spec_dir }
66+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
67+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
68+
69+
# Capybara features specs
70+
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
71+
72+
# Turnip features and steps
73+
watch(%r{^spec/acceptance/(.+)\.feature$})
74+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
75+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
76+
end
77+
end

factor.gemspec

+2
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ Gem::Specification.new do |s|
2727
s.add_development_dependency 'rspec', '~> 3.2.0'
2828
s.add_development_dependency 'rake', '~> 10.4.2'
2929
s.add_development_dependency 'wrong', '~> 0.7.1'
30+
s.add_development_dependency 'guard', '~> 2.12.5'
31+
s.add_development_dependency 'guard-rspec', '~> 4.5.0'
3032
end

0 commit comments

Comments
 (0)