forked from AlboCode/ccatphp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (56 loc) · 1.89 KB
/
Makefile
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
export UID := $(shell id -u)
export GID := $(shell id -g)
SHELL = /bin/bash
DOCKER_COMPOSE_EXEC =
FURTHER_ARGS :=
# Add here commands that support additional arguments
CMDS_WITH_ARGS := test
ifneq ($(filter $(firstword $(MAKECMDGOALS)),$(CMDS_WITH_ARGS)),)
FURTHER_ARGS := $(wordlist 2,999,$(MAKECMDGOALS))
# The args are not targets, let's make them silently fail
$(eval $(subst :,\:,$(subst %,\%, $(FURTHER_ARGS))):;@true)
$(eval .PHONY: $(subst :,\:, $(subst ;,\;, $(FURTHER_ARGS))))
endif
# define standard colors
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)
LIGHTPURPLE := $(shell tput -Txterm setaf 4)
PURPLE := $(shell tput -Txterm setaf 5)
BLUE := $(shell tput -Txterm setaf 6)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
else
BLACK := ""
RED := ""
GREEN := ""
YELLOW := ""
LIGHTPURPLE := ""
PURPLE := ""
BLUE := ""
WHITE := ""
RESET := ""
endif
# set target color
NOTIFICATION_COLOR := $(BLUE)
all: help
help:
@echo "Here is a list of make commands with the corresponding description"
@echo
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "$(NOTIFICATION_COLOR)%-30s$(RESET) %s\n", $$1, $$2}' $(MAKEFILE_LIST)
project-init: ## Initialize the project
echo "Creating hooks"
rm -f .git/hooks/pre-commit
ln -s ../../hooks/pre-commit .git/hooks/pre-commit
build: ## Build the project
docker compose build
up: ## Start the project
docker compose up -d
down: ## Stop the project
docker compose down
bash: ## Access the php container
docker compose exec php bash
test: ## Run the tests
docker compose exec -it php $(SHELL) -c "vendor/bin/phpunit --colors=always --testdox $(FURTHER_ARGS)"