Beta J-577 !
MakeFile

Makefile pour symfony (exemple)

Par Julie, le 15/07/2018
.PHONY: help

CONSOLE=php bin/console
PHPUNIT=bin/phpunit

## Colors
COLOR_RESET			= \033[0m
COLOR_ERROR			= \033[31m
COLOR_INFO			= \033[32m
COLOR_COMMENT		= \033[33m
COLOR_TITLE_BLOCK	= \033[0;44m\033[37m

## Help
help:
	@printf "${COLOR_TITLE_BLOCK}Makefile help${COLOR_RESET}\n"
	@printf "\n"
	@printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n"
	@printf " make [target]\n\n"
	@printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n"
	@awk '/^[a-zA-Z\-\_0-9\@]+:/ { \
		helpLine = match(lastLine, /^## (.*)/); \
		helpCommand = substr($$1, 0, index($$1, ":")); \
		helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
		printf " ${COLOR_INFO}%-16s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
	} \
	{ lastLine = $$0 }' $(MAKEFILE_LIST)

## Create db
create-db:
	$(CONSOLE) doctrine:database:create
	$(CONSOLE) doctrine:schema:update --force
	$(CONSOLE) doctrine:fixtures:load --no-interaction
	$(CONSOLE) doctrine:schema:validate

## Drop, rebuild & loading fixtures
boot-db:
	$(CONSOLE) doctrine:database:drop --force
	$(CONSOLE) doctrine:database:create
	$(CONSOLE) doctrine:schema:update --force
	$(CONSOLE) doctrine:fixtures:load --no-interaction
	$(CONSOLE) doctrine:schema:validate
	$(CONSOLE) cache:clear

## Update db & validate schema
update-db:
	$(CONSOLE) doctrine:schema:update --force
	$(CONSOLE) doctrine:schema:validate
	$(CONSOLE) cache:clear

## Create db test & loading fixtures
create-db-test:
	$(CONSOLE) doctrine:database:create --env=test
	$(CONSOLE) doctrine:schema:update --env=test --force
	$(CONSOLE) doctrine:fixtures:load --env=test --no-interaction
	$(CONSOLE) doctrine:schema:validate --env=test
	$(PHPUNIT) --coverage-html web/test-coverage

## Drop, rebuild & loading fixtures for test database
boot-db-test:
	$(CONSOLE) doctrine:database:drop --env=test --force
	$(CONSOLE) doctrine:database:create --env=test
	$(CONSOLE) doctrine:schema:update --env=test --force
	$(CONSOLE) doctrine:fixtures:load --env=test --no-interaction
	$(CONSOLE) doctrine:schema:validate --env=test
	$(CONSOLE) cache:clear
	$(PHPUNIT) --coverage-html web/test-coverage

## Display test with web/coverage
test:
	$(PHPUNIT) --coverage-html web/test-coverage

## Clear your cache
cc:
	$(CONSOLE) && $(CONSOLE) cache:clear --no-warmup || rm -rf var/cache/*

## Yarn install
yarn:
	yarn install

## Yarn run
yarn-watch:
	yarn run encore dev --watch

## Yarn run production
yarn-watch-prod:
	yarn run encore production

Cet article est paru dans les catégories suivantes: Tutos Divers