Skip to content

Instantly share code, notes, and snippets.

@theo-bittencourt
Last active December 28, 2015 07:49
Show Gist options
  • Save theo-bittencourt/7467150 to your computer and use it in GitHub Desktop.
Save theo-bittencourt/7467150 to your computer and use it in GitHub Desktop.
.Guarfile
begin
require 'guard/zeus'
guard :zeus do
watch(%r{^config/initializers/.+\.rb$})
watch(%r{^config/environments/.+\.rb$})
watch(%r{^Gemfile.lock$})
end
rescue LoadError
nil
end
begin
require "guard/rails"
guard :rails, zeus: true do
watch(%r{^config/initializers/.+\.rb$})
watch(%r{^config/environments/.+\.rb$})
watch(%r{^Gemfile.lock$})
end
rescue LoadError
nil
end
begin
require "guard/livereload"
guard :livereload do
watch(%r{app/views/.+\.(erb|haml)$})
watch(%r{^app/controllers/(.+)_(controller)\.rb$})
watch(%r{app/helpers/.+\.rb})
watch(%r{app/decorators/.+\.rb})
watch(%r{app/admin/.+\.rb})
watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r{app/assets/\w+/(.+)\.(css|js|html|haml|sass|scss|coffee).*}) do |m|
ext = m[2]
case m[2]
when 'haml' then ext = '.html'
when 'sass' then ext = '.css'
when 'scss' then ext = '.css'
when 'coffee' then ext = '.js'
end
"/assets/#{m[1] + ext}"
end
end
rescue LoadError
nil
end
begin
require "guard/rspec"
guard :rspec, cmd: 'zeus rspec --tag wip', all_on_start: false, all_after_pass: false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Factory Girl watch
watch(%r{^spec/factories/.+\.rb$})
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_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('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara features specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
end
rescue LoadError
nil
end
begin
require "guard/bundler"
guard :bundler do
watch('Gemfile')
end
rescue LoadError
nil
end
begin
require "guard/shell"
guard :shell do
watch('patentes') { `touch /Users/theo/dev/rede-proprietas/lib/tasks/patentes_simblink` }
watch('patentes_simblink') { `ruby parse_patentes.rb` }
watch('parse_patentes.rb') { `ruby parse_patentes.rb` }
end
rescue LoadError
nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment