diff --git a/CHANGELOG.md b/CHANGELOG.md index 18fc7c7..63f40c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Bug #260: Fix psalm cache directory in configuration file (@vjik) - Enh #260, #265: Update composer dependencies and refactor to replace use of deprecated classes (@vjik) - Chg #265: Refactor `PresenterInterface` and implementations for preparing data only (@vjik) +- Enh #266: Add grouping to `make` help output (@Xakki, @samdark) ## 1.1.0 December 22, 2025 diff --git a/Makefile b/Makefile index 7b87580..3c7b3f0 100644 --- a/Makefile +++ b/Makefile @@ -26,53 +26,57 @@ DOCKER_COMPOSE_TEST := docker compose -f docker/compose.yml -f docker/test/compo # ifeq ($(PRIMARY_GOAL),build) -build: ## Build docker images +build: ## Build docker images. $(DOCKER_COMPOSE_DEV) build $(CLI_ARGS) endif ifeq ($(PRIMARY_GOAL),up) -up: ## Up the dev environment +up: ## Up the dev environment. $(DOCKER_COMPOSE_DEV) up -d --remove-orphans endif ifeq ($(PRIMARY_GOAL),down) -down: ## Down the dev environment +down: ## Down the dev environment. $(DOCKER_COMPOSE_DEV) down --remove-orphans endif ifeq ($(PRIMARY_GOAL),stop) -stop: ## Stop the dev environment +stop: ## Stop the dev environment. $(DOCKER_COMPOSE_DEV) stop endif ifeq ($(PRIMARY_GOAL),clear) -clear: ## Remove development docker containers and volumes +clear: ## Remove development docker containers and volumes. $(DOCKER_COMPOSE_DEV) down --volumes --remove-orphans endif ifeq ($(PRIMARY_GOAL),shell) -shell: ## Get into container shell +shell: ## Get into container shell. $(DOCKER_COMPOSE_DEV) exec app /bin/bash endif +# +# Tools +# + ifeq ($(PRIMARY_GOAL),yii) -yii: ## Execute Yii command +yii: ## Execute Yii command. $(DOCKER_COMPOSE_DEV) run --rm app ./yii $(CLI_ARGS) .PHONY: yii endif ifeq ($(PRIMARY_GOAL),composer) -composer: ## Run Composer +composer: ## Run Composer. $(DOCKER_COMPOSE_DEV) run --rm app composer $(CLI_ARGS) endif ifeq ($(PRIMARY_GOAL),rector) -rector: ## Run Rector +rector: ## Run Rector. $(DOCKER_COMPOSE_DEV) run --rm app ./vendor/bin/rector $(CLI_ARGS) endif ifeq ($(PRIMARY_GOAL),cs-fix) -cs-fix: ## Run PHP CS Fixer +cs-fix: ## Run PHP CS Fixer. $(DOCKER_COMPOSE_DEV) run --rm app ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff endif @@ -81,27 +85,27 @@ endif # ifeq ($(PRIMARY_GOAL),test) -test: +test: ## Run tests. $(DOCKER_COMPOSE_TEST) run --rm app ./vendor/bin/codecept run $(CLI_ARGS) endif ifeq ($(PRIMARY_GOAL),test-coverage) -test-coverage: +test-coverage: ## Run tests with coverage. $(DOCKER_COMPOSE_TEST) run --rm app ./vendor/bin/codecept run --coverage --coverage-html --disable-coverage-php endif ifeq ($(PRIMARY_GOAL),codecept) -codecept: ## Run Codeception +codecept: ## Run Codeception. $(DOCKER_COMPOSE_TEST) run --rm app ./vendor/bin/codecept $(CLI_ARGS) endif ifeq ($(PRIMARY_GOAL),psalm) -psalm: ## Run Psalm +psalm: ## Run Psalm. $(DOCKER_COMPOSE_DEV) run --rm app ./vendor/bin/psalm $(CLI_ARGS) endif ifeq ($(PRIMARY_GOAL),composer-dependency-analyser) -composer-dependency-analyser: ## Run Composer Dependency Analyser +composer-dependency-analyser: ## Run Composer Dependency Analyser. $(DOCKER_COMPOSE_DEV) run --rm app ./vendor/bin/composer-dependency-analyser --config=composer-dependency-analyser.php $(CLI_ARGS) endif @@ -110,17 +114,17 @@ endif # ifeq ($(PRIMARY_GOAL),prod-build) -prod-build: ## PROD | Build an image +prod-build: ## Build an image. docker build --file docker/Dockerfile --target prod --pull -t ${IMAGE}:${IMAGE_TAG} . endif ifeq ($(PRIMARY_GOAL),prod-push) -prod-push: ## PROD | Push image to repository +prod-push: ## Push image to repository. docker push ${IMAGE}:${IMAGE_TAG} endif ifeq ($(PRIMARY_GOAL),prod-deploy) -prod-deploy: ## PROD | Deploy to production +prod-deploy: ## Deploy to production. @set -euo pipefail; \ docker -H ${PROD_SSH} stack deploy --prune --detach=false --with-registry-auth -c docker/compose.yml -c docker/prod/compose.yml ${STACK_NAME} 2>&1 | tee deploy.log; \ if grep -qiE 'rollback:|update rolled back' deploy.log; then \ @@ -141,7 +145,16 @@ endif # ifeq ($(PRIMARY_GOAL),help) -# Output the help for each task, see https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html help: ## This help. - @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) + @awk 'BEGIN { printf "\nUsage:\n make \033[36m\033[0m\n" } \ + /^#$$/ { blank = 1; next } \ + blank && /^# [a-zA-Z]/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 3); blank = 0; next } \ + /^[a-zA-Z_-]+:([^=]|$$)/ { \ + split($$0, parts, "##"); \ + target = parts[1]; sub(/:.*/, "", target); \ + desc = parts[2]; \ + gsub(/^[[:space:]]+|[[:space:]]+$$/, "", desc); \ + printf " \033[36m%-25s\033[0m %s\n", target, desc; \ + blank = 0; \ + }' $(MAKEFILE_LIST) endif diff --git a/docker/.env b/docker/.env index dd9c326..1e88b05 100644 --- a/docker/.env +++ b/docker/.env @@ -1,14 +1,10 @@ STACK_NAME=app-api -# # Development -# DEV_PORT=80 -# # Production -# PROD_HOST=app-api.example.com PROD_SSH="ssh://docker-web"