diff --git a/template.rb b/template.rb index 853c9d7b..e4f7d490 100644 --- a/template.rb +++ b/template.rb @@ -110,7 +110,7 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met # The block passed to "after_bundle" seems to run after `bundle install` # but also after `shakapacker:install` and after Rails has initialized the git # repo - after_bundle do + after_bundle do # rubocop:disable Metrics/BlockLength # Remove the `test/` directory because we always use RSpec which creates # its own `spec/` directory remove_dir "test" @@ -193,6 +193,13 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met git add: "-A ." git commit: "-n -m 'Set up erblint'" + # Run strong_migrations generator near the end so that it doesn't block + # other parts of the template from creating migrations. + run_with_clean_bundler_env "bundle exec rails g strong_migrations:install" + run_with_clean_bundler_env "bundle exec rubocop -A -c ./.rubocop.yml" + git add: "-A ." + git commit: "-n -m 'Set up strong_migrations'" + # Run the README template at the end because it introspects the app to # discover rake tasks etc. apply_readme_template diff --git a/variants/backend-base/Gemfile.tt b/variants/backend-base/Gemfile.tt index 808e12e1..cecab073 100644 --- a/variants/backend-base/Gemfile.tt +++ b/variants/backend-base/Gemfile.tt @@ -35,6 +35,9 @@ gem "stimulus-rails" # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] # gem "image_processing", "~> 1.2" +# Protect against accidentally slow migrations +gem "strong_migrations" + group :development do gem "letter_opener" diff --git a/variants/frontend-base/template.rb b/variants/frontend-base/template.rb index e16da4d9..4618e30d 100644 --- a/variants/frontend-base/template.rb +++ b/variants/frontend-base/template.rb @@ -25,7 +25,6 @@ # Configure app/frontend run "mv app/javascript app/frontend" - copy_file "config/webpack/webpack.config.js", force: true gsub_file "config/shakapacker.yml", "source_entry_path: /", "source_entry_path: packs", force: true