diff --git a/.rubocop.yml b/.rubocop.yml index 559bd75..66c747e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,10 +15,6 @@ Style/ClassAndModuleChildren: Style/Documentation: Enabled: false -Style/EmptyLines: - Exclude: - - config/initializers/sorcery.rb - Style/ExtraSpacing: Exclude: - db/migrate/**/* diff --git a/Gemfile.lock b/Gemfile.lock index d5abb39..c87d760 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -145,7 +145,7 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - parser (2.3.1.2) + parser (2.3.1.3) ast (~> 2.2) pkg-config (1.1.7) powerpack (0.1.1) diff --git a/Guardfile b/Guardfile index d78c84d..b3d8f11 100644 --- a/Guardfile +++ b/Guardfile @@ -1,35 +1,83 @@ -guard 'livereload' do - watch(%r{app/assets/.+\.(scss|css|js|erb)}) - watch(%r{app/views/.+\.(erb|haml|slim)$}) - watch(%r{app/controllers/.+\.rb}) - watch(%r{app/helpers/.+\.rb}) - watch(%r{public/.+\.(css|js|html)}) - watch(%r{config/locales/.+\.yml}) +# frozen_string_literal: true +# A sample Guardfile +# More info at https://github.com/guard/guard#readme - # Rails Assets Pipeline - watch(%r{(app|vendor)(/assets/\w+/(.+\.(scss|css|js|erb|html|png|jpg))).*}) do |m| - "/assets/#{m[3]}" +## Uncomment and set this to only include directories you want to watch +# directories %w(app lib config test spec features) \ +# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")} + +## Note: if you are using the `directories` clause above and you are not +## watching the project directory ('.'), then you will want to move +## the Guardfile to a watched dir and symlink it back, e.g. +# +# $ mkdir config +# $ mv Guardfile config/ +# $ ln -s config/Guardfile . +# +# and, you'll have to watch "config/Guardfile" instead of "Guardfile" + +guard 'livereload' do + extensions = { + css: :css, + scss: :css, + sass: :css, + js: :js, + coffee: :js, + html: :html, + png: :png, + gif: :gif, + jpg: :jpg, + jpeg: :jpeg, + # less: :less, # uncomment if you want LESS stylesheets done in browser + } + + rails_view_exts = %w(erb haml slim) + + # file types LiveReload may optimize refresh for + compiled_exts = extensions.values.uniq + watch(%r{public/.+\.(#{compiled_exts * '|'})}) + + extensions.each do |ext, type| + watch(%r{ + (?:app|vendor) + (?:/assets/\w+/(?[^.]+) # path+base without extension + (?\.#{ext})) # matching extension (must be first encountered) + (?:\.\w+|$) # other extensions + }x) do |m| + path = m[1] + "/assets/#{path}.#{type}" + end end + + # file needing a full reload of the page anyway + watch(%r{app/views/.+\.(#{rails_view_exts * '|'})$}) + watch(%r{app/(helpers|controllers)/.+\.rb}) + watch(%r{config/locales/.+\.yml}) end -guard :minitest, spring: true, all_after_pass: true do +guard :minitest, spring: "bin/rails test", all_after_pass: true do + watch(%r{^app/(.+)\.rb$}) { |m| ["test/#{m[1]}", "test/#{m[1]}_test.rb"] } + watch(%r{^app/controllers/(admin|application)_controller\.rb$}) { 'test/controllers' } + watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" } + watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" } + watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" } watch(%r{^test/test_helper\.rb$}) { 'test' } - watch(%r{^test/(.*)\/?(.*)_test\.rb$}) - - # run tests when touching files matching: /app/**/*.rb - watch(%r{^app/(.*/)?([^/]+)\.rb$}) { |m| ["test/#{m[1]}#{m[2]}_test.rb", "test/#{m[1]}#{m[2]}"] } - - # run tests when touching files matching: /lib/**/*.rb - watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| ["test/lib/#{m[1]}#{m[2]}_test.rb", "test/lib/#{m[1]}#{m[2]}"] } - + watch(%r{^test/.+_test\.rb$}) # run controller/integration test when touching erb files watch(%r{^app/views/((?!_mailer).)*([^/]+)\.erb$}) { ["test/controllers", "test/integration"] } - # run mailers/integration test when touching mailer erb files watch(%r{^app/views/(.*_mailer/)?([^/]+)\.erb$}) { ["test/mailers", "test/integration"] } end -guard :rubocop do +# ESLint +guard :shell, all_on_start: true do + watch %r{app/assets/javascripts/*/.*} do |file| + system %(echo "ESLint:\033[32m #{file[0]}\033[0m") + system %(eslint #{file[0]}) + end +end + +guard :rubocop, cli: %w(-D -S) do watch(/.+\.rb$/) watch(/Rakefile/) watch(/.rubocop.yml/) diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js deleted file mode 100644 index 71ee1e6..0000000 --- a/app/assets/javascripts/cable.js +++ /dev/null @@ -1,13 +0,0 @@ -// Action Cable provides the framework to deal with WebSockets in Rails. -// You can generate new channels where WebSocket features live using the rails generate channel command. -// -//= require action_cable -//= require_self -//= require_tree ./channels - -(function() { - this.App || (this.App = {}); - - App.cable = ActionCable.createConsumer(); - -}).call(this); diff --git a/app/assets/javascripts/channels/.keep b/app/assets/javascripts/channels/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb deleted file mode 100644 index d672697..0000000 --- a/app/channels/application_cable/channel.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Channel < ActionCable::Channel::Base - end -end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb deleted file mode 100644 index 0ff5442..0000000 --- a/app/channels/application_cable/connection.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Connection < ActionCable::Connection::Base - end -end diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb deleted file mode 100644 index a009ace..0000000 --- a/app/jobs/application_job.rb +++ /dev/null @@ -1,2 +0,0 @@ -class ApplicationJob < ActiveJob::Base -end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb deleted file mode 100644 index 286b223..0000000 --- a/app/mailers/application_mailer.rb +++ /dev/null @@ -1,4 +0,0 @@ -class ApplicationMailer < ActionMailer::Base - default from: 'from@example.com' - layout 'mailer' -end diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/test/mailers/.keep b/test/mailers/.keep deleted file mode 100644 index e69de29..0000000