Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit e6c31f7

Browse files
committed
Improved a little bit more Makefile
1 parent 2bcffa9 commit e6c31f7

2 files changed

Lines changed: 22 additions & 17 deletions

File tree

Makefile

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
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)
27
SOURCE_CODE_PATHS = src test examples
38
API_DOCS_PATH = ./docs/api
49
COVERAGE_PATH = ./cover
510

11+
define require_phar
12+
@[ -f ./$(1) ] || wget -q $(2) -O ./$(1) && chmod +x $(1);
13+
endef
14+
615
lint: lint-php lint-psr2 lint-squiz
716

817
.PHONY: lint-php
@@ -11,18 +20,12 @@ lint-php:
1120

1221
.PHONY: lint-psr2
1322
lint-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
2127
lint-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

4245
deps:
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

4753
dist-clean:
48-
rm -rf $(CLEAN_FILES)
54+
rm -rf $(CLEAN_PATHS)
4955

5056
docker-nats:
5157
docker run --rm -p 8222:8222 -p 4222:4222 -d --name nats-main nats
5258

5359
phpdoc:
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

5863
serve-phpdoc:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
},
1010
"require-dev": {
1111
"phpunit/phpunit": "5.*",
12-
"satooshi/php-coveralls": "dev-master",
13-
"phpspec/phpspec": "~2.0"
12+
"phpspec/phpspec": "~2.0",
13+
"satooshi/php-coveralls": "dev-master"
1414
},
1515
"authors": [
1616
{

0 commit comments

Comments
 (0)