diff --git a/Gemfile b/Gemfile index 1db15e7..61224c6 100644 --- a/Gemfile +++ b/Gemfile @@ -33,6 +33,8 @@ group :development do gem "web-console" gem "rack-mini-profiler" gem "mina" + gem 'guard-rails' + gem 'guard-rspec' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 8a0907a..5e35626 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -82,6 +82,7 @@ GEM regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) childprocess (4.1.0) + coderay (1.1.3) concurrent-ruby (1.1.10) crass (1.0.6) debug (1.4.0) @@ -94,8 +95,26 @@ GEM erubi (1.10.0) erubis (2.7.0) ffi (1.15.5) + formatador (1.1.0) globalid (1.0.0) activesupport (>= 5.0) + guard (2.18.0) + formatador (>= 0.2.4) + listen (>= 2.7, < 4.0) + lumberjack (>= 1.0.12, < 2.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.13.0) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-rails (0.8.1) + guard (~> 2.11) + guard-compat (~> 1.0) + guard-rspec (4.7.3) + guard (~> 2.1) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) haml (5.2.2) temple (>= 0.8.0) tilt @@ -123,9 +142,13 @@ GEM io-wait (0.2.1) irb (1.4.1) reline (>= 0.3.0) + listen (3.7.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) loofah (2.15.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) + lumberjack (1.2.8) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.2) @@ -141,6 +164,7 @@ GEM minitest (5.15.0) msgpack (1.4.5) multi_xml (0.6.0) + nenv (0.3.0) net-imap (0.2.3) digest net-protocol @@ -160,10 +184,16 @@ GEM nio4r (2.5.8) nokogiri (1.13.3-x86_64-linux) racc (~> 1.4) + notiffany (0.1.3) + nenv (~> 0.1) + shellany (~> 0.0) open4 (1.3.4) passenger (6.0.13) rack rake (>= 0.8.1) + pry (0.14.1) + coderay (~> 1.1) + method_source (~> 1.0) public_suffix (4.0.6) racc (1.6.0) rack (2.2.3) @@ -198,10 +228,17 @@ GEM thor (~> 1.0) zeitwerk (~> 2.5) rake (13.0.6) + rb-fsevent (0.11.1) + rb-inotify (0.10.1) + ffi (~> 1.0) regexp_parser (2.2.1) reline (0.3.1) io-console (~> 0.5) rexml (3.2.5) + rspec (3.11.0) + rspec-core (~> 3.11.0) + rspec-expectations (~> 3.11.0) + rspec-mocks (~> 3.11.0) rspec-core (3.11.0) rspec-support (~> 3.11.0) rspec-expectations (3.11.0) @@ -235,6 +272,7 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2) sexp_processor (4.16.0) + shellany (0.0.1) sprockets (4.0.3) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -276,6 +314,8 @@ DEPENDENCIES capybara debug dnsimple + guard-rails + guard-rspec haml-rails high_voltage (~> 3.1) importmap-rails diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..237a689 --- /dev/null +++ b/Guardfile @@ -0,0 +1,31 @@ +command = "rspec" +begin + require "rubygems" + require "spring/version" #safe to try + command = "spring rspec" + puts "Using Spring loaded rspec" +rescue LoadError +end +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('app/models/basket.rb') { Dir["spec/models/baskets/*_spec.rb"] } + watch('app/controllers/baskets_controller.rb') { Dir["spec/features/baskets/*_spec.rb"] } + + # Capybara features specs + watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" } + + # locales + watch(%r{^config/locales/.*yml}) { |m| "spec/i18n_spec.rb" } +end