-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
393 lines (321 loc) · 14.3 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
#
# JBZoo CCK
#
# This file is part of the JBZoo CCK package.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @package CCK
# @license Proprietary http://jbzoo.com/license
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @link http://jbzoo.com
#
.PHONY: build gulp logs tests tmp
#### Complex commands for developer version ############################################################################
update: update-dev
build-dev:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Cleanup project & Rebuild ALL! \033[0m"
@make clean
@make update-dev
@make prepare-fs
@make pack-dev
@make prepare-cms
update-dev:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update Project for Developing \033[0m"
@make update-composer
@make update-npm
@make update-bower
@make update-gulp
@make update-webpack
update-force:
@make clean
@make update-dev
prepare-cms:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Install & prepare all CMS \033[0m"
@make prepare-joomla
@make prepare-wordpress
prepare-fs:
@make prepare-fs-build
@make prepare-fs-joomla
@make prepare-fs-wordpress
test:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Run unit tests \033[0m"
@make test-joomla
@make test-wordpress
@make test-codestyle
test-all:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Run all tests \033[0m"
@make validate-composer
@make test
@make phpmd
@make phpcs
@make phpcpd
@make phploc
pack-dev:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Package: Create dev version \033[0m"
@rm -vfr ./build/packages
@mkdir -vp ./build/packages
@make pack-joomla
@make pack-joomla-unit
@make pack-wordpress
@make pack-wordpress-unit
@ls -lAhv ./build/packages
server:
@make server-cms
@make server-watch
server-cms:
@make server-joomla
@make server-wordpress
#### Complex commands for production version ###########################################################################
build-prod:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Build production version! \033[0m"
@make clean
@make update-prod
@make clean-production
@make prepare-fs
@make pack-prod
pack-prod:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Package: Create production version \033[0m"
@rm -vfr ./build/packages
@mkdir -vp ./build/packages
@make pack-joomla
@make pack-wordpress
@ls -lAhv ./build/packages
update-prod:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update Project for production \033[0m"
@make update-prod-composer
@make update-prod-npm
@make update-prod-bower
@make update-prod-gulp
@make update-prod-webpack
#### Install and prepare CMS ###########################################################################################
prepare-joomla:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Joomla: Prepare \033[0m"
@mysql -e 'create database ci_test_j'
@chmod +x ./scripts/prepare-joomla.sh
@./scripts/prepare-joomla.sh "ci_test_j" "root" "" "localhost:8881"
prepare-wordpress:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Wordpress: Prepare \033[0m"
@mysql -e 'create database ci_test_wp'
@chmod +x ./scripts/prepare-wordpress.sh
@./scripts/prepare-wordpress.sh "ci_test_wp" "root" "" "localhost:8882"
#### Start servers #####################################################################################################
server-joomla:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Server: HTTP for Joomla \033[0m"
@chmod +x ./vendor/jbzoo/phpunit/bin/phpunit-server.sh
@chmod +x ./bin/phpunit-server.sh
@./bin/phpunit-server.sh "localhost" "8881" \
"`pwd`/resources/cck-joomla" \
"`pwd`/vendor/jbzoo/phpunit/bin/fake-index.php" \
"--index=`pwd`/resources/cck-joomla/index.php --cov-src=`pwd`/src --cov-cov=1"
server-wordpress:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Server: HTTP for Wordpress \033[0m"
@chmod +x ./vendor/jbzoo/phpunit/bin/phpunit-server.sh
@chmod +x ./bin/phpunit-server.sh
@./bin/phpunit-server.sh "localhost" "8882" \
"`pwd`/resources/cck-wordpress" \
"`pwd`/vendor/jbzoo/phpunit/bin/fake-index.php" \
"--index=`pwd`/resources/cck-wordpress/index.php --cov-src=`pwd`/src --cov-cov=1"
server-watch:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Server: Webpack Watcher \033[0m"
@NODE_ENV=development ./node_modules/.bin/webpack \
--watch-aggregate-timeout=300 \
--watch \
--progress \
--colors
#### Create packages ###################################################################################################
pack-joomla:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Package: Joomla \033[0m"
@mkdir -vp ./build/packages
@cd ./src/joomla/pkg_jbzoocck; \
rm -f ../../../build/packages/j_jbzoo.zip; \
zip -rq ../../../build/packages/j_jbzoo.zip *
pack-joomla-unit:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Package: Joomla (PHPUnit-plugin) \033[0m"
@mkdir -pv ./build/packages
@cd tests/extentions/j_jbzoophpunit; \
rm -f ../../../build/packages/j_jbzoophpunit.zip; \
zip -rq ../../../build/packages/j_jbzoophpunit.zip *
pack-wordpress:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Package: Wordpress \033[0m"
@mkdir -vp ./build/packages
@cd src/wordpress; \
rm -f ../../build/packages/wp_jbzoo.zip; \
zip -rq ../../build/packages/wp_jbzoo.zip jbzoo
pack-wordpress-unit:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Package: Wordpress (PHPUnit plugin) \033[0m"
@mkdir -vp ./build/packages
@cd tests/extentions; \
rm -f ../../build/packages/wp_jbzoophpunit.zip; \
zip -rq ../../build/packages/wp_jbzoophpunit.zip wp_jbzoophpunit
#### File system #######################################################################################################
prepare-fs-build:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Prepare Filesystem: Build \033[0m"
@mkdir -pv ./build/coverage_cov
@mkdir -pv ./build/logs
@mkdir -pv ./build/misc
@mkdir -pv ./build/screenshot
@mkdir -pv ./build/phpcs
prepare-fs-joomla:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Prepare Filesystem: Joomla \033[0m"
@mkdir -vp src/joomla/pkg_jbzoocck/packages
@ln -vs `pwd`/src/cck/ src/joomla/com_jbzoo/admin/cck
@ln -vs `pwd`/src/joomla/com_jbzoo/ src/joomla/pkg_jbzoocck/packages/com_jbzoo
@ln -vs `pwd`/src/joomla/plg_sys_jbzoocck/ src/joomla/pkg_jbzoocck/packages/plg_sys_jbzoocck
prepare-fs-wordpress:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Prepare Filesystem: Wordpress \033[0m"
@ln -vs `pwd`/src/cck/ src/wordpress/jbzoo/cck
#### Updates ###########################################################################################################
update-composer:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update: Composer (DEV) \033[0m"
@cp ./composer.json ./src/cck/composer.json
@composer config bin-dir "../../bin" --working-dir=./src/cck
@composer config vendor-dir "../../vendor" --working-dir=./src/cck
@composer remove jbzoo/composer-cleanup --working-dir=./src/cck
@composer update \
--working-dir=./src/cck \
--optimize-autoloader \
--no-progress \
-v
@cp ./src/cck/composer.lock ./composer.lock
@echo ""
update-prod-composer:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update: Composer (PRODUCTION) \033[0m"
@cp ./composer.json ./src/cck/composer.json
@composer config bin-dir "bin" --working-dir=./src/cck
@composer config vendor-dir "libraries" --working-dir=./src/cck
@composer require jbzoo/composer-cleanup:1.x-dev \
--working-dir=./src/cck \
--no-update \
--update-no-dev \
--no-interaction
@composer update \
--working-dir=./src/cck \
--optimize-autoloader \
--no-progress \
--no-dev \
-v
@cp ./src/cck/composer.lock ./composer.lock
@echo ""
update-npm:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update: NPM (DEV) \033[0m"
@NODE_ENV=development npm install --progress=false
@echo ""
update-prod-npm:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update: NPM (PRODUCTION) \033[0m"
@npm install --progress=false
@echo ""
update-bower:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update: Bower (DEV) \033[0m"
@NODE_ENV=development ./node_modules/.bin/bower update
@echo ""
update-prod-bower:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update: Bower (PRODUCTION) \033[0m"
@./node_modules/.bin/bower update
@echo ""
update-gulp:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update: Gulp (DEV) \033[0m"
@NODE_ENV=development ./node_modules/.bin/gulp update
@echo ""
update-prod-gulp:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update: Gulp (PRODUCTION) \033[0m"
@./node_modules/.bin/gulp update
@echo ""
update-webpack:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update: Webpack (DEV) \033[0m"
@NODE_ENV=development ./node_modules/.bin/webpack -v
@echo ""
update-prod-webpack:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update: Webpack (PRODUCTION) \033[0m"
@./node_modules/.bin/webpack -v
@echo ""
#### Cleanup ###########################################################################################################
clean:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Cleanup project \033[0m"
@rm -fr ./bin
@rm -fr ./bower_components
@rm -fr ./node_modules
@rm -fr ./vendor
@rm -fr ./src/cck/libraries
@rm -f ./src/cck/composer.lock
@make clean-build
@make prepare-fs-build
clean-build:
@rm -fr ./build
clean-production:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Remove test stuff for production \033[0m"
@rm -fr ./src/cck/atoms/test
@rm ./src/cck/bin/lessc.bat
@rm ./src/cck/bin/lessc
@rm -fr ./src/cck/libraries/jbzoo/composer-cleanup
@rm -fr ./src/cck/elements/Item/Test
@rm -fr ./src/cck/elements/Item/Testrepeatable
@find ./src -name "*.jsx" -type f -delete
@find ./src -name "*.map" -type f -delete
@find ./src -name "composer.json" -type f -delete
@find ./src -name "composer.lock" -type f -delete
@find ./src -type d -empty -delete
reset:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Hard reset \033[0m"
@git reset --hard
autoload:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Composer autoload \033[0m"
@composer dump-autoload --optimize --no-interaction
@echo ""
#### Tests #############################################################################################################
test-joomla:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Run unit-tests for Joomla!CMS \033[0m"
@php ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit-joomla.xml.dist
@echo ""
test-wordpress:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Run unit-tests for Wordpress \033[0m"
@php ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit-wordpress.xml.dist
@echo ""
test-codestyle:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Check utilities and CodeStyle \033[0m"
@php ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit-utility.xml.dist
@echo ""
validate-composer:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Composer validate \033[0m"
@composer validate --no-interaction --working-dir=./src/cck
@echo ""
phpmd:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Check PHPmd \033[0m"
@php ./vendor/phpmd/phpmd/src/bin/phpmd ./src/cck text \
./vendor/jbzoo/misc/phpmd/jbzoo.xml --verbose \
--exclude **/symfony/*,**/oyejorge/*,**/composer/,**/pimple/,**/jbdump/*
phpcs:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Check Code Style \033[0m"
@php ./vendor/squizlabs/php_codesniffer/scripts/phpcs \
--extensions=php \
--standard=./vendor/jbzoo/misc/phpcs/JBZoo/ruleset.xml \
--report-checkstyle=build/phpcs/report.xml \
--report=full \
--report-width=180 \
--tab-width=4 \
--report=full \
./src/cck
@echo ""
phpcpd:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Check Copy&Paste \033[0m"
@php ./vendor/sebastian/phpcpd/phpcpd ./src/cck --verbose
@echo ""
phploc:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Show stats \033[0m"
@php ./vendor/phploc/phploc/phploc ./src/cck --verbose
@echo ""
#### Coverage report ###################################################################################################
phpcov:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Merge coverage reports \033[0m"
@mkdir -pv ./build/coverage_total
@ls -la ./build/coverage_cov
@php ./vendor/phpunit/phpcov/phpcov merge \
--clover build/coverage_total/merge.xml \
--html build/coverage_total/merge-html \
build/coverage_cov \
-v
@echo ""
coveralls:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Send coverage to coveralls.io \033[0m"
@php ./vendor/satooshi/php-coveralls/bin/coveralls -vvv
@echo ""