1+ CLEAN_FILES = bin build cover vendor docs/api composer.phar composer.lock phpDocumentor.phar
2+ SOURCE_CODE_PATHS = src test examples
3+ API_DOCS_PATH = ./docs/api
4+ COVERAGE_PATH = ./cover
5+
16lint : lint-php lint-psr2 lint-squiz
27
38.PHONY : lint-php
49lint-php :
5- find src -name * .php -exec php -l {} \;
6- find test -name * .php -exec php -l {} \;
7- find spec -name * .php -exec php -l {} \;
8- find examples -name * .php -exec php -l {} \;
10+ find $(SOURCE_CODE_PATHS ) spec -name * .php -exec php -l {} \;
911
1012.PHONY : lint-psr2
1113lint-psr2 :
12- # ./vendor/bin/phpcbf --standard=PSR2 src test examples
13- ./vendor/bin/phpcs --standard=PSR2 --colors -w -s --warning-severity=0 src test examples
14+ # wget -qhttps://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar -O ./phpcbf.phar
15+ # ./vendor/bin/phpcbf --standard=PSR2 $(CODE_SOURCES)
16+ wget -q https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar -O ./phpcs.phar
17+ chmod +x phpcs.phar
18+ ./phpcs.phar --standard=PSR2 --colors -w -s --warning-severity=0 $(SOURCE_CODE_PATHS )
1419
1520.PHONY : lint-squiz
1621lint-squiz :
17- # ./vendor/bin/phpcbf --standard=Squiz,./ruleset.xml src test examples
18- ./vendor/bin/phpcs --standard=Squiz,./ruleset.xml --colors -w -s --warning-severity=0 src test examples
22+ # wget -qhttps://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar -O ./phpcbf.phar
23+ # ./vendor/bin/phpcbf --standard=Squiz,./ruleset.xml $(CODE_SOURCES)
24+ wget -q https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar -O ./phpcs.phar
25+ chmod +x phpcs.phar
26+ ./phpcs.phar --standard=Squiz,./ruleset.xml --colors -w -s --warning-severity=0 $(SOURCE_CODE_PATHS )
1927
2028
2129test : test-tdd test-bdd
@@ -29,28 +37,23 @@ test-bdd:
2937 ./vendor/bin/phpspec run --format=pretty -v
3038
3139cover :
32- ./vendor/bin/phpunit --coverage-html ./cover test
40+ ./vendor/bin/phpunit --coverage-html $( COVERAGE_PATH ) test
3341
3442deps :
3543 wget -q https://getcomposer.org/composer.phar -O ./composer.phar
3644 chmod +x composer.phar
37- php composer.phar install
45+ ./ composer.phar install
3846
3947dist-clean :
40- rm -rf bin
41- rm -rf vendor
42- rm -f composer.phar
43- rm -f composer.lock
44- rm -f phpDocumentor.phar
45- rm -rf docs/api
48+ rm -rf $(CLEAN_FILES )
4649
4750docker-nats :
4851 docker run --rm -p 8222:8222 -p 4222:4222 -d --name nats-main nats
4952
5053phpdoc :
5154 wget -q https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar -O ./phpDocumentor.phar
5255 chmod +x phpDocumentor.phar
53- ./phpDocumentor.phar -d ./src/ -t ./docs/api --template=checkstyle --template=responsive-twig
56+ ./phpDocumentor.phar -d ./src/ -t $( API_DOCS_PATH ) --template=checkstyle --template=responsive-twig
5457
5558serve-phpdoc :
56- cd docs/api && php -S localhost:8000 && cd ../..
59+ cd $( API_DOCS_PATH ) && php -S localhost:8000 && cd ../..
0 commit comments