While switching between projects I’ve been looking for a way to make sure I can run all the services necessary without worrying about the subtle differences between codebases.
I use the following
bin scripts to help.
Setup & Updating
The prepare script is a recent addition to my arsenal although it is generated in new Rails apps.
The setup script is not only useful when setting up the project for the first time, but also when updating the project. For instance after adding a new gem, a new NPM package or after creating a database migration.
asdf install line in this script makes sure I have the correct versions of Ruby and Node available. Again these work well for new and updated applications.
The setup script also includes a
rails db:prepare. This is a Rails 6 addition that will handle creating a new database or updating the database. This article explains the functionality.
My typical Rails project will have job queues and use webpacker. To get all of these running normally requires running
bin/webpack-dev-server each in a separate window.
To make life even easier I wrap all of this into one script
This script will no doubt be marmite, I both love and hate it.
I like to use translations as much as possible throughout my applications so
i18n-tasks gem is really handy for keeping the locale yml files at peace as well as checking for missing translations.