-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
147 lines (109 loc) · 3.37 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
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
PRODUCTION := 0
FIX := 0
APP_DIR := app
LIBS_DIR := libs
LOG_DIR := log
NODE_DIR = node_modules
TEMP_DIR := temp
VENDOR_DIR := vendor
WWW_DIR := www
NODE_BIN_DIR := $(NODE_DIR)/.bin
CODE_CHECKER_DIR := $(TEMP_DIR)/code-checker
CODING_STANDARD_DIR := $(TEMP_DIR)/coding-standard
PHPSTAN_DIR := $(TEMP_DIR)/phpstan
CODE_CHECKER_VERSION := ^3.0.0
CODING_STANDARD_VERSION := ^2.0.0
PHPSTAN_VERSION := ^0.10.5
PACK := xharmi00_41_100_src
PRESENTATION_DIR := presentation
DOCKER_WEB := docker-compose exec web
DOCKER_NODE := docker-compose exec node
.PHONY: install
install: composer assets
.PHONY: composer
composer: docker-compose-web
ifeq ($(PRODUCTION), 0)
$(DOCKER_WEB) composer install --no-interaction --no-progress
else
$(DOCKER_WEB) composer install --no-interaction --no-progress --no-dev
endif
.PHONY: assets
assets: npm grunt
.PHONY: npm
npm: docker-compose-node
ifeq ($(PRODUCTION), 0)
$(DOCKER_NODE) npm install
else
$(DOCKER_NODE) npm install --no-dev
endif
.PHONY: grunt
grunt: npm
ifeq ($(PRODUCTION), 0)
./$(NODE_BIN_DIR)/grunt development
else
./$(NODE_BIN_DIR)/grunt production
endif
.PHONY: code-checker
code-checker: code-checker-install code-checker-run
.PHONY: code-checker-install
code-checker-install: docker-compose-web
ifeq ($(wildcard $(CODE_CHECKER_DIR)/.), )
$(DOCKER_WEB) composer create-project nette/code-checker $(CODE_CHECKER_DIR) $(CODE_CHECKER_VERSION) \
--no-interaction --no-progress --no-dev
endif
.PHONY: code-checker-run
code-checker-run: docker-compose-web
ifeq ($(FIX), 0)
$(DOCKER_WEB) ./$(CODE_CHECKER_DIR)/code-checker --strict-types --eol --ignore $(WWW_DIR)
else
$(DOCKER_WEB) ./$(CODE_CHECKER_DIR)/code-checker --strict-types --eol --ignore $(WWW_DIR) --fix
endif
.PHONY: coding-standard
coding-standard: coding-standard-install coding-standard-run
.PHONY: coding-standard-install
coding-standard-install: docker-compose-web
ifeq ($(wildcard $(CODING_STANDARD_DIR)/.), )
$(DOCKER_WEB) composer create-project nette/coding-standard $(CODING_STANDARD_DIR) $(CODING_STANDARD_VERSION) \
--no-interaction --no-progress --no-dev
endif
.PHONY: coding-standard-run
coding-standard-run: docker-compose-web
ifeq ($(FIX), 0)
$(DOCKER_WEB) ./$(CODING_STANDARD_DIR)/ecs check \
$(APP_DIR) $(LIBS_DIR) $(WWW_DIR) --config coding-standard.yml
else
$(DOCKER_WEB) ./$(CODING_STANDARD_DIR)/ecs check \
$(APP_DIR) $(LIBS_DIR) $(WWW_DIR) --config coding-standard.yml --fix
endif
.PHONY: phpstan
phpstan: phpstan-install phpstan-run
.PHONY: phpstan-install
phpstan-install: composer docker-compose-web
ifeq ($(wildcard $(PHPSTAN_DIR)/.), )
$(DOCKER_WEB) composer create-project phpstan/phpstan-shim $(PHPSTAN_DIR) $(PHPSTAN_VERSION) \
--no-interaction --no-progress --no-dev
endif
.PHONY: phpstan-run
phpstan-run: docker-compose-web
$(DOCKER_WEB) ./$(PHPSTAN_DIR)/phpstan analyse -c phpstan.neon
.PHONY: clean
clean:
git clean -xdff $(LOG_DIR) $(NODE_DIR) $(TEMP_DIR) $(VENDOR_DIR) $(WWW_DIR) $(PACK).zip \
$(PRESENTATION_DIR)
cd $(PRESENTATION_DIR) && make clean
.PHONY: clean-cache
clean-cache:
git clean -xdff $(TEMP_DIR)/cache $(TEMP_DIR)/phpstan-cache
.PHONY: pack
pack: clean $(PACK).zip
$(PACK).zip:
zip -r $@ * .gitignore .htaccess
.PHONY: presentation
presentation:
cd $(PRESENTATION_DIR) && make
.PHONY: docker-compose-web
docker-compose-web:
docker-compose up -d web
.PHONY: docker-compose-node
docker-compose-node:
docker-compose up -d node