From a90a1f5f75dd375edfd8c170433ff2cf24ead0fe Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Sun, 23 Aug 2026 11:36:36 +0200 Subject: [PATCH] initialize on first make run instead of calling the inti script manually, make it a "make" operation like everything else. --- Makefile | 12 +++++++++++- doc_topics/01-introduction.md | 2 +- init.sh | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a05fc71..50f8655 100644 --- a/Makefile +++ b/Makefile @@ -12,10 +12,20 @@ TAB=$(shell printf "\t") DEV_ROCKS = "busted" "luacheck" "ldoc" "luacov" -target_not_specified: help +target_not_specified: +ifneq (,$(wildcard ./init.sh)) + @$(MAKE) init +else + @$(MAKE) help +endif @exit 1 +.PHONY: init +init: + @if [ -f ./init.sh ]; then ./init.sh; else echo "Already initialized. Run 'make help' for available targets."; fi + + help: @echo "Available make targets for ${ROCK_NAME}:" @echo "" diff --git a/doc_topics/01-introduction.md b/doc_topics/01-introduction.md index 0bf3a61..621375e 100644 --- a/doc_topics/01-introduction.md +++ b/doc_topics/01-introduction.md @@ -42,7 +42,7 @@ Here's a list of things to do when using this template: * Clone the repo locally. -* Run the interactive `init.sh` script. +* Run `make` and follow the interactive prompts to initialize the repo. * Commit all changes, and push to the repo. diff --git a/init.sh b/init.sh index 05d3760..1b1d8c3 100755 --- a/init.sh +++ b/init.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# No need to run this script manually; just run `make` and it will be +# invoked automatically on first use, and then deleted. + REPO_NAME=$(basename "$(git rev-parse --show-toplevel)") GH_ACCOUNT=$(git remote -v | grep "(fetch)" | sed "s/ (fetch)//" | sed "s/^.*github.com\///" | sed "s/\/.*$//") USER_NAME=$(git config user.name)