-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
179 lines (138 loc) · 4.58 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#
# Makefile
# Les Polypodes, 2014-08-06 15:41
# Licence: MIT
# Source: https://github.com/polypodes/Deploy/blob/master/Symfony2/Makefile
# Usage:
# me@myserver$~: make help
# me@myserver$~: make pull
# me@myserver$~: make install
# me@myserver$~: make sniff
# me@myserver$~: make codecoverage
# etc.
############################################################################
# Vars
# some lines may be useless for now, but these are nice tricks:
PWD := $(shell pwd)
VENDOR_PATH := $(PWD)/vendor
BIN_PATH := $(PWD)/bin
NOW := $(shell date +%Y-%m-%d--%H-%M-%S)
REPO := "https://github.com/..."
BRANCH := 'master'
# Colors
YELLOW := $(shell tput bold ; tput setaf 3)
GREEN := $(shell tput bold ; tput setaf 2)
RESETC := $(shell tput sgr0)
############################################################################
# Mandatory tasks:
vendor/autoload.php:
composer install --optimize-autoloader
############################################################################
# Specific, project-related sf2 tasks:
integration:
@echo
@cd integration
@gulp build
@cd ../
data: vendor/autoload.php
@echo "Install initial datas..."
@app/console dbal:data:initialize --purge
fixtures: vendor/autoload.php
@echo "Install fixtures in db..."
@php app/console h4cc_alice_fixtures:load:sets
############################################################################
# Generic sf2 tasks:
help:
@echo
@echo "${GREEN}Usual tasks:${RESETC}"
@echo
@echo "\tTo install: make install"
@echo "\tTo reinstall: make reinstall"
@echo "${GREEN}Other specific tasks:${RESETC}"
@echo
@echo "\tTo deploy: make deploy"
@echo "\tTo clear all caches: make clear"
@echo "\tTo run tests: make tests"
@echo
check:
@php app/check.php
all: vendor/autoload.php check help
pull:
@git pull origin $(BRANCH)
dropDb: vendor/autoload.php
@echo
@echo "Drop database..."
@php app/console doctrine:database:drop --force
createDb: vendor/autoload.php
@echo
@echo "Create database..."
@php app/console doctrine:database:create
@php app/console doctrine:schema:update --force
schemaDb: vendor/autoload.php
@echo
@echo "Configure database schema..."
@php app/console doctrine:schema:update --force
assets:
@echo "\nPublishing assets..."
@php app/console assets:install --symlink
clear: vendor/autoload.php
@echo
@echo "Resetting caches..."
@php app/console cache:clear --env=prod --no-debug
@php app/console cache:clear --env=dev
explain:
@echo "git pull origin master + update db schema + build integration + copy new assets + rebuild prod cache"
@echo "Note you can change the git remote repo username in .git/config"
behavior: vendor/autoload.php
@echo "Run behavior tests..."
# bin/behat --lang=fr "@AcmeDemoBundle"
bin/behat --suite=api_suite
unit: vendor/autoload.php
@echo "Run unit tests..."
@php bin/phpunit -c build/phpunit.xml -v
codecoverage: vendor/autoload.php
@echo "Run coverage tests..."
@bin/phpunit -c build/phpunit.xml -v --coverage-html ./build/codecoverage
continuous: vendor/autoload.php
@echo "Starting continuous tests..."
@while true; do bin/phpunit -c build/phpunit.xml -v; done
sniff: vendor/autoload.php
bin/phpcs --standard=PSR2 src -n
quality:
@echo "Starting code check-up..."
# phploc: https://github.com/sebastianbergmann/phploc
# phpmd: https://github.com/phpmd/phpmd
# phpcpd: https://github.com/sebastianbergmann/phpcpd
# pdepend: https://github.com/pdepend/pdepend
# php-cs-fixer: https://github.com/fabpot/PHP-CS-Fixer
@phploc src
@phpcs --standard=build/phpcs.xml src
@phpmd src text codesize,unusedcode,naming
@phpcpd src
@pdepend src
@php-cs-fixer fix src --dry-run
deploy: vendor/autoload.php
@echo "UPDATING using git pull origin $(BRANCH) + update db schema + rebuild prod cache..."
@echo "Note you can change the git remote repo username in .git/config"
@git pull origin $(BRANCH)
@$(MAKE) schemaDb
@php app/console cache:clear --env=prod --no-debug
done:
@echo
@echo "${GREEN}Done.${RESETC}"
# Tasks sets:
all: vendor/autoload.php check
prepareDb: createDb schemaDb
purgeDb: dropDb createDb schemaDb
#install: prepareDb data assets clear done
install: prepareDb clear done
reinstall: dropDb install
tests: reinstall fixtures behavior unit codecoverage
deploy: explain install done
############################################################################
# .PHONY tasks list
.PHONY: integration data fixtures help check all pull dropDb createDb
.PHONY: schemaDb assets clear explain behavior unit codecoverage
.PHONY: continuous sniff quality deploy done prepareDb purgeDb
.PHONY: install reinstall test deploy
# vim:ft=make