UNPKG

1.82 kBPlain TextView Raw
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 processing config test spec features) \
6# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
8## Note: if you are using the `directories` clause above and you are not
9## watching the project directory ('.'), then you will want to move
10## the Guardfile to a watched dir and symlink it back, e.g.
11#
12# $ mkdir config
13# $ mv Guardfile config/
14# $ ln -s config/Guardfile .
15#
16# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
18guard :bundler do
19 require 'guard/bundler'
20 require 'guard/bundler/verify'
21 helper = Guard::Bundler::Verify.new
22
23 files = ['Gemfile']
24 files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
25
26 # Assume files are symlinked from somewhere
27 files.each { |file| watch(helper.real_path(file)) }
28end
29
30# Note: The cmd option is now required due to the increasing number of ways
31# rspec may be run, below are examples of the most common uses.
32# * bundler: 'bundle exec rspec'
33# * bundler binstubs: 'bin/rspec'
34# * spring: 'bin/rspec' (This will use spring if running and you have
35# installed the spring binstubs per the docs)
36# * zeus: 'zeus rspec' (requires the server to be started separately)
37# * 'just' rspec: 'rspec'
38
39guard :rspec, cmd: 'bundle exec rspec' do
40 require 'guard/rspec/dsl'
41 dsl = Guard::RSpec::Dsl.new(self)
42
43 # Feel free to open issues for suggestions and improvements
44
45 # RSpec files
46 rspec = dsl.rspec
47 watch(rspec.spec_helper) { rspec.spec_dir }
48 watch(rspec.spec_support) { rspec.spec_dir }
49 watch(rspec.spec_files)
50
51 watch(/.+\.rb$/)
52end
53
54guard :rubocop, cli: ['-S', '-D'] do
55 watch(/.+\.rb$/)
56end