MAKETASK RUNNER GREAT AGAIN@GillesRoustan
View Slide
BASH PHING COMPOSERROBO BLDR GRUMPHPNPM GULP GRUNT...@GillesRoustan
MAKEONE TOOL TO RULE THEM ALL@GillesRoustan
INDEPENDANT
HOW-TO ?@GillesRoustan
# Makefiletarget:[prerequisites][recipe]
# Makefiletarget:[prerequisites]\t [recipe]
$ make target
MAKEIS NOT A TASK RUNNER
file.o: file.cgcc file.c -o file.o
.PHONY: installinstall: file.ofile.o: file.cgcc file.c -o file.o
$ make installgcc file.c -o file.o...
$ make installRien à faire pour larègle...
MAKEME UP, BEFORE YOU GO GO@GillesRoustan
vendor: composer.lockcomposer installcomposer.lock: composer.jsoncomposer update
.PHONY: installinstall: vendor[...]
$ make installcomposer install...
$ make --always-make installcomposer update...
.PHONY: install updateupdate:$(MAKE) --always-make installinstall: vendor
MAKECONFIGURATION@GillesRoustan
ENV = dev
ENV ?= dev
ENV ?= devvendor: composer.lockifeq ($(ENV), prod)composer install --no-dev--optimize-autoloaderelsecomposer installendif
$ make install ENV=prodcomposer install --no-dev--optimize-autoloader...
GREATER ?@GillesRoustan
ENV ?= devCOMPOSER_ARGS ?=ifeq ($(ENV), prod)COMPOSER_ARGS= --no-dev--optimize-autoloaderendifvendor: composer.lockcomposer install $(COMPOSER_ARGS)
INCLUDEEH MAKE, ELLE EST OÙ MA CAISSE ?@GillesRoustan
include *.mk
include .env
https://github.com/symfony/dotenv
.env:@if [ ! -e .env ]; then \cp env.dist .env; \fiinclude .env
MAKECONTINOUS INTEGRATION GREAT AGAIN@GillesRoustan
test-unit: installvendor/bin/phpunit $(PHPUNIT_ARGS)
# .travis.ymlsudo: requiredservices:- dockerscript:- make test-unit
MAKEIT WITH DOCKER@GillesRoustan
test-unit: installdocker exec -it my-containervendor/bin/phpunit
EXEC=docker exec -it my-containertest-unit: install$(EXEC) vendor/bin/phpunit
MAKEFUNCTIONS ?@GillesRoustan
test-unit: install$(call execute, vendor/bin/phpunit)define executedocker exec -it my-container $(1)@echo $(1) >> make.logendef
DOCKER EST UNENVIRONNEMENT
# .envENV=devDOCKER=true
ifeq ($(DOCKER), true)define executedocker exec -it my-container $(1)endefelsedefine execute$(1)endefendif
clean:$(call execute, \chmod -R 0777 var && \rm -Rf var/cache/prod && \rm -Rf var/cache/dev \)
MAKEMONO-REPOSITORY@GillesRoustan
.PHONY: installinstall:$(MAKE) --directory=app-php install
.PHONY: installinstall:$(MAKE) -directory=app-php install$(MAKE) -directory=app-js install$(MAKE) -C app-ologies install$(MAKE) -C app-artement install$(MAKE) -C app-toum install$(MAKE) -C app-app-app install
MAKEMONO-REPOSITORY EASY !@GillesRoustan
DIRS:=$(dir $(wildcard */)).PHONY: install $(DIRS)install: $(DIRS)test-unit: $(DIRS)$(DIRS):$(MAKE) [email protected] $(MAKECMDGOALS)
MAKEI HELP YOU ?@GillesRoustan
help: ## This help@grep -E '^[a-zA-Z_-]+:.*?## .*$$'$(TARGETS) | sort | awk 'BEGIN {FS =":.*?## "}; {printf"\033[36m%-30s\033[0m %s\n", $$1,$$2}'
help: ## This help@grep -E '^[a-zA-Z_-]+:.*?## .*$$'$(TARGETS) | sort | awk 'BEGIN {FS =":.*?## "}; {printf"\033[36m%-30s\033[0m %s\n", $$1,$$2}'https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
$ make helpinstall Install appundate Update apptest-unit Unit test appminify Minify js/cssserve Run server...
ADOPTE UNMAKE
https://github.com/gbprod/conf-makefile
THANK YOUQUESTIONS ?