-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
200 lines (170 loc) · 7.21 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
#
# JBZoo CrossCMS
#
# 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 CrossCMS
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @link https://github.com/JBZoo/CrossCMS
#
.PHONY: build test tests
build:
@make update
@make prepare
prepare:
@make prepare-fs
@make prepare-j
@make prepare-wp
server:
@make server-j
@make server-wp
server-cov:
@make server-j-cov
@make server-wp-cov
test:
@make test-j
@make test-wp
test-cov:
@make test-j-cov
@make test-wp-cov
update:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update project \033[0m"
@composer update --optimize-autoloader --no-interaction
@echo ""
server-wp:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Start Wordpress Web-server \033[0m"
@chmod +x ./tests/bin/server-wordpress.sh
@./tests/bin/server-wordpress.sh
server-wp-cov:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Start Wordpress Web-server with Xdebug \033[0m"
@chmod +x ./tests/bin/server-wordpress-cov.sh
@./tests/bin/server-wordpress-cov.sh
server-j:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Start Joomla Web-server \033[0m"
@chmod +x ./tests/bin/server-joomla.sh
@./tests/bin/server-joomla.sh
server-j-cov:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Start Joomla Web-server with Xdebug \033[0m"
@chmod +x ./tests/bin/server-joomla-cov.sh
@./tests/bin/server-joomla-cov.sh
prepare-fs:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Prepare Filesystem \033[0m"
@mkdir -pv ./build
@mkdir -pv ./build/logs
@mkdir -pv ./build/total
@mkdir -pv ./build/clover
@mkdir -pv ./build/coverage_cov
@mkdir -pv ./resource
prepare-j:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Prepare Joomla! CMS before tests \033[0m"
@php ./vendor/joomlatools/console/bin/joomla site:create joomla \
--www=./resources \
--mysql-login=root: \
--mysql-host=127.0.0.1 \
--mysql-database=test_cms_j \
--verbose
@php ./vendor/joomlatools/console/bin/joomla extension:disable joomla debug \
--www=./resources
@php ./tests/bin/prepare-joomla-config.php
@zip -rj ./build/joomla-plugin.zip tests/extentions/joomla-plugin
@php ./vendor/joomlatools/console/bin/joomla extension:installfile joomla \
./build/joomla-plugin.zip \
--www=./resources
@php ./vendor/joomlatools/console/bin/joomla extension:enable joomla jbzoophpunit \
--www=./resources
prepare-wp:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Prepare Wordpress CMS before tests \033[0m"
@mkdir -p ./resources/wordpress
@mysql -e 'create database test_cms_wp'
@php ./vendor/wp-cli/wp-cli/php/boot-fs.php core download \
--path=./resources/wordpress
@php ./vendor/wp-cli/wp-cli/php/boot-fs.php core config \
--path=./resources/wordpress \
--dbname=test_cms_wp \
--dbuser=root \
--dbhost=127.0.0.1
@php ./vendor/wp-cli/wp-cli/php/boot-fs.php core install \
--path=./resources/wordpress \
--url=127.0.0.1:8083 \
--title=CrossCMS \
--admin_user=admin \
--admin_password=123456 \
@mkdir -p ./resources/wordpress/cache
@mkdir -p ./resources/wordpress/tmp
@mkdir -p ./resources/wordpress/logs
@zip -rj ./build/wp-plugin.zip tests/extentions/wp-plugin
@php ./vendor/wp-cli/wp-cli/php/boot-fs.php plugin install \
--path=./resources/wordpress \
./build/wp-plugin.zip \
--force
@php ./vendor/wp-cli/wp-cli/php/boot-fs.php plugin activate wp-plugin \
--path=./resources/wordpress
test-all:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Run all tests \033[0m"
@make validate test phpmd phpcs phpcpd phploc
@echo ""
validate:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Composer validate \033[0m"
@composer validate --no-interaction
@echo ""
autoload:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Composer autoload \033[0m"
@composer dump-autoload --optimize --no-interaction
@echo ""
test-j:
@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-j-cov:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Run unit-tests for Joomla! CMS with Xdebug \033[0m"
@php56-x ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit-joomla.xml.dist
@echo ""
test-wp:
@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-wp-cov:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Run unit-tests for Wordpress with Xdebug \033[0m"
@php56-x ./vendor/phpunit/phpunit/phpunit --configuration ./phpunit-wordpress.xml.dist
@echo ""
phpmd:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Check PHPmd \033[0m"
@php ./vendor/phpmd/phpmd/src/bin/phpmd ./src text \
./vendor/jbzoo/misc/phpmd/jbzoo.xml --verbose
phpcs:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Check Code Style \033[0m"
@php ./vendor/squizlabs/php_codesniffer/scripts/phpcs ./src \
--extensions=php \
--standard=./vendor/jbzoo/misc/phpcs/JBZoo/ruleset.xml \
--report=full
@echo ""
phpcpd:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Check Copy&Paste \033[0m"
@php ./vendor/sebastian/phpcpd/phpcpd ./src --verbose
@echo ""
phploc:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Show statistic \033[0m"
@php ./vendor/phploc/phploc/phploc ./src --verbose
@echo ""
reset:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Hard reset \033[0m"
@git reset --hard
phpcov:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Merge coverage reports \033[0m"
@php ./vendor/phpunit/phpcov/phpcov merge \
--clover build/total/total.xml \
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 ""
coveralls-test:
@echo -e "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Send coverage to coveralls.io \033[0m"
@php ./vendor/satooshi/php-coveralls/bin/coveralls -vvv --dry-run
@echo ""