Skip to content

Commit

Permalink
Adds strong_migrations gem. Closes #214 (#281)
Browse files Browse the repository at this point in the history
Have tested this different variants, and all of the existing default
migrations pass without errors.

---------

Co-authored-by: Dave Park <[email protected]>
Co-authored-by: Eoin Kelly <[email protected]>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent 62446f3 commit 2c31cef
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions variants/backend-base/Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion variants/frontend-base/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2c31cef

Please sign in to comment.