From 2f94c0aa38aa291acfb72652df42814f70bff728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Wed, 27 Aug 2014 13:46:18 +0300 Subject: [PATCH] Introduced guard --- Gemfile | 5 +++++ Gemfile.lock | 44 ++++++++++++++++++++++++++++++++++++++++++++ Guardfile | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 Guardfile diff --git a/Gemfile b/Gemfile index 975b962fb..83d54f438 100644 --- a/Gemfile +++ b/Gemfile @@ -57,6 +57,11 @@ group :development do # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', '~> 0.4.0' + + gem 'guard', '~> 2.6.1' + + gem 'guard-rspec', '~> 4.3.1' + gem 'guard-rubocop', '~> 1.1.0' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 876fcd7cb..d24fe77af 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -28,6 +28,7 @@ GEM thread_safe (~> 0.1) tzinfo (~> 1.1) arel (5.0.1.20140414130214) + ast (2.0.0) bootstrap-sass (3.2.0.1) sass (~> 3.2) builder (3.2.2) @@ -40,6 +41,8 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) + celluloid (0.15.2) + timers (~> 1.1.0) cliver (0.3.2) coderay (1.1.0) coffee-rails (4.0.1) @@ -61,6 +64,20 @@ GEM fabrication (2.11.3) faker (1.3.0) i18n (~> 0.5) + ffi (1.9.3) + formatador (0.2.5) + guard (2.6.1) + formatador (>= 0.2.4) + listen (~> 2.7) + lumberjack (~> 1.0) + pry (>= 0.9.12) + thor (>= 0.18.1) + guard-rspec (4.3.1) + guard (~> 2.1) + rspec (>= 2.14, < 4.0) + guard-rubocop (1.1.0) + guard (~> 2.0) + rubocop (~> 0.20) haml (4.0.5) tilt haml-rails (0.5.3) @@ -82,6 +99,11 @@ GEM kgio (2.9.2) libv8 (3.16.14.3) libxml-ruby (2.7.0) + listen (2.7.9) + celluloid (>= 0.15.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + lumberjack (1.0.9) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) @@ -92,6 +114,9 @@ GEM multi_json (1.10.1) nokogiri (1.6.2.1) mini_portile (= 0.6.0) + parser (2.2.0.pre.4) + ast (>= 1.1, < 3.0) + slop (~> 3.4, >= 3.4.5) pg (0.17.1) phantomjs (1.9.7.1) poltergeist (1.5.1) @@ -100,6 +125,7 @@ GEM multi_json (~> 1.0) websocket-driver (>= 0.2.0) polyglot (0.3.5) + powerpack (0.0.9) pry (0.10.1) coderay (~> 1.1.0) method_source (~> 0.8.1) @@ -125,11 +151,19 @@ GEM activesupport (= 4.1.4) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) + rainbow (2.0.0) raindrops (0.13.0) rake (10.3.2) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) rdoc (4.1.1) json (~> 1.4) ref (1.0.5) + rspec (3.0.0) + rspec-core (~> 3.0.0) + rspec-expectations (~> 3.0.0) + rspec-mocks (~> 3.0.0) rspec-core (3.0.4) rspec-support (~> 3.0.0) rspec-expectations (3.0.4) @@ -146,6 +180,12 @@ GEM rspec-mocks (~> 3.0.0) rspec-support (~> 3.0.0) rspec-support (3.0.4) + rubocop (0.25.0) + parser (>= 2.2.0.pre.4, < 3.0) + powerpack (~> 0.0.6) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.4) + ruby-progressbar (1.5.1) sass (3.2.19) sass-rails (4.0.3) railties (>= 4.0.0, < 5.0) @@ -175,6 +215,7 @@ GEM thor (0.19.1) thread_safe (0.3.4) tilt (1.4.1) + timers (1.1.0) treetop (1.4.15) polyglot polyglot (>= 0.3.1) @@ -205,6 +246,9 @@ DEPENDENCIES epp (~> 1.4.0) fabrication (~> 2.11.3) faker (~> 1.3.0) + guard (~> 2.6.1) + guard-rspec (~> 4.3.1) + guard-rubocop (~> 1.1.0) haml-rails (~> 0.5.3) isikukood jbuilder (~> 2.0) diff --git a/Guardfile b/Guardfile new file mode 100644 index 000000000..a3419fe1e --- /dev/null +++ b/Guardfile @@ -0,0 +1,43 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +# Note: The cmd option is now required due to the increasing number of ways +# rspec may be run, below are examples of the most common uses. +# * bundler: 'bundle exec rspec' +# * bundler binstubs: 'bin/rspec' +# * spring: 'bin/rsspec' (This will use spring if running and you have +# installed the spring binstubs per the docs) +# * zeus: 'zeus rspec' (requires the server to be started separetly) +# * 'just' rspec: 'rspec' +group :red_green_refactor, halt_on_fail:true do + guard :rspec, cmd: 'bundle exec 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" } + watch('spec/rails_helper.rb') { "spec" } + + # epp tests + watch('app/helpers/epp/contacts_helper.rb') { 'spec/epp/contact_spec.rb' } + watch('app/helpers/epp/domains_helper.rb') { 'spec/epp/domain_spec.rb' } + # 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 + + # Disabled rubocop in guard until old offenses are removed to reduce visual clutter + # guard :rubocop do + # watch(%r{.+\.rb$}) + # watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) } + # end +end