Skip to content

Instantly share code, notes, and snippets.

Created December 28, 2012 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4393980 to your computer and use it in GitHub Desktop.
Save anonymous/4393980 to your computer and use it in GitHub Desktop.
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
#guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
# watch('config/application.rb')
# watch('config/environment.rb')
# watch('config/environments/test.rb')
# watch(%r{^config/initializers/.+\.rb$})
# watch('Gemfile')
# watch('Gemfile.lock')
# watch('spec/spec_helper.rb') { :rspec }
# watch('test/test_helper.rb') { :test_unit }
# watch(%r{features/support/}) { :cucumber }
#end
guard 'minitest' do # , :drb => true
# with Minitest::Unit
watch(%r|^test/(.*)\/?test_(.*)\.rb|)
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r|^test/test_helper\.rb|) { "test" }
#Why are the above test files flipped around?
watch(%r|^test/(.*)\/?(.*)_test\.rb|)
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
watch(%r|^test/minitest_helper\.rb|) { "test" }
# with Minitest::Spec
# watch(%r|^spec/(.*)_spec\.rb|)
# watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
# watch(%r|^spec/spec_helper\.rb|) { "spec" }
# Rails 3.2
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
watch(%r|^app/models/(.*)\.rb|) { |m| "test/models/#{m[1]}_test.rb" }
# Rails
# watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/functional/#{m[1]}_test.rb" }
# watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
# watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
end
guard 'annotate', :tests => true, :run_at_start => false, :show_indexes => true do
watch( 'db/schema.rb' )
# Uncomment the following line if you also want to run annotate anytime
# 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 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html))).*}) { |m| "/assets/#{m[3]}" }
end
guard 'rails_best_practices' , :run_at_start=> true do
watch(%r{^app/(.+)\.rb$})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment