From a8a12d6d04525eac6e19fed6e2937f05b7abc101 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Fri, 29 Nov 2013 16:11:56 +1100 Subject: [PATCH] Adding some magical guard unicorn sparkles --- Gemfile | 5 +++++ Gemfile.lock | 39 +++++++++++++++++++++++++++++++++++++++ Guardfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 Guardfile diff --git a/Gemfile b/Gemfile index d6d772203f..e91e4dda38 100644 --- a/Gemfile +++ b/Gemfile @@ -86,4 +86,9 @@ end group :development do gem 'pry-debugger' gem 'debugger-linecache' + gem 'guard' + gem 'guard-livereload' + gem 'guard-rails' + gem 'guard-zeus' + gem 'guard-rspec' end diff --git a/Gemfile.lock b/Gemfile.lock index 82921527d5..c28af0d90f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -189,6 +189,8 @@ GEM rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) xpath (~> 1.0.0) + celluloid (0.15.2) + timers (~> 1.1.0) childprocess (0.3.9) ffi (~> 1.0, >= 1.0.11) chunky_png (1.2.8) @@ -237,6 +239,9 @@ GEM devise-encryptable (0.1.2) devise (>= 2.1.0) diff-lcs (1.2.4) + em-websocket (0.5.0) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0.5.3) erubis (2.7.0) eventmachine (1.0.3) excon (0.25.3) @@ -267,6 +272,24 @@ GEM fssm (0.2.10) geocoder (1.1.8) gmaps4rails (1.5.6) + guard (2.2.4) + formatador (>= 0.2.4) + listen (~> 2.1) + lumberjack (~> 1.0) + pry (>= 0.9.12) + thor (>= 0.18.1) + guard-livereload (2.0.1) + em-websocket (~> 0.5) + guard (~> 2.0) + multi_json (~> 1.8) + guard-rails (0.4.7) + guard (>= 0.2.2) + guard-rspec (4.0.4) + guard (>= 2.1.1) + rspec (~> 2.14) + guard-zeus (0.0.1) + guard + zeus haml (4.0.4) tilt highline (1.6.18) @@ -294,6 +317,11 @@ GEM letter_opener (1.0.0) launchy (>= 2.0.4) libv8 (3.16.14.3) + listen (2.2.0) + celluloid (>= 0.15.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + lumberjack (1.0.4) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) @@ -364,6 +392,9 @@ GEM actionpack (~> 3.0) activerecord (~> 3.0) polyamorous (~> 0.5.0) + rb-fsevent (0.9.3) + rb-inotify (0.9.2) + ffi (>= 0.5.0) rdoc (3.12.2) json (~> 1.4) ref (1.0.5) @@ -427,6 +458,7 @@ GEM thor (0.18.1) tilt (1.4.1) timecop (0.6.2.2) + timers (1.1.0) treetop (1.4.15) polyglot polyglot (>= 0.3.1) @@ -460,6 +492,8 @@ GEM websocket (1.0.7) xpath (1.0.0) nokogiri (~> 1.3) + zeus (0.13.3) + method_source (>= 0.6.7) PLATFORMS ruby @@ -484,6 +518,11 @@ DEPENDENCIES faker geocoder gmaps4rails + guard + guard-livereload + guard-rails + guard-rspec + guard-zeus haml jquery-rails json_spec diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000000..19f09f30d4 --- /dev/null +++ b/Guardfile @@ -0,0 +1,50 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +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|png|jpg))).*}) { |m| "/assets/#{m[3]}" } +end + + +guard 'rails' do + watch('Gemfile.lock') + watch(%r{^(config|lib)/.*}) +end + + +guard 'zeus' do + # uses the .rspec file + # --colour --fail-fast --format documentation --tag ~slow + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^app/(.+)\.haml$}) { |m| "spec/#{m[1]}.haml_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/requests/#{m[1]}_spec.rb"] } +end + +guard :rspec do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { "spec" } + + # Rails example + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |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|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" } + + # Turnip features and steps + watch(%r{^spec/acceptance/(.+)\.feature$}) + watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } +end +