-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
174 lines (131 loc) · 4.61 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
# Makefile
#
# Common Makefile for web projects.
#
# @author Michał Pałys-Dudek <[email protected]>
# @link TBD
# @version 0.1.0
# @date 28.08.2015
# ---------------------------------------------------------------------------
#
# MD\Foundation
.PHONY: help all install install_dev clear assets warmup run prepublish postpublish css js watch test lint qa report docs noop composer composer_dev workers workers_start assets assets_install cache cache_file cache_app knit_indexes phpunit phpcs phpcs_test phpcs_fix phpcs_test_fix phpmd jslint npm_dev
# Variables
# ---------------------------------------------------------------------------
# Current path.
CWD=`pwd`
# Previous release path.
PREVIOUS_PATH?=$(CWD)
# Current (new) release path.
CURRENT_PATH?=$(CWD)
# Targets
# ---------------------------------------------------------------------------
help:
@echo ""
@echo "Following commands are available:"
@echo "(this is summary of the main commands,"
@echo " but for more fine-grained commands see the Makefile)"
@echo ""
@echo " make help : This info."
@echo ""
@echo " Installation:"
@echo " make install : Installs all dependencies for production."
@echo " make install_dev : Installs all dependencies (including dev dependencies)"
@echo " make clear : Clears any build artifacts, caches, installed packages, etc."
@echo ""
@echo " Quality Assurance:"
@echo " make test : Run tests."
@echo " make lint : Lint the code."
@echo " make qa : Run tests, linters and any other quality assurance tool."
@echo " make report : Build reports about the code / the project / the app."
@echo " make docs : Build docs."
@echo ""
# alias for help
all: help
# Docker containers for tests
docker:
docker-compose up -d
docker-compose exec php /bin/sh
docker-stop:
docker-compose stop
# Installation
# ---------------------------------------------------------------------------
# Installs all dependencies for production.
install: composer
# Installs all dependencies (including dev dependencies)
install_dev: composer_dev
# Clears any build artifacts, caches, installed packages, etc.
clear: noop
# Installs / prepares / builds the frontend assets.
assets: noop
# Warms up the application.
warmup: noop
# Runs / restarts the application.
run: noop
# Deployment
# ---------------------------------------------------------------------------
# Runs everything that needs to be ran before publishing the app.
prepublish: noop
# Runs everything that needs to be ran after the app has been published.
postpublish: noop
# Development
# ---------------------------------------------------------------------------
# Build CSS.
css: noop
# Build JavaScript.
js: noop
# Watch files for changes and trigger appropriate tasks on changes.
watch: noop
# Quality Assurance
# ---------------------------------------------------------------------------
# Run tests.
test: phpunit
# Lint the code.
lint: phpcs phpmd
# Run tests, linters and any other quality assurance tool.
qa: test lint
# Build reports about the code / the project / the app.
report: phpunit_coverage
# Build docs.
docs:
git checkout gh-pages
composer update
php bin/genry generate
git commit -a -m "Docs update"
git checkout master
# Misc
# ---------------------------------------------------------------------------
noop:
@echo "Nothing to do."
# End of interface
# ----------------
# ---------------------------------------------------------------------------
# App specific commands
# ---------------------------------------------------------------------------
# install Composer dependencies for production
composer:
composer install --no-interaction --no-dev --prefer-dist --optimize-autoloader
# install Composer dependencies for development
composer_dev:
composer install --no-interaction --prefer-dist
# run the PHPUnit tests
phpunit:
php ./vendor/bin/phpunit -c phpunit.xml.dist
# run the PHPUnit tests with coverage report
phpunit_coverage:
php ./vendor/bin/phpunit -c phpunit.cov.xml
# run PHPCS on the source code and show any style violations
phpcs:
php ./vendor/bin/phpcs --standard="phpcs.xml" src
# run PHPCBF to auto-fix code style violations
phpcs_fix:
php ./vendor/bin/phpcbf --standard="phpcs.xml" src
# run PHPCS on the test code and show any style violations
phpcs_test:
php ./vendor/bin/phpcs --standard="phpcs.xml" tests
# run PHPCBF on the test code to auto-fix code style violations
phpcs_test_fix:
php ./vendor/bin/phpcbf --standard="phpcs.xml" tests
# Run PHP Mess Detector on the source code
phpmd:
php ./vendor/bin/phpmd src text ./phpmd.xml