Created
September 5, 2011 20:25
-
-
Save anithri/1195842 to your computer and use it in GitHub Desktop.
guard examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Gemfile | |
group :development do | |
gem 'guard' | |
gem 'guard-bundler' | |
gem 'guard-rspec' | |
gem 'guard-annotate' | |
gem 'guard-spork' | |
#For linux | |
#gem 'rb-inotify' | |
#gem 'libnotify' | |
#for OSX | |
#gem 'rb-fsevent' | |
#gem 'growl_notify' # or gem 'growl' | |
#for Windows | |
#gem 'rb-fchange' | |
#gem 'rb-notifu' | |
#gem 'win32console' #include for console colors | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Guardfile | |
guard 'bundler' do | |
watch('Gemfile') | |
end | |
guard 'rspec', :version => 2 do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_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/acceptance/#{m[1]}_spec.rb"] } | |
watch(%r{^spec/support/(.+)\.rb$}) { "spec/" } | |
watch('spec/spec_helper.rb') { "spec/" } | |
watch('config/routes.rb') { "spec/routing" } | |
watch('app/controllers/application_controller.rb') { "spec/controllers" } | |
# Capybara request specs | |
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } | |
end | |
guard 'annotate' do | |
watch( 'db/schema.rb' ) | |
# a model file changes | |
#watch( 'app/models/**/*.rb' ) | |
# Uncomment the following line if you are running routes annotation | |
# with the ":routes => true" option | |
#watch( 'config/routes.rb' ) | |
end | |
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do | |
watch('config/application.rb') | |
watch('config/environment.rb') | |
watch(%r{^config/environments/.+\.rb$}) | |
watch(%r{^config/initializers/.+\.rb$}) | |
watch('spec/spec_helper.rb') | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% guard init | |
% guard init bundler | |
% guard init annotate | |
% guard init spork | |
% guard init rspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% bundle exec guard | |
% bundle exec guard -g frontend | |
% bundle exec guard -g backend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment