ackama / rails-template

Application template for Rails 7 projects; preloaded with best practices for TDD, security, deployment, and developer productivity.
Other
294 stars 15 forks source link

fix: use a safer `gsub_file` and update/remove file gsubs that were no longer doing anything #533

Closed G-Rath closed 6 months ago

G-Rath commented 6 months ago

So it turns out that gsub_file does not actually check if it matched anything and so we have a few misc. changes silently not being applied due to changes in Rails 7.1.

This addresses that by switching us to use gsub_file! which reads the file into memory before it's gsub'd and then compares the results to make sure it actually changed.

I've opened https://github.com/rails/thor/issues/874 to add this to Thor itself