1- CLEAN_FILES = bin build cover vendor docs/api composer.phar composer.lock phpDocumentor.phar
1+ PHPCS_PHAR = https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
2+ COMPOSER_PHAR = https://getcomposer.org/composer.phar
3+ PHPDOCUMENTOR_PHAR_URL = https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar
4+ CLEAN_FILES = composer.phar composer.lock phpDocumentor.phar phpcs.phar phpcbf.phar
5+ CLEAN_FOLDERS = bin build cover vendor docs/api
6+ CLEAN_PATHS = $(CLEAN_FILES ) $(CLEAN_FOLDERS )
27SOURCE_CODE_PATHS = src test examples
38API_DOCS_PATH = ./docs/api
49COVERAGE_PATH = ./cover
510
11+ define require_phar
12+ @[ -f ./$(1 ) ] || wget -q $(2 ) -O ./$(1 ) && chmod +x $(1 ) ;
13+ endef
14+
615lint : lint-php lint-psr2 lint-squiz
716
817.PHONY : lint-php
@@ -11,18 +20,12 @@ lint-php:
1120
1221.PHONY : lint-psr2
1322lint-psr2 :
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
23+ $(call require_phar,phpcs.phar,$(PHPCS_PHAR ) )
1824 ./phpcs.phar --standard=PSR2 --colors -w -s --warning-severity=0 $(SOURCE_CODE_PATHS )
1925
2026.PHONY : lint-squiz
2127lint-squiz :
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
28+ $(call require_phar,phpcs.phar,$(PHPCS_PHAR ) )
2629 ./phpcs.phar --standard=Squiz,./ruleset.xml --colors -w -s --warning-severity=0 $(SOURCE_CODE_PATHS )
2730
2831
@@ -40,19 +43,21 @@ cover:
4043 ./vendor/bin/phpunit --coverage-html $(COVERAGE_PATH ) test
4144
4245deps :
43- wget -q https://getcomposer.org/composer.phar -O ./composer.phar
44- chmod +x composer.phar
45- ./composer.phar install
46+ $(call require_phar,composer.phar,$(COMPOSER_PHAR ) )
47+ ./composer.phar install --no-dev
48+
49+ dev-deps :
50+ $(call require_phar,composer.phar,$(COMPOSER_PHAR ) )
51+ ./composer.phar install --dev
4652
4753dist-clean :
48- rm -rf $(CLEAN_FILES )
54+ rm -rf $(CLEAN_PATHS )
4955
5056docker-nats :
5157 docker run --rm -p 8222:8222 -p 4222:4222 -d --name nats-main nats
5258
5359phpdoc :
54- wget -q https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar -O ./phpDocumentor.phar
55- chmod +x phpDocumentor.phar
60+ $(call require_phar,phpDocumentor.phar,$(PHPDOCUMENTOR_PHAR_URL ) )
5661 ./phpDocumentor.phar -d ./src/ -t $(API_DOCS_PATH ) --template=checkstyle --template=responsive-twig
5762
5863serve-phpdoc :
0 commit comments