Created
September 27, 2011 17:44
-
-
Save nerdyworm/1245720 to your computer and use it in GitHub Desktop.
Guard file change
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
# Utility Group | |
# | |
# bundler | |
# jammit | |
# migrate | |
group "util" do | |
guard 'bundler' do | |
watch('Gemfile') | |
end | |
guard 'jammit' do | |
watch(%r{'^public/javascripts/(.*)\.js'}) | |
watch(%r{'^public/stylesheets/(.*)\.css'}) | |
end | |
guard 'migrate' do | |
watch(%r{^db/migrate/(\d+).+\.rb}) | |
end | |
end | |
# Development Group | |
# | |
# rspec | |
# - watches for changes in apps and specs | |
# | |
# cucumber @wip | |
# - only watches changes to features | |
# | |
# [enter] key to run all | |
# | |
group "dev" do | |
guard 'rspec', :version => 1, :cli => '--color --format nested --loadby mtime', :all_on_start => false, :all_after_pass => false 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/#{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" } | |
# Run all controllers? | |
watch('app/controllers/application_controller.rb') { "spec/controllers" } | |
# Capybara request specs | |
# We don't actually have any of these | |
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } | |
end | |
guard 'cucumber', :all_on_start => false, :all_after_pass => false, :cli => '-pwip --color --format progress' do | |
watch(%r{^features/.+\.feature$}) | |
watch(%r{^features/support/.+$}) { 'features' } | |
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } | |
end | |
end | |
# Slow group | |
# | |
# test::unit | |
# cucumber ~@wip | |
# | |
# does not watch for changes in app folders | |
group 'slow' do | |
guard 'test', :all_on_start => false, :all_after_pass => false do | |
# We only want to watch the test directory for changes i.e. don't run while we are working in app/ | |
watch(%r{^test/(.*)_test.rb}) | |
end | |
guard 'cucumber', :all_on_start => false, :all_after_pass => false, :cli => '-ok --color --format progress --strict' do | |
watch(%r{^features/.+\.feature$}) | |
watch(%r{^features/support/.+$}) { 'features' } | |
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment