-
Notifications
You must be signed in to change notification settings - Fork 0
Guardfile examples
A real-world Guardfile used in a big Rails project:
group :frontend do
guard :bundler do
watch('Gemfile')
end
guard :pow do
watch('.rvmrc')
watch(%r{^\.pow(rc|env)$})
watch('Gemfile.lock')
watch(%r{^config/.+\.rb$})
end
guard :livereload do
watch(%r{^app/.+\.(erb|haml)})
watch(%r{^app/helpers/.+\.rb})
watch(%r{^public/.+\.(css|js|html)})
watch(%r{^config/locales/.+\.yml})
end
end
group :backend do
guard 'spork', :wait => 50 do
watch('Gemfile')
watch('Gemfile.lock')
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb})
watch(%r{^config/initializers/.+\.rb})
watch('spec/spec_helper.rb')
end
guard :rspec, :version => 2, :cli => "--color --drb -r rspec/instafail -f RSpec::Instafail", :bundler => false, :all_after_pass => false, :all_on_start => false, :keep_failed => false do
watch('spec/spec_helper.rb') { "spec" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
watch('config/routes.rb') { "spec/routing" }
watch(%r{^spec/support/(requests|controllers|mailers|models)_helpers\.rb}) { |m| "spec/#{m[1]}" }
watch(%r{^spec/.+_spec\.rb})
watch(%r{^app/controllers/(.+)_(controller)\.rb}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
watch(%r{^app/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
end
endThe frontend guy would launch Guard like this: [bundle exec] guard -g frontend
While the backend guy would launch it like this: [bundle exec] guard -g backend
guard 'livereload' do
watch(%r{app/.*/[^.][^/]+\.(erb|haml|slim)})
watch(%r{app/helpers/.*/[^.][^/]+\.rb})
watch(%r{public/(.*/[^.][^/]+\.(css|js|html))}) {|m| m[1] }
watch(%r{app/assets/(.*/[^.][^/]+\.css)(\.s[ac]ss)?}) { |m| "/assets/#{m[1]}" }
watch(%r{app/assets/(.*/[^.][^/]+\.js)(\.coffee)?}) { |m| "/assets/#{m[1]}" }
watch(%r{config/locales/[^.].+\.yml})
endThis wiki and the Guard README document contains a lot of information, please take your time and read these instructions carefully.
If you run into any trouble, you may start by understanding how Guard works.
We provide detailed changes for each Guard release.
Be sure to read the CONTRIBUTING guidelines before reporting a new Guard issue or open a pull request.
If you have any questions about the Guard usage or want to share some information with the Guard community, please go to one of the following places:
- Google+ community
- Google group
- StackOverflow
- IRC channel
#guard(irc.freenode.net) for chatting
Intro
Installation
- System Notifications
- Terminal Colors on Windows
- Add Readline support to Ruby on Mac OS X
- Which Growl library should I use
- Efficient Filesystem Handling
Getting Started
- List of Guard Commands
- Command Line Options for Guard
- List of available Guards
- Guardfile examples
- Run Guard within RubyMine
- Guardfile-DSL / Configuring-Guard
- Configuration Files
- Interacting with Guard
- Guard Signals
Troubleshooting
Advanced use of Guard
Cookbooks
Development