Skip to content

Commit 34e6427

Browse files
committed
Add auto-generated help for the available Makefile commands
1 parent 18b2f48 commit 34e6427

1 file changed

Lines changed: 15 additions & 21 deletions

File tree

Makefile

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,33 @@
11
.PHONY: help
22
.DEFAULT_GOAL := help
3-
43
$(VERBOSE).SILENT:
54

6-
help:
7-
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
8-
cut -d: -f2- | \
9-
sort -d | \
10-
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-16s\033[0m %s\n", $$1, $$2}'
11-
12-
.PHONY: up down test phpstan cs cs-fix composer-install composer-update release
5+
help: ## Print the help screen
6+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
137

14-
up:
8+
up: ## Start the Docker-based web server in order to try out the examples
159
docker-compose -f docker-compose.examples.yml stop --timeout=2 && docker-compose -f docker-compose.examples.yml up -d
1610

17-
down:
11+
down: ## Stop the Docker-based web server
1812
docker-compose -f docker-compose.examples.yml stop --timeout=2
1913

20-
test:
14+
composer-install: ## Install Composer dependencies
15+
docker run --rm --interactive --tty --volume $(PWD):/app --user $(id -u):$(id -g) composer install --ignore-platform-reqs
16+
17+
composer-update: ## Update Composer dependencies
18+
docker run --rm --interactive --tty --volume $(PWD):/app --user $(id -u):$(id -g) composer update --ignore-platform-reqs
19+
20+
test: ## Run PHPUnit for the unit tests
2121
docker-compose run --rm --no-deps worm-php /bin/sh -c "./vendor/bin/phpunit"
2222

23-
phpstan:
23+
phpstan: ## Run PHPStan to perform static analysis
2424
docker-compose run --rm --no-deps worm-php /bin/sh -c "./vendor/bin/phpstan analyse --level 7 src tests"
2525

26-
cs:
26+
cs: ## Run PHP CodeSniffer to detect issues with coding style
2727
docker-compose run --rm --no-deps worm-php /code/vendor/bin/phpcs --standard=/code/phpcs.xml
2828

29-
cs-fix:
29+
cs-fix: ## Run PHPCBF to automatically fix issues with coding style
3030
docker-compose run --rm --no-deps worm-php /code/vendor/bin/phpcbf --standard=/code/phpcs.xml
3131

32-
composer-install:
33-
docker run --rm --interactive --tty --volume $(PWD):/app --user $(id -u):$(id -g) composer install --ignore-platform-reqs
34-
35-
composer-update:
36-
docker run --rm --interactive --tty --volume $(PWD):/app --user $(id -u):$(id -g) composer update --ignore-platform-reqs
37-
38-
release: test phpstan cs
32+
release: test phpstan cs ## Release a new version of the library
3933
./vendor/bin/releaser release

0 commit comments

Comments
 (0)