-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
165 lines (142 loc) · 4.82 KB
/
Makefile
File metadata and controls
165 lines (142 loc) · 4.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
.DEFAULT_GOAL := help
###
# CONSTANTS
###
ifneq (,$(findstring xterm,$(TERM)))
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
BLUE := $(shell tput -Txterm setaf 4)
MAGENTA := $(shell tput -Txterm setaf 5)
CYAN := $(shell tput -Txterm setaf 6)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
else
BLACK := ""
RED := ""
GREEN := ""
YELLOW := ""
BLUE := ""
MAGENTA := ""
CYAN := ""
WHITE := ""
RESET := ""
endif
###
# HELP
###
.PHONY: help
help:
@clear
@echo "${BLACK}"
@echo "╔════════════════════════════════════════════════════════════════════════════════════════════════════════╗"
@echo "║ $(call pad,96) ║"
@echo "║ $(call pad,32) ${YELLOW}.:${RESET} AVAILABLE COMMANDS ${YELLOW}:.${BLACK} $(call pad,32) ║"
@echo "║ $(call pad,96) ║"
@echo "╚════════════════════════════════════════════════════════════════════════════════════════════════════════╝"
@echo "${RESET}"
@grep -E '^[a-zA-Z_0-9%-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "· ${YELLOW}%-30s${RESET} %s\n", $$1, $$2}'
@echo ""
###
# FUNCTIONS
###
require-%:
@if [ -z "$($(*))" ] ; then \
echo "" ; \
echo " ${RED}⨉${RESET} Parameter [ ${YELLOW}${*}${RESET} ] is required!" ; \
echo "" ; \
echo " ${YELLOW}ℹ${RESET} Usage [ ${YELLOW}make COMMAND${RESET} ${RED}${*}=${RESET}${YELLOW}xxxxxx${RESET} ]" ; \
echo "" ; \
exit 1 ; \
fi;
define taskDone
@echo ""
@echo " ${GREEN}✓${RESET} ${GREEN}Task done!${RESET}"
@echo ""
endef
# $(1)=TEXT $(2)=EXTRA
define showInfo
@echo " ${YELLOW}ℹ${RESET} $(1) $(2)"
endef
define pad
$(shell printf "%-$(1)s" " ")
endef
###
# COMPOSER
###
.PHONY: composer-dump
composer-dump: ## Composer: executes <composer dump-auto> inside the container
$(call showInfo,"Executing \<composer dump-auto\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer dump-auto
$(call taskDone)
.PHONY: composer-install
composer-install: ## Composer: executes <composer install> inside the container
$(call showInfo,"Executing \<composer install\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer install
$(call taskDone)
.PHONY: composer-remove
composer-remove: require-package ## Composer: executes <composer remove> inside the container
$(call showInfo,"Executing \<composer remove\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer remove
$(call taskDone)
.PHONY: composer-require-dev
composer-require-dev: ## Composer: executes <composer require --dev> inside the container
$(call showInfo,"Executing \<composer require --dev\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer require --dev
$(call taskDone)
.PHONY: composer-require
composer-require: ## Composer: executes <composer require> inside the container
$(call showInfo,"Executing \<composer require\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer require
$(call taskDone)
.PHONY: composer-update
composer-update: ## Composer: executes <composer update> inside the container
$(call showInfo,"Executing \<composer update\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer update
$(call taskDone)
###
# QA
###
.PHONY: check-syntax
check-syntax: ## QA: executes <composer check-syntax> inside the container
$(call showInfo,"Executing \<composer check-syntax\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer check-syntax
$(call taskDone)
.PHONY: check-style
check-style: ## QA: executes <composer check-style> inside the container
$(call showInfo,"Executing \<composer check-style\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer check-style
$(call taskDone)
.PHONY: fix-style
fix-style: ## QA: executes <composer fix-style> inside the container
$(call showInfo,"Executing \<composer fix-style\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer fix-style
$(call taskDone)
.PHONY: phpstan
phpstan: ## QA: executes <composer phpstan> inside the container
$(call showInfo,"Executing \<composer phpstan\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer phpstan
$(call taskDone)
.PHONY: tests
test: ## QA: executes <composer test> inside the container
$(call showInfo,"Executing \<composer test\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer test
$(call taskDone)
.PHONY: coverage
coverage: ## QA: executes <composer coverage> inside the container
$(call showInfo,"Executing \<composer coverage\>...")
@echo ""
@$(DOCKER_RUN_AS_USER) composer coverage
$(call taskDone)