forked from akeneo/pim-community-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
166 lines (127 loc) · 4.65 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
DOCKER_COMPOSE = docker-compose
YARN_EXEC = $(DOCKER_COMPOSE) run --rm node yarn
PHP_RUN = $(DOCKER_COMPOSE) run -u docker --rm fpm php
PHP_EXEC = $(DOCKER_COMPOSE) exec -u docker fpm php
LESS_FILES=$(shell find web/bundles -name "*.less")
REQUIRE_JS_FILES=$(shell find . -name "requirejs.yml")
FORM_EXTENSION_FILES=$(shell find . -name "form_extensions.yml")
TRANSLATION_FILES=$(shell find . -name "jsmessages*.yml")
ASSET_FILES=$(shell find . -path "*/Resources/public/*")
LOCALE_TO_REFRESH=$(shell find . -newer web/js/translation -name "jsmessages*.yml" | grep -o '[a-zA-Z]\{2\}_[a-zA-Z]\{2\}')
.DEFAULT_GOAL := help
.PHONY: help
help:
@echo ""
@echo "Caution: those targets are optimized for docker"
@echo ""
@echo "Please add your custom Makefile in the directory "make-file". They will be automatically loaded!"
@echo ""
## Include all *.mk files
include make-file/*.mk
## Clean backend cache
.PHONY: clean
clean:
rm -rf var/cache
##
## PIM configuration
##
behat.yml:
cp ./behat.yml.dist ./behat.yml
sed -i "s/127.0.0.1\//httpd-behat\//g" ./behat.yml
sed -i "s/127.0.0.1/selenium/g" ./behat.yml
docker-compose.override.yml:
cp docker-compose.override.yml.dist docker-compose.override.yml
.env:
cp .env.dist .env
## Remove all configuration file generated
.PHONY: reset-conf
reset-conf:
rm .env docker-compose.override.yml behat.yml
##
## PIM installation
##
composer.lock: composer.json
$(PHP_RUN) /usr/local/bin/composer update
vendor: composer.lock
$(PHP_RUN) /usr/local/bin/composer install
node_modules: package.json
$(YARN_EXEC) install
web/css/pim.css: $(LESS_FILES)
$(YARN_EXEC) run less
web/js/require-paths.js: $(REQUIRE_JS_FILES)
$(PHP_EXEC) bin/console pim:installer:dump-require-paths
web/bundles: $(ASSET_FILES)
$(PHP_EXEC) bin/console assets:install --relative --symlink
web/js/translation:
$(PHP_EXEC) bin/console oro:translation:dump 'en_US, ca_ES, da_DK, de_DE, es_ES, fi_FI, fr_FR, hr_HR, it_IT, ja_JP, nl_NL, pl_PL, pt_BR, pt_PT, ru_RU, sv_SE, tl_PH, zh_CN, sv_SE, en_NZ'
## Instal the PIM asset: copy asset from src to web, generate require path, form extension and translation
.PHONY: install-asset
install-asset: vendor node_modules web/bundles web/css/pim.css web/js/require-paths.js web/js/translation
for locale in $(LOCALE_TO_REFRESH) ; do \
$(PHP_EXEC) bin/console oro:translation:dump $$locale ; \
done
## Prevent translations update next time
touch web/js/translation
$(PHP_EXEC) bin/console fos:js-routing:dump --target web/js/routes.js
## Initialize the PIM database depending on an environment
.PHONY: install-database-test
install-database-test: docker-compose.override.yml vendor
$(PHP_EXEC) bin/console --env=behat pim:installer:db
.PHONY: install-database-prod
install-database-prod: docker-compose.override.yml vendor
$(PHP_EXEC) bin/console --env=prod pim:installer:db
## Initialize the PIM frontend depending on an environment
.PHONY: build-front-dev install-asset
build-front-dev: docker-compose.override.yml node_modules
$(YARN_EXEC) run webpack-dev
.PHONY: build-front-test install-asset
build-front-test: docker-compose.override.yml node_modules
$(YARN_EXEC) run webpack-test
## Initialize the PIM: install database (behat/prod) and run webpack
.PHONY: install-pim
install-pim: vendor node_modules clean install-asset build-front-dev build-front-test install-database-test install-database-prod
##
## Docker
##
## Start docker containers
.PHONY: up
up: .env docker-compose.override.yml
$(DOCKER_COMPOSE) up -d --remove-orphan
## Stop docker containers, remove volumes and networks
.PHONY: down
down:
$(DOCKER_COMPOSE) down -v
##
## Xdebug
##
## Enable Xdebug
.PHONY: xdebug-on
xdebug-on: docker-compose.override.yml
PHP_XDEBUG_ENABLED=1 $(MAKE) up
## Disable Xdebug
.PHONY: xdebug-off
xdebug-off: docker-compose.override.yml
PHP_XDEBUG_ENABLED=0 $(MAKE) up
##
## Run tests suite
##
.PHONY: coupling ## Run the coupling-detector on Everything
coupling: structure-coupling user-management-coupling channel-coupling enrichment-coupling
.PHONY: phpspec
phpspec: vendor
PHP_XDEBUG_ENABLED=0 ${PHP_RUN} vendor/bin/phpspec run ${F}
.PHONY: phpspec-debug
phpspec-debug: vendor
PHP_XDEBUG_ENABLED=1 ${PHP_RUN} vendor/bin/phpspec run ${F}
.PHONY: behat-acceptance
behat-acceptance: behat.yml vendor
PHP_XDEBUG_ENABLED=0 ${PHP_RUN} vendor/bin/behat -p acceptance ${F}
.PHONY: behat-acceptance-debug
behat-acceptance-debug: behat.yml vendor
PHP_XDEBUG_ENABLED=1 ${PHP_RUN} vendor/bin/behat -p acceptance ${F}
.PHONY: phpunit
phpunit: vendor
${PHP_EXEC} vendor/bin/phpunit -c app ${F}
.PHONY: behat-legacy
behat-legacy: behat.yml vendor node_modules
$(DOCKER_COMPOSE) exec -u docker -e APP_ENV=behat fpm php vendor/bin/behat -p legacy ${F}