-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
186 lines (140 loc) · 5.79 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# ezPAARSE's Makefile
SHELL:=/bin/bash
all: nodejs node-modules platforms-update middlewares-update exclusions-update resources-update build-nuxt checkconfig ## Runs every steps needed to start ezpaarse
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# Application section
# # # # # # # # # # # #
checkconfig: ## Check node configuration
@. ./bin/env; if which node > /dev/null; then ./bin/checkconfig; else echo "Node.js was not found" >&2; fi
start: ## Start ezPAARSE in deamon mode
@./bin/ezpaarse start
start-fg: ## Start ezPAARSE in foreground
@./bin/ezpaarse start --no-daemon
dev: ## Start ezPAARSE in developpement mode
@./bin/ezpaarse dev
stop: ## Stop ezPAARSE
@./bin/ezpaarse stop
restart: ## Restart ezPAARSE
@./bin/ezpaarse restart
reload: ## Delete the daemonized ezPAARSE instance and starts a new one
@./bin/ezpaarse reload
wipe: ## Delete the daemonized ezPAARSE instance and kill the PM2 daemon
@./bin/ezpaarse wipe
status: ## Get the status of ezPAARSE
@./bin/ezpaarse status
logs: ## Show the logs of ezPAARSE
@./bin/ezpaarse logs
monitor: ## Monitor ezPAARSE
@./bin/ezpaarse monitor
# Docker section
# # # # # # # # #
run-prod-docker: ## run ezpaarse in production mode using docker
@docker compose -f ./docker-compose.yml up -d
@echo "Listening on http://127.0.0.1:59599/"
run-debug-docker: ## run ezpaarse in debug mode using docker
@docker compose -f ./docker-compose.debug.yml up -d
@# attach to the ezpaarse container in order to be able to stop it easily with CTRL+C
@docker attach ezpaarse
build-docker: ## Build ezpaarseproject/ezpaarse:3.10.4 docker image locally
@docker build -t ezpaarseproject/ezpaarse:3.10.4 --build-arg http_proxy --build-arg https_proxy .
test-docker: ## Run tests inside the ezpaarse container (needs make run-debug-docker in //)
@docker exec -it ezpaarse make test
test-docker-verbose: ## Run tests in verbose inside the ezpaarse container (needs make run-debug-docker in //)
@docker exec -it ezpaarse make test-verbose
# Tests section
# # # # # # # # #
EZPATH = $(shell pwd)
PKBFILES=$(shell ls $(EZPATH)/platforms/*/pkb/*.txt | grep -v miss)
test: ## Runs all tests (*-test.js) in the test folder except big and tdd
@if test -d test; \
then . ./bin/env; mocha --exit -g '@big|@tdd' -i; \
else echo 'No test folder found'; \
fi
test-verbose: test-pkb-verbose ## Runs all tests (*-test.js) in the test folder except big and tdd in verbose mode
@if test -d test; \
then . ./bin/env; mocha --exit -g '@big|@tdd' -i -R list; \
else echo 'No test folder found'; \
fi
test-pkb: ## Runs tests on pkb files (Publisher Knowledge Base)
@if test -d platforms; \
then . ./bin/env; ./bin/pkbvalidator --nowarnings $(PKBFILES); \
else echo 'No test folder found'; \
fi
test-pkb-verbose: ## Runs tests on pkb files (Publisher Knowledge Base) in verbose mode
@if test -d platforms; \
then . ./bin/env; ./bin/pkbvalidator -v $(PKBFILES); \
else echo 'No test folder found'; \
fi
test-big: ## Runs big tests
@if test -d test; \
then . ./bin/env; mocha --exit -g @big; \
else echo 'No test folder found'; \
fi
test-big-verbose: ## Runs big tests in verbose mode
@if test -d test; \
then . ./bin/env; mocha --exit -R list -g @big; \
else echo 'No test folder found'; \
fi
tdd: ## Runs tdd tests
@if test -d test; \
then . ./bin/env; mocha --exit -g @tdd; \
else echo 'No test folder found'; \
fi
tdd-verbose: ## Runs tdd tests in verbose mode
@if test -d test; \
then . ./bin/env; mocha --exit -R list -g @tdd; \
else echo 'No test folder found'; \
fi
lint: ## Runs lint validation
@. ./bin/env; npm run lint
clean-tmp: ## Clean tmp directory
@rm -rf ./tmp/*
# Build section
# # # # # # # # # # # #
nodejs: ## Build node for ezpaarse
@echo 'Building Node.js...'
@test -f /usr/bin/git || sudo apt-get install --yes git
@./bin/buildnode
build-nuxt: ## Build Nuxt App
@if test -z "${EZPAARSE_NO_WEB_CLIENT}"; \
then . ./bin/env; echo 'Building web interface...'; npm run build; \
fi
node-modules: libs
libs:
@echo 'Installing node.js dependencies...'
@. ./bin/env; npm ci $(if $(EZPAARSE_VERBOSE_INSTALL),,--silent --no-audit) $(if $(EZPAARSE_NO_WEB_CLIENT),--omit=optional,)
middlewares-update: ## Clone or update middelwares directory
@echo 'Updating middlewares...'
@if test -d middlewares/.git; \
then cd middlewares; git pull --no-rebase; \
else git clone https://github.com/ezpaarse-project/ezpaarse-middlewares.git middlewares; \
fi
@. ./bin/env; cd middlewares; npm ci $(if $(EZPAARSE_VERBOSE_INSTALL),,--silent --no-audit);
resources-update: ## Clone or update resources directory
@echo 'Updating resources...'
@if test -d resources/.git; \
then cd resources; git pull --no-rebase; \
else git clone https://github.com/ezpaarse-project/ezpaarse-resources.git resources; \
fi
platforms-update: ## Clone or update platforms directory
@echo 'Updating platforms...'
@if test -d platforms/.git; \
then cd platforms; git pull --no-rebase; \
else git clone https://github.com/ezpaarse-project/ezpaarse-platforms.git platforms; \
fi
exclusions-update: ## Clone or update exclusions directory
@echo 'Updating exclusions...'
@if test -d exclusions/.git; \
then cd exclusions; git pull --no-rebase; \
else git clone https://github.com/ezpaarse-project/ezpaarse-exclusions.git exclusions; \
fi
pull: ## Stop the daemon, update to last tag and rebuild
@./bin/update-app --rebuild
@echo "ezPAARSE has been updated."
pull-latest: ## Stop the daemon, update to bleeding edge and rebuild
@./bin/update-app --latest --rebuild
@echo "ezPAARSE has been updated."
update: pull
update-latest: pull-latest
.PHONY: help test checkconfig nodejs platforms-update middlewares-update exclusions-update resources-update version tag update pull start start-fg logs restart dev status stop