Skip to content

Commit 1e293be

Browse files
author
Alcides Ramos
committed
docs(Makefile): improve steps readability
1 parent e566ce4 commit 1e293be

1 file changed

Lines changed: 49 additions & 14 deletions

File tree

Makefile

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ RANDOM_ORDER_SEED := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ")
3939
.PHONY: help
4040
help:
4141
@clear
42-
@echo "╔══════════════════════════════════════════════════════════════════════════════╗"
43-
@echo "║ ║"
44-
@echo "${YELLOW}.:${RESET} AVAILABLE COMMANDS ${YELLOW}:.${RESET}"
45-
@echo "║ ║"
46-
@echo "╚══════════════════════════════════════════════════════════════════════════════╝"
47-
@echo ""
42+
@echo "${BLACK}"
43+
@echo "╔════════════════════════════════════════════════════════════════════════════════════════════════════════╗"
44+
@echo "$(call pad,96)"
45+
@echo "$(call pad,32) ${YELLOW}.:${RESET} AVAILABLE COMMANDS ${YELLOW}:.${BLACK} $(call pad,32)"
46+
@echo "$(call pad,96)"
47+
@echo "╚════════════════════════════════════════════════════════════════════════════════════════════════════════╝"
48+
@echo "${RESET}"
4849
@grep -E '^[a-zA-Z_0-9%-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "· ${YELLOW}%-30s${RESET} %s\n", $$1, $$2}'
4950
@echo ""
5051

@@ -68,38 +69,59 @@ define taskDone
6869
@echo ""
6970
endef
7071

72+
# $(1)=TEXT $(2)=EXTRA
73+
define showInfo
74+
@echo " ${YELLOW}ℹ${RESET} $(1) $(2)"
75+
endef
76+
77+
define pad
78+
$(shell printf "%-$(1)s" " ")
79+
endef
80+
7181
###
7282
# COMPOSER
7383
###
7484

7585
.PHONY: composer-dump
7686
composer-dump: ## [COMPOSER] Executes <composer dump-auto> inside the container
77-
$(DOCKER_RUN_AS_USER) composer dump-auto --ansi --no-plugins --profile --classmap-authoritative --apcu --strict-psr
87+
$(call showInfo,"Executing \<composer dump-auto\>...")
88+
@echo ""
89+
@$(DOCKER_RUN_AS_USER) composer dump-auto --ansi --no-plugins --profile --classmap-authoritative --apcu --strict-psr
7890
$(call taskDone)
7991

8092
.PHONY: composer-install
8193
composer-install: ## [COMPOSER] Executes <composer install> inside the container
82-
$(DOCKER_RUN_AS_USER) composer install --ansi --no-plugins --classmap-authoritative --audit --apcu-autoloader
94+
$(call showInfo,"Executing \<composer install\>...")
95+
@echo ""
96+
@$(DOCKER_RUN_AS_USER) composer install --ansi --no-plugins --classmap-authoritative --audit --apcu-autoloader
8397
$(call taskDone)
8498

8599
.PHONY: composer-remove
86100
composer-remove: require-package ## [COMPOSER] Executes <composer remove> inside the container
87-
$(DOCKER_RUN_AS_USER) composer remove --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies --unused
101+
$(call showInfo,"Executing \<composer remove\>...")
102+
@echo ""
103+
@$(DOCKER_RUN_AS_USER) composer remove --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies --unused
88104
$(call taskDone)
89105

90106
.PHONY: composer-require-dev
91107
composer-require-dev: ## [COMPOSER] Executes <composer require --dev> inside the container
92-
$(DOCKER_RUN_AS_USER) composer require --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies --prefer-stable --sort-packages --dev
108+
$(call showInfo,"Executing \<composer require --dev\>...")
109+
@echo ""
110+
@$(DOCKER_RUN_AS_USER) composer require --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies --prefer-stable --sort-packages --dev
93111
$(call taskDone)
94112

95113
.PHONY: composer-require
96114
composer-require: ## [COMPOSER] Executes <composer require> inside the container
97-
$(DOCKER_RUN_AS_USER) composer require --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies --prefer-stable --sort-packages
115+
$(call showInfo,"Executing \<composer require\>...")
116+
@echo ""
117+
@$(DOCKER_RUN_AS_USER) composer require --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies --prefer-stable --sort-packages
98118
$(call taskDone)
99119

100120
.PHONY: composer-update
101121
composer-update: ## [COMPOSER] Executes <composer update> inside the container
102-
$(DOCKER_RUN_AS_USER) composer update --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies
122+
$(call showInfo,"Executing \<composer update\>...")
123+
@echo ""
124+
@$(DOCKER_RUN_AS_USER) composer update --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies
103125
$(call taskDone)
104126

105127
###
@@ -109,36 +131,49 @@ composer-update: ## [COMPOSER] Executes <composer update> inside the container
109131
.PHONY: check-syntax
110132
check-syntax: ## [QA] Executes <check-syntax> inside the container <filter=[app|path]>
111133
@$(eval filter ?= 'app')
134+
$(call showInfo,"Check code syntax...")
135+
@echo ""
112136
@vendor/bin/parallel-lint --colors -e php -j 10 $(filter)
113137
$(call taskDone)
114138

115139
.PHONY: check-style
116140
check-style: ## [QA] Executes <check-style> inside the container <filter=[app|path]>
117141
@$(eval filter ?= 'app')
142+
$(call showInfo,"Checking code style...")
143+
@echo ""
118144
@vendor/bin/phpcs -p --colors --standard=phpcs.xml $(filter)
119145
$(call taskDone)
120146

121147
.PHONY: fix-style
122148
fix-style: ## [QA] Executes <fix-style> inside the container <filter=[app|path]>
123149
@$(eval filter ?= 'app')
150+
$(call showInfo,"Fixing code style...")
151+
@echo ""
124152
@vendor/bin/phpcbf -p --colors --standard=phpcs.xml $(filter)
125153
$(call taskDone)
126154

127155
.PHONY: phpstan
128156
phpstan: ## [QA] Executes <phpstan> inside the container <filter=[app|path]>
129157
@$(eval filter ?= 'app')
158+
$(call showInfo,"Executing PHPStan...")
159+
@echo ""
130160
@vendor/bin/phpstan analyse --ansi --memory-limit=1G --no-progress --configuration=phpstan.neon $(filter)
131161
$(call taskDone)
132162

133163
.PHONY: tests
134164
tests: ## [QA] Executes <phpunit> inside the container <testsuite=[Unit|...]> <filter=[.|method + filename]>
135165
@$(eval testsuite ?= 'Unit')
136166
@$(eval filter ?= '.')
167+
$(call showInfo,"Executing PHPUnit...")
168+
@echo ""
137169
@XDEBUG_MODE=off vendor/bin/phpunit --testsuite=$(testsuite) --filter=$(filter) --configuration=phpunit.xml --coverage-text --testdox --colors --order-by=random --random-order-seed=$(RANDOM_ORDER_SEED)
138170
$(call taskDone)
139171

140172
.PHONY: coverage
141173
coverage: ## [QA] Executes <phpunit with pcov coverage support> inside the container
142-
@rm -Rf /coverage/*
143-
@XDEBUG_MODE=off vendor/bin/phpunit --coverage-html=/coverage --configuration=phpunit.xml --coverage-text --testdox --colors --order-by=random --random-order-seed=$(RANDOM_ORDER_SEED)
174+
$(call showInfo,"Generating Code Coverage report...")
175+
@echo ""
176+
@rm -Rf .coverage
177+
@mkdir .coverage
178+
@XDEBUG_MODE=off vendor/bin/phpunit --coverage-html=.coverage --configuration=phpunit.xml --coverage-text --testdox --colors --order-by=random --random-order-seed=$(RANDOM_ORDER_SEED)
144179
$(call taskDone)

0 commit comments

Comments
 (0)