From 6b991c898b10ecf493fca18f4607c3248e1770e0 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Fri, 24 Nov 2017 18:47:59 -0600 Subject: [PATCH] Add Makefile and update git files --- .gitattributes | 8 ++++++++ .gitignore | 12 +++++------- Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 .gitattributes create mode 100644 Makefile diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a454734 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +examples export-ignore +test export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.php_cs.dist export-ignore +.travis.yml export-ignore +Makefile export-ignore +phpunit.xml.dist export-ignore diff --git a/.gitignore b/.gitignore index 1b3f00f..fb6c963 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ -/.idea -/coverage -/build -/composer.lock -/phpunit.xml -/vendor -/.php_cs.cache +.php_cs.cache +build +composer.lock +phpunit.xml +vendor diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6c3291b --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +PHP_BIN := php +COMPOSER_BIN := composer + +COVERAGE = coverage +SRCS = lib test + +find_php_files = $(shell find $(1) -type f -name "*.php") +src = $(foreach d,$(SRCS),$(call find_php_files,$(d))) + +.PHONY: test +test: setup phpunit code-style + +.PHONY: clean +clean: clean-coverage clean-vendor + +.PHONY: clean-coverage +clean-coverage: + test ! -e coverage || rm -r coverage + +.PHONY: clean-vendor +clean-vendor: + test ! -e vendor || rm -r vendor + +.PHONY: setup +setup: vendor/autoload.php + +.PHONY: deps-update +deps-update: + $(COMPOSER_BIN) update + +.PHONY: phpunit +phpunit: setup + $(PHP_BIN) vendor/bin/phpunit + +.PHONY: code-style +code-style: setup + PHP_CS_FIXER_IGNORE_ENV=1 $(PHP_BIN) vendor/bin/php-cs-fixer --diff -v fix + +composer.lock: composer.json + $(COMPOSER_BIN) install + touch $@ + +vendor/autoload.php: composer.lock + $(COMPOSER_BIN) install + touch $@