Skip to content

Commit e0d5025

Browse files
committed
Guard is good for you 💂‍♂️
1 parent 45b5eaa commit e0d5025

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

Guardfile

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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" 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+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
52+
53+
end

0 commit comments

Comments
 (0)