forked from backup-manager/backup-manager
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
70 lines (49 loc) · 1.32 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
65
66
67
68
69
70
.PHONY: php
SUPPORTED_COMMANDS := php test cs static cbf
SUPPORTS_MAKE_ARGS := $(findstring $(firstword $(MAKECMDGOALS)), $(SUPPORTED_COMMANDS))
ifneq "$(SUPPORTS_MAKE_ARGS)" ""
COMMAND_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
COMMAND_ARGS := $(subst :,\:,$(COMMAND_ARGS))
$(eval $(COMMAND_ARGS):;@:)
endif
DOCKER_PHP := docker-compose exec php
ifeq (, $(shell which docker-compose))
BASE :=
else
BASE := $(DOCKER_PHP)
endif
# Container management
dup:
ifeq ($(BASE), $(DOCKER_PHP))
docker-compose up -d
endif
kill:
docker-compose rm -f -s
login:
docker-compose exec php sh
php:
$(BASE) $(COMMAND_ARGS)
# Dépendence
install: dup
$(BASE) composer install
update: dup
$(BASE) composer update
composer-valid: dup
$(BASE) composer validate
# Tests
test:
$(BASE) ./vendor/bin/phpunit $(COMMAND_ARGS)
infection: dup
$(BASE) ./vendor/bin/infection
# Analyse
static:
$(BASE) ./vendor/bin/psalm --show-info=true $(COMMAND_ARGS)
cs:
$(BASE) php -d memory_limit=-1 ./vendor/bin/phpcs $(COMMAND_ARGS)
cbf: dup
$(BASE) php -d memory_limit=-1 ./vendor/bin/phpcbf $(COMMAND_ARGS)
is-valid:
$(BASE) ./vendor/bin/phpunit $(COMMAND_ARGS)
$(BASE) ./vendor/bin/infection
$(BASE) ./vendor/bin/psalm --show-info=true $(COMMAND_ARGS)
$(BASE) php -d memory_limit=-1 ./vendor/bin/phpcs $(COMMAND_ARGS)