-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
712e4e7
commit a56f599
Showing
7 changed files
with
93 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,3 +67,9 @@ Temporary Items | |
|
||
composer.lock | ||
|
||
# ========================= | ||
# PHPUnit | ||
# ========================= | ||
|
||
/coverage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,92 @@ | ||
|
||
# Run "make" to print help | ||
# If you want to add a help message for your rule, just add : "## My help for this rule", on the previous line | ||
# You can give "make" arguments with this syntax: PARAMETER=VALUE | ||
|
||
.PHONY: help | ||
.PHONY: help tests coverage composer-install uninstall | ||
|
||
# Colors | ||
COLOR_TITLE = \033[1;41m | ||
COLOR_CAPTION = \033[1;44m | ||
COLOR_BOLD = \033[1;34m | ||
COLOR_LABEL = \033[1;32m | ||
COLOR_DANGER = \033[31m | ||
COLOR_SUCCESS = \033[32m | ||
COLOR_WARNING = \033[33m | ||
COLOR_SECONDARY = \033[34m | ||
COLOR_INFO = \033[35m | ||
COLOR_PRIMARY = \033[36m | ||
COLOR_DEFAULT = \033[0m | ||
|
||
# Date / Time | ||
DATE=$(shell date -I) | ||
DATETIME=$(shell date '+%Y-%m-%d %H:%M:%S') | ||
TIME=$(shell date -Ins) | ||
TIMESTAMP=$(shell date +%Y%m%d%H%M%S) | ||
EPOCH=$(shell date +%s) | ||
DAY=$(shell LANG=C date +%A) | ||
|
||
# Local vars | ||
ifeq (${OS}, Windows_NT) | ||
SYSTEM=${OS} | ||
else | ||
SYSTEM=$(shell uname -s) | ||
endif | ||
|
||
WHOAMI=$(shell whoami) | ||
|
||
BASEDIR=$(shell basename `git rev-parse --show-toplevel 2>/dev/null` 2>/dev/null) | ||
# get lastest tag from git repository | ||
VERSION=$(shell echo `git describe --exact-match --abbrev=0 2>/dev/null`) | ||
|
||
# parameters (usage parameter=value) | ||
parameter?='' | ||
COLOR_TITLE = \033[1;41m | ||
COLOR_CAPTION = \033[1;44m | ||
COLOR_LABEL = \033[1;32m | ||
COLOR_WARNING = \033[33m | ||
COLOR_INFO = \033[35m | ||
COLOR_PRIMARY = \033[36m | ||
COLOR_DEFAULT = \033[0m | ||
|
||
# get correct console executable | ||
CONSOLE=$(shell if [ -f ./app/console ]; then echo './app/console'; elif [ -f ./bin/console ]; then echo './bin/console'; fi) | ||
# get correct public folder | ||
PUBLIC=$(shell if [ -d ./web ]; then echo './web'; elif [ -d ./public ]; then echo './public'; else echo './'; fi) | ||
|
||
## Print this help | ||
help: | ||
@printf "${COLOR_TITLE}TangoMan ${BASEDIR} ${VERSION}${COLOR_DEFAULT}\n\n" | ||
|
||
@printf "${COLOR_PRIMARY} date:${COLOR_DEFAULT} ${COLOR_INFO}${DATETIME}${COLOR_DEFAULT}\n" | ||
@printf "${COLOR_PRIMARY} login:${COLOR_DEFAULT} ${COLOR_INFO}${WHOAMI}${COLOR_DEFAULT}\n" | ||
@printf "${COLOR_PRIMARY} system:${COLOR_DEFAULT} ${COLOR_INFO}${SYSTEM}${COLOR_DEFAULT}\n\n" | ||
@printf "${COLOR_TITLE}TangoMan $(shell basename ${CURDIR}) ${COLOR_DEFAULT}\n\n" | ||
@printf "${COLOR_PRIMARY} date:${COLOR_DEFAULT} ${COLOR_INFO}$(shell date '+%Y-%m-%d %H:%M:%S')${COLOR_DEFAULT}\n" | ||
@printf "${COLOR_PRIMARY} login:${COLOR_DEFAULT} ${COLOR_INFO}$(shell whoami)${COLOR_DEFAULT}\n" | ||
@printf "${COLOR_PRIMARY} system:${COLOR_DEFAULT} ${COLOR_INFO}$(shell uname -s)${COLOR_DEFAULT}\n\n" | ||
|
||
@printf "${COLOR_CAPTION}description:${COLOR_DEFAULT}\n\n" | ||
@printf "$(COLOR_WARNING) Callback Symfony Twig Extension Bundle${COLOR_DEFAULT}\n\n" | ||
|
||
@printf "${COLOR_CAPTION}Usage:${COLOR_DEFAULT}\n\n" | ||
@printf "$(COLOR_WARNING) make tests${COLOR_DEFAULT}\n\n" | ||
@printf "$(COLOR_WARNING) make test${COLOR_DEFAULT}\n\n" | ||
|
||
@printf "${COLOR_CAPTION}Available commands:${COLOR_DEFAULT}\n\n" | ||
@awk '/^### .+$$/ { printf "\n${COLOR_BOLD}%s${COLOR_DEFAULT}\n", substr($$0, 5) } \ | ||
/^[a-zA-Z\-\_0-9\@]+:/ { \ | ||
@awk '/^[a-zA-Z\-\_0-9\@]+:/ { \ | ||
HELP_LINE = match(LAST_LINE, /^## (.*)/); \ | ||
HELP_COMMAND = substr($$1, 0, index($$1, ":")); \ | ||
HELP_MESSAGE = substr(LAST_LINE, RSTART + 3, RLENGTH); \ | ||
printf " ${COLOR_LABEL}%-8s${COLOR_DEFAULT} ${COLOR_PRIMARY}%s${COLOR_DEFAULT}\n", HELP_COMMAND, HELP_MESSAGE; \ | ||
printf " ${COLOR_LABEL}%-16s${COLOR_DEFAULT} ${COLOR_PRIMARY}%s${COLOR_DEFAULT}\n", HELP_COMMAND, HELP_MESSAGE; \ | ||
} \ | ||
{ LAST_LINE = $$0 }' ${MAKEFILE_LIST} | ||
|
||
## Run test suite | ||
tests: update run | ||
|
||
## Update composer dependencies | ||
update: | ||
## Run tests | ||
tests: | ||
@if [ ! -d ./vendor ]; then \ | ||
make --no-print-directory composer-install; \ | ||
fi | ||
@if [ -x ./bin/phpunit ]; then \ | ||
php -d memory-limit=-1 ./bin/phpunit --stop-on-failure; \ | ||
elif [ -x ./vendor/bin/phpunit ]; then \ | ||
bash ./vendor/bin/phpunit --stop-on-failure; \ | ||
elif [ -x ./vendor/bin/simple-phpunit ]; then \ | ||
php -d memory-limit=-1 ./vendor/bin/simple-phpunit --stop-on-failure; \ | ||
else \ | ||
printf 'error: phpunit executable not found\n'; \ | ||
exit 1; \ | ||
fi | ||
|
||
## Dump coverage (requires XDebug) | ||
coverage: | ||
@if [ ! -d ./vendor ]; then \ | ||
make --no-print-directory composer-install; \ | ||
fi | ||
@if [ -x ./bin/phpunit ]; then \ | ||
php -d memory-limit=-1 ./bin/phpunit --coverage-html ${PUBLIC}/coverage; \ | ||
elif [ -x ./vendor/bin/phpunit ]; then \ | ||
bash ./vendor/bin/phpunit --coverage-html ${PUBLIC}/coverage; \ | ||
elif [ -x ./vendor/bin/simple-phpunit ]; then \ | ||
php -d memory-limit=-1 ./vendor/bin/simple-phpunit --coverage-html ${PUBLIC}/coverage; \ | ||
else \ | ||
printf 'error: phpunit executable not found\n'; \ | ||
exit 1; \ | ||
fi | ||
ifeq (${OS}, Windows_NT) | ||
composer update | ||
@start "${PUBLIC}/coverage/index.html" | ||
else | ||
php -d memory_limit=-1 `which composer` update | ||
@nohup xdg-open "${PUBLIC}/coverage/index.html" >/dev/null 2>&1 | ||
endif | ||
|
||
## Run test suite | ||
run: | ||
## Composer install Symfony project | ||
composer-install: | ||
ifeq (${OS}, Windows_NT) | ||
php -d memory_limit=-1 ./vendor/symfony/phpunit-bridge/bin/simple-phpunit --stop-on-failure | ||
composer install | ||
else | ||
php -d memory_limit=-1 ./vendor/bin/simple-phpunit --stop-on-failure | ||
php -d memory-limit=-1 $(shell which composer) install | ||
endif | ||
|
||
## Delete vendors | ||
clean: | ||
rm -rf /vendor | ||
rm -f composer.lock | ||
## Remove vendors, var/cache, var/logs & var/sessions | ||
uninstall: | ||
rm -f ./composer.lock | ||
rm -rf ./coverage | ||
rm -rf ./vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters