I don't think that I set up cloned rails projects that often, but it now happens often enough that I need a checklist.
So this is my general checklist after I have cloned the repo
1) Set the correct ruby version. I use asdf-vm to manage my ruby and JS version. It can also manage other languages, but these two are my main. I also typically want any changes I make to the ruby version to be local to that project only. Which asdf can do through the command asdf local language version # => asdf local ruby 2.7.4
2) bundle install
. This one is obvious, but I normally run it first and get the error that I'm on the wrong ruby version, so I have to place it as the second step to remind myself.
3) yarn install
. Most projects I know will use some JS libraries and this will install them all.
4) Assuming bundle install went off without issue, rails db:setup
is typically my next step. I have postgres installed locally and most of the projects I have met this year all use it. This should initialize the databases that the project will be using for development and testing.
5) rails db:migrate
I don't know about you, but I keep forgetting to run migrations. So this is a crucial step. Be better than me. Remember to run migrations.
5.1) I have met projects where I was given a DBDump so that I have some test data to work with. So this is the part where you add that data to your DB. on postgres it would be something like psql YourDB < /path/to/dump/
Alternatively, the project may have seed files defined in which case run rails db:seed
6) Now you have the correct libraries, and data in the DB it's time to start the server. Far as I have seen (probably not that far), most major projects use the a Procfile defining the processes that should be running. The Procfile is fed to the Foreman gem to initialize the server with background processes running as well. If that is the case, first thing you then need to do is install the foreman gem gem install foreman
. Once that is set up you can run foreman start -f /path/to/Procfile
If however the project does not use a Procfile, good ol' rails s
will start the server and you should be good to go.
I may have missed a couple steps, but this is my general process to getting started. What's yours? lmk in the comments.