-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
130 lines (94 loc) · 3.33 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
ENV?=local
ifeq ($(ENV), local)
SYMFONY_ENV=dev
else ifeq ($(ENV), test)
SYMFONY_ENV=test
else ifeq ($(ENV), demo)
SYMFONY_ENV=prod
else
SYMFONY_ENV=$(ENV)
endif
DIRECTORY_NAME := $(shell pwd | xargs basename | tr -cd 'A-Za-z0-9_-')
DOCKER_HOST_IP := $(shell docker-machine ip 2> /dev/null)
THIS_FILE := $(lastword $(MAKEFILE_LIST))
DC=docker-compose \
-p $(ENV)_$(DIRECTORY_NAME) \
-f docker-compose.yml \
-f docker/docker-compose.$(ENV).yml \
-f docker/docker-compose.override.yml
PHP=$(DC) run --rm php
COMPOSER=$(PHP) php -n -d extension=zip.so -d memory_limit=-1 composer.phar
all: configure composer-install init vendors-install
database-reload: database-drop database-create schema-update fixtures-load
lint: lint-fix
test: test-unit test-component test-functional test-acceptance
test-without-acceptance: test-unit test-component test-functional
configure:
cp -n docker/docker-compose.override.yml.dist docker/docker-compose.override.yml
#tells you which docker container are running under this project
ps:
$(DC) ps
version:
$(DC) --version
pull:
$(DC) pull
#rebuilds the containers
build:
$(DC) build
init:
$(DC) pull
$(DC) build
stop:
$(DC) kill
#cleans the containers for all environments
clean-all:
$(eval $@_NAME := $(shell echo $(DIRECTORY_NAME) | tr -d '_-'))
docker stop $(shell docker ps -a -q --filter="name=$($@_NAME)")
docker rm -vf $(shell docker ps -a -q --filter="name=$($@_NAME)")
#removes ALL containers, not just does under this project
clean-docker:
docker kill $(docker ps -a -q)
docker rm $(docker ps -a -q)
composer-install:
$(PHP) bash -c 'if [ -f composer.phar ]; then echo "Updating composer..." && php composer.phar self-update; else echo "Installing composer..." && curl -s http://getcomposer.org/installer | php; fi'
composer-dump-autoload:
$(COMPOSER) dump-autoload
database-drop:
$(PHP) php bin/console -v doctrine:database:drop --force
database-create:
$(PHP) php bin/console -v doctrine:database:create
schema-update:
$(PHP) php bin/console -v doctrine:schema:update --force
fixtures-load:
$(PHP) php bin/console -v --no-interaction hautelook_alice:doctrine:fixtures:load
lint:
$(PHP) php -n bin/php-cs-fixer fix --no-interaction --dry-run --diff -vvv
lint-fix:
$(PHP) php -n bin/php-cs-fixer fix --no-interaction
vendors-install:
$(COMPOSER) install --no-interaction --prefer-source
vendors-install-prod:
rm -rf vendor
$(COMPOSER) install --no-interaction --prefer-dist --optimize-autoloader --no-dev
vendors-update:
$(COMPOSER) update
test-acceptance:
$(PHP) php vendor/behat/behat/bin/behat -v -p firefox
test-acceptance-browserkit:
$(PHP) php vendor/behat/behat/bin/behat -v
test-acceptance-chrome:
$(PHP) php vendor/behat/behat/bin/behat -v -p chrome
test-acceptance-debug:
$(DC) run --rm -e XDEBUG=1 php vendor/behat/behat/bin/behat -v -p firefox
test-functional:
$(PHP) php vendor/phpunit/phpunit/phpunit -v tests/Functional
test-functional-debug:
$(DC) run --rm -e XDEBUG=1 php vendor/phpunit/phpunit/phpunit -v tests/Functional
test-component:
$(PHP) php vendor/phpunit/phpunit/phpunit -v tests/Component
test-component-debug:
$(DC) run --rm -e XDEBUG=1 php vendor/phpunit/phpunit/phpunit -v tests/Component
test-unit:
$(PHP) php vendor/phpunit/phpunit/phpunit -v tests/Unit
test-unit-debug:
$(DC) run --rm -e XDEBUG=1 php vendor/phpunit/phpunit/phpunit -v tests/Unit