Skip to content

Commit 587a9d1

Browse files
committed
[Makefile] Use APP_ENV from .env file instead ENV
1 parent ce2fb2b commit 587a9d1

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
project/
2+
!project/.gitkeep
23
.env
34
!.env.dist
45
docker-compose.override.yml

Makefile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ EXEC_ROOT?=$(DOCKER_COMPOSE) exec -u root php
1111
CONSOLE=bin/console
1212
PHPCSFIXER?=$(EXEC) php -d memory_limit=1024m vendor/bin/php-cs-fixer
1313
DOCKER_COMPOSE_OVERRIDE ?= dev
14-
ENV ?= dev
1514

1615
help:
1716
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(firstword $(MAKEFILE_LIST)) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
@@ -31,7 +30,7 @@ stop: ## Stop docker containers
3130

3231
restart: stop up-ci ## Restart docker containers
3332

34-
install: docker-compose.override.yml build up composer-install perm ## Create and start docker containers
33+
install: docker-compose.override.yml build up ## Create and start docker containers
3534

3635
install-demo:
3736
@$(EXEC_ROOT) chmod 775 /var/www
@@ -40,19 +39,19 @@ install-demo:
4039
$(call composer,create-project symfony/symfony-demo demo)
4140
@cp .docker/php/symfony-demo.env project/.env
4241
@$(EXEC_ROOT) bash -c "mv demo/* . && rm -rf demo/ data/"
43-
@make restart perm db-create-migration db-install db-fixtures clear-cache
42+
@make restart perm db-create-migration db-install clear-cache
4443

4544
status: ## Docker container status
4645
@$(DOCKER_COMPOSE) ps
4746

48-
uninstall: stop clear ## Remove docker containers
47+
uninstall: clear stop ## Remove docker containers
4948
@$(DOCKER_COMPOSE) rm -vf
5049

5150
reset: uninstall install ## Remove and re-create docker containers
5251

5352
clear-cache: perm ## Clear + Prepare Cache (alias: c:c), you can specify the env: ENV=prod
54-
@$(EXEC) $(CONSOLE) cache:clear --no-warmup --env=$(ENV)
55-
@$(EXEC) $(CONSOLE) cache:warmup --env=$(ENV)
53+
@$(EXEC) $(CONSOLE) cache:clear --no-warmup --env=$(APP_ENV)
54+
@$(EXEC) $(CONSOLE) cache:warmup --env=$(APP_ENV)
5655

5756
c\:c: clear-cache
5857

@@ -96,20 +95,22 @@ db-create-migration: ## Create migration
9695
@$(EXEC) $(CONSOLE) make:migration
9796

9897
db-migrate: ## Migrate database schema to the latest available version
99-
@$(EXEC) $(CONSOLE) doctrine:migration:migrate -n --env=$(ENV)
98+
@$(EXEC) $(CONSOLE) doctrine:migration:migrate -n --env=$(APP_ENV)
10099

101100
db-rollback: ## Rollback the latest executed migration
102-
@$(EXEC) $(CONSOLE) doctrine:migration:migrate prev -n --env=$(ENV)
101+
@$(EXEC) $(CONSOLE) doctrine:migration:migrate prev -n --env=$(APP_ENV)
103102

104103
db-validate: ## Check the ORM mapping
105104
@$(EXEC) $(CONSOLE) doctrine:schema:validate
106105

107-
db-install: ## Install database, you can add 'db-fixtures' argument for apply fixtures after install
106+
db-create-database: ## Create database if not exists
108107
@$(EXEC) $(CONSOLE) doctrine:database:create --if-not-exists
109-
@$(EXEC) $(CONSOLE) doctrine:migrations:migrate -n --env=$(ENV)
110108

111109
db-fixtures: ## Apply doctrine fixtures
112-
@$(EXEC) $(CONSOLE) doctrine:fixtures:load -n --env=$(ENV)
110+
@$(EXEC) $(CONSOLE) doctrine:fixtures:load -n --env=$(APP_ENV)
111+
112+
db-install: db-create-database db-migrate db-fixtures ## Drop and install database with schema + fixtures
113+
113114

114115
# ##
115116
# ## Assets
@@ -197,4 +198,4 @@ endif
197198
# @$(EXEC) yarn install
198199
#
199200
#yarn.lock: package.json
200-
# @echo yarn.lock is not up to date.
201+
# @echo yarn.lock is not up to date.
File renamed without changes.

0 commit comments

Comments
 (0)