Welcome to the blog/wiki/zettelkasten of Sebastian Hoß. The latest article is displayed below, for older articles either pick one from the navigation or take a look at the sitemap.

The source code for this site can be found at https://github.com/metio/seb.

Executable READMEs View article history Edit article

Published:
Talks about: , , , and

README file typically contain information about the project itself, e.g. how it can be installed/used/build. Most of the time these files contains command line instructions that users/contributors copy and paste into their terminal. Instead of doing that, consider placing a Makefile in the root of your project which contains the exact same instructions. Thanks to make, all your contributors can now use TAB-completion to run any of the pre-defined make targets.

The following example is part of one of my projects, and I certainly don’t want to type (or even copy) that all the time:

.PHONY: release-into-local-nexus
release-into-local-nexus:
	mvn versions:set \
	   -DnewVersion=$(TIMESTAMPED_VERSION) \
	   -DgenerateBackupPoms=false
	-mvn clean deploy scm:tag \
	   -DpushChanges=false \
	   -DskipLocalStaging=true \
	   -Drelease=local
	mvn versions:set \
	   -DnewVersion=9999.99.99-SNAPSHOT \
	   -DgenerateBackupPoms=false

With the above target in place, everyone can now do make release-into-local-nexus instead of typing/copying the commands themselves. Thanks to TAB-completion you just have to do make r<TAB> and confirm with >ENTER> to perform a release.