Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b2b5735
docs(README.adoc): udpate "Injecter un *repository* au lieu de *l'ent…
Nov 15, 2019
fd5a8e7
docs(README.adoc): udpate "Symfony Panther : les bases"
Nov 15, 2019
a2f5050
docs(README.adoc): insert "Exemple" blocks
Nov 15, 2019
d6a9e51
docs(README.adoc): udpate
Nov 15, 2019
6207e73
docs(README.adoc): typo
Nov 15, 2019
96534e9
docs(README.adoc): adjust badges
Nov 15, 2019
31b9cf8
docs(README.adoc): badges > typo in links
Nov 15, 2019
624c4b7
docs(README.adoc): udpate badges
Nov 15, 2019
5d448b9
docs(README.adoc): udpate badges again
Nov 15, 2019
0dfcd37
docs(README.adoc): simplify badges
Nov 15, 2019
1f97bea
docs(README.adoc): add ressources
Nov 15, 2019
3438a57
docs(README.adoc): udpate licence part
Nov 15, 2019
fecc961
dev(04_symfony.mk): create symfony.about.light command
Nov 15, 2019
5833a7e
dev(01_project.mk): ready > use symfony.about.light
Nov 15, 2019
fdb18cd
docs(README.adoc): udpate makefile commands
Nov 15, 2019
51eeded
tpl(news-index.html.twig): print 'no news'
Nov 15, 2019
86b5150
dev(01_project.mk): create env commands
Nov 16, 2019
c3996b8
content(.env.local.prod.dist): create base of file
Nov 16, 2019
b681880
conf(.env.local.test.dist): create base of file
Nov 16, 2019
ababab5
dev(.mk): create 04_encore.mk
Nov 17, 2019
b6e46cd
dev(99_makefile.mk): udpate help command
Nov 17, 2019
8479658
dev(01_project.mk): udpate install.xxx commands
Nov 17, 2019
16f9e87
dev(Makefile): include env.local also
Nov 17, 2019
704a505
dev(.mk): create 02_environment.mk & update all commands
Nov 17, 2019
d52f06a
dev(02_environment.mk): create env.ready command
Nov 17, 2019
3709417
dev(01_project.mk): use INTERNAL instead of PRIVATE
Nov 17, 2019
654d52a
dev(11_database.mk): use INTERNAL instead of PRIVATE
Nov 17, 2019
6757995
dev(01_project.mk): udpate install commands
Nov 17, 2019
1a8751d
dev.style(02_environment.mk): adjust spaces
Nov 17, 2019
6e9ab39
dev(06_symfony.mk): complete symfony.about.light command
Nov 17, 2019
08f168a
dev(02_environment.mk): udpate env.app command
Nov 17, 2019
f373af8
dev(Makefile): include ".env.$(APP_ENV).xxx" files
Nov 17, 2019
fc17a44
dev(03_composer.mk): create composer.dumpenv.prod command
Nov 17, 2019
75b3083
dev(02_environment.mk): udpate composer.dumpenv.prod command
Nov 17, 2019
6f5232b
docs(README.adoc): udpate " Utiliser les fichiers *.env*..."
Nov 17, 2019
0aff2fe
docs(README.adoc): udpate makefile commands
Nov 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.local.prod.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APP_ENV=prod
#APP_DEBUG=1
2 changes: 2 additions & 0 deletions .env.local.test.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APP_ENV=test
APP_DEBUG=1
2 changes: 2 additions & 0 deletions .mk/00_variables.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MAKE_S = $(MAKE) -s

USER_ID = $(shell id -u)
GROUP_ID = $(shell id -g)

Expand Down
39 changes: 31 additions & 8 deletions .mk/01_project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,35 @@ sh: ## Project: app sh access.
##

.PHONY: install
install: docker.start dependencies assets data ready ## Project: Install all (dependencies, data, assets, ...).
install: env.app docker.start dependencies assets data ready ## Project: Install all (dependencies, data, assets, ...) according to the current environment (APP_ENV).

.PHONY: install.dev
install.dev: env.local.dev ## Project: Force the installation for the "dev" environment.
$(MAKE_S) install

.PHONY: install.prod
install.prod: env.local.prod ## Project: Force the installation for the "prod" environment.
$(MAKE_S) install

##

.PHONY: dependencies
dependencies: composer.install yarn.install ## Project: Install the dependencies (only if there have been changes).

.PHONY: assets
assets: yarn.encore.compile ## Project: Generate all assets (webpack Encore, ...)
assets: ## Project: Generate all assets according to the current environment (APP_ENV).
@echo -e "\033[1;43mGenerate assets (APP_ENV=$(APP_ENV))\033[0m"
ifeq ($(APP_ENV),prod)
$(MAKE_S) assets.prod
else
$(MAKE_S) assets.dev
endif

.PHONY: assets.dev
assets.dev: encore.compile ## Project: Generate all assets (webpack Encore, ...) for the "dev" environment.

.PHONY: assets.prod
assets.prod: encore.deploy ## Project: Generate all assets (webpack Encore, ...) for the "prod" environment.

.PHONY: data
data: db.create ## Project: Install the data (db).
Expand All @@ -33,7 +55,7 @@ fixtures: alice.fixtures.load ## Project: Load all fixtures.
##

.PHONY: check
check: install composer.validate symfony.security.check db.validate tests ## Project: Launch of install / Composer, Security and DB validations / Tests
check: install.dev composer.validate symfony.security.check db.validate tests ## Project: Launch of install / Composer, Security and DB validations / Tests

.PHONY: tests
tests: fixtures phpunit ## Project: Launch all tests.
Expand Down Expand Up @@ -61,7 +83,7 @@ clean: ## Project: [PROMPT Y/n] Remove build, vendor & node_modules folders.
fi; \

#
# "PRIVATE"
# INTERNAL
#

.PHONY: _build
Expand All @@ -73,10 +95,11 @@ _build.clean: # Remove 'build' folder.
rm -rf $(PROJECT_BUILD)

.PHONY: ready
ready: symfony.about
ready: symfony.about.light
@echo -e "\033[1;42m"
@echo -e "READY!"
@echo -e "Website: \e[4m$(URL_WEBSITE)\\033[24m"
@echo -e "API: \e[4m$(URL_API)\\033[24m"
@echo -e "phpMyAdmin: \e[4m$(URL_PHPMYADMIN)\\033[24m\033[0m"
@echo -e " Website: \e[4m$(URL_WEBSITE)\\033[24m"
@echo -e " API: \e[4m$(URL_API)\\033[24m"
@echo -e " phpMyAdmin: \e[4m$(URL_PHPMYADMIN)\\033[24m\033[0m"
@echo
@$(MAKE_S) env.app
36 changes: 36 additions & 0 deletions .mk/02_environment.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## ENVIRONMENT

.PHONY: env.app
env.app: ## Environment: Print current APP_ENV in Makefile.
@echo -e '\033[1;43mAPP_ENV=$(APP_ENV)\033[0m';

.PHONY: env.local.dev
env.local.dev: env.local.clean ## Environment: Alias of `env.local.clean`.

.PHONY: env.local.prod
env.local.prod: .env.local.prod.dist ## Environment: Copy `.env.local.prod.dist` into `.env.local` (APP_ENV=prod)
cp .env.local.prod.dist .env.local
$(MAKE_S) composer.dumpenv.prod
$(MAKE_S) env.ready

.PHONY: env.local.test
env.local.test: .env.local.test.dist ## Environment: Copy `.env.local.test.dist` into `.env.local` (APP_ENV=test)
cp .env.local.test.dist .env.local
$(MAKE_S) env.ready

.PHONY: env.local.clean
env.local.clean: ## Environment: Remove `.env.local` and use default vars & environment of `.env` (APP_ENV=dev)
rm -f .env.local.php
rm -f .env.local
rm -f .env.*.local
$(MAKE_S) env.ready

#
# INTERNAL
#

.PHONY: env.ready
env.ready:
$(MAKE_S) cc
$(MAKE_S) symfony.about
$(MAKE_S) env.app
4 changes: 4 additions & 0 deletions .mk/02_composer.mk → .mk/03_composer.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ composer.licenses: ## Composer: List the name, version and license of every pack
composer.validate: ## Composer: Check if your composer.json is valid. | https://getcomposer.org/doc/03-cli.md#validate
docker-compose run --no-deps $(SERVICE_APP) composer validate --no-check-publish

.PHONY: composer.dumpenv.prod
composer.dumpenv.prod: ## Composer: Dump .env files for "prod".
$(COMPOSER) dump-env prod

25 changes: 0 additions & 25 deletions .mk/03_yarn.mk

This file was deleted.

11 changes: 11 additions & 0 deletions .mk/04_yarn.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## YARN

.PHONY: yarn.install
yarn.install: ## Yarn: Install all dependencies.
@echo -e "\033[1;43mYarn: Install\033[0m"
$(YARN) install

.PHONY: yarn.upgrade
yarn.upgrade: ## Yarn: Upgrade packages to their latest version based on the specified range.
@echo -e "\033[1;43mYarn: Upgrade\033[0m"
$(YARN) upgrade
15 changes: 15 additions & 0 deletions .mk/05_encore.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## ENCORE

.PHONY: encore.compile
# Prevent "An exception has been thrown during the rendering of a template ("Asset manifest file "/srv/app/public/build/manifest.json" does not exist.")."
# See https://stackoverflow.com/questions/51393459/symfony-error-an-exception-has-been-thrown-during-the-rendering-of-a-template
encore.compile: ## Webpack Encore: Compile assets once.
$(YARN) encore dev

.PHONY: encore.watch
encore.watch: ## Webpack Encore: Recompile assets automatically when files change.
$(YARN) encore dev --watch

.PHONY: encore.deploy
encore.deploy: ## Webpack Encore: On deploy, create a production build.
$(YARN) encore production
5 changes: 5 additions & 0 deletions .mk/04_symfony.mk → .mk/06_symfony.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ symfony.routes: ## Symfony: Display current routes.
symfony.about: ## Symfony: Display information about the current project (Symfony, Kernel, PHP, Environment, ...).
$(SYMFONY) about

.PHONY: symfony.about.light
symfony.about.light: ## Symfony: Display information about the current project (grep APP_ENV & DATABASE_NAME).
@echo -e '\033[1;43mSymfony about (light):\033[0m';
$(SYMFONY) about | grep 'APP_ENV\|DATABASE_NAME'

.PHONY: symfony.env.vars
symfony.env.vars: ## Symfony: List defined environment variables. | https://symfony.com/doc/current/configuration.html#configuration-based-on-environment-variables
$(SYMFONY) debug:container --env-vars
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion .mk/09_database.mk → .mk/11_database.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ db.mysql: db.wait ## Database: MySQL access (mysql> ...).
$(EXEC_DB) bash -c "mysql -u $(DATABASE_USER) $(DATABASE_NAME)"

#
# "PRIVATE"
# INTERNAL
#

PHONY: db.wait
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions .mk/99_makefile.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.DEFAULT_GOAL := help

## MAKEFILE

.DEFAULT_GOAL := help
.PHONY: help
help: ## Makefile: Print self-documented Makefile.
@grep -E '(^[a-zA-Z_-.]+[^:]+:.*##.*?$$)|(^#{2})' $(MAKEFILE_LIST) \
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ SHELL:=/bin/bash
# @see https://www.gnu.org/software/make/manual/html_node/Environment.html
# @see https://github.com/symfony/recipes/issues/18
-include .env
-include .env.local
-include .env.$(APP_ENV)
-include .env.$(APP_ENV).local

MAKEFILES = .mk/*.mk
include $(sort $(wildcard $(MAKEFILES)))
Loading