Hi everyone. I was wondering if any of you ever has experienced the use the “make” utiliity for project tasks?
It’s a simple technique that I’ve learnt in my previous job 10 years ago, that I’m still using today with my team. I’m loving it so much that I cannot resist to share it with you all.
The idea is to wrap main project commands (related to build, test, setup…) in a Makefile with (phony) targets. It has several advantages:
- leveraging muscle memory to speed up repetitive actions around project contributions
- documenting the “entry points” for contributors without writing to much bash scripts
- reducing cognitive load between projects, because most of the tasks often have the same name
Here how it can look like in real life:
# Makefile
.PHONY: install update ci test
# Install gems & deps
install:
bundle install
npm install
# Update gems & dependencies
update: install
bundle update
npm update
# Launch CI checks
ci:
./script/ci
# Launch automated tests only
test:
bundle exec rake
You can then use any of the previously described tasks like that:
make install
make update
make test
make ci
It’s so simple that even on projects on which I contribute, I create this file without commiting it, to help me go faster.
Is it just a personnal taste, or do you think it would benefit to others?
Let me know!
Cheers, Edouard