forked from payplug/SyliusPayPlugPlugin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
109 lines (91 loc) · 4.36 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
.DEFAULT_GOAL := help
SHELL=/bin/bash
COMPOSER_ROOT=composer
TEST_DIRECTORY=tests/Application
CONSOLE=cd tests/Application && php bin/console -e test
COMPOSER=cd tests/Application && composer
YARN=cd tests/Application && yarn
SYLIUS_VERSION=1.12.0
SYMFONY_VERSION=6.1
PHP_VERSION=8.1
PLUGIN_NAME=payplug/sylius-payplug-plugin
###
### DEVELOPMENT
### ¯¯¯¯¯¯¯¯¯¯¯
install: sylius ## Install Plugin on Sylius [SYLIUS_VERSION=1.12.0] [SYMFONY_VERSION=6.1] [PHP_VERSION=8.1]
.PHONY: install
reset: ## Remove dependencies
ifneq ("$(wildcard tests/Application/bin/console)","")
${CONSOLE} doctrine:database:drop --force --if-exists || true
endif
rm -rf tests/Application
.PHONY: reset
phpunit: phpunit-configure phpunit-run ## Run PHPUnit
.PHONY: phpunit
###
### OTHER
### ¯¯¯¯¯¯
sylius: sylius-standard install-plugin install-sylius
.PHONY: sylius
sylius-standard:
ifeq ($(shell [[ $(SYLIUS_VERSION) == *dev ]] && echo true ),true)
${COMPOSER_ROOT} create-project sylius/sylius-standard:${SYLIUS_VERSION} ${TEST_DIRECTORY} --no-install --no-scripts
else
${COMPOSER_ROOT} create-project sylius/sylius-standard ${TEST_DIRECTORY} "~${SYLIUS_VERSION}" --no-install --no-scripts
endif
${COMPOSER} config allow-plugins true
ifeq ($(shell [[ $(SYLIUS_VERSION) == *dev ]] && echo true ),true)
${COMPOSER} require sylius/sylius:"${SYLIUS_VERSION}"
else
${COMPOSER} require sylius/sylius:"~${SYLIUS_VERSION}"
endif
install-plugin:
${COMPOSER} config repositories.plugin '{"type": "path", "url": "../../"}'
${COMPOSER} config extra.symfony.allow-contrib true
${COMPOSER} config minimum-stability "dev"
${COMPOSER} config prefer-stable true
${COMPOSER} require "${PLUGIN_NAME}:*" --prefer-source --no-scripts
cp -r install/Application tests
sed -i "4a \ \ \ \ form_themes: ['form/form_gateway_config_row.html.twig']" ${TEST_DIRECTORY}/config/packages/twig.yaml
mkdir -p ${TEST_DIRECTORY}/templates/form/
cp -R src/Resources/views/form/* ${TEST_DIRECTORY}/templates/form/
# As of sylius/refund-plugin 1.2 the folder does not exist anymore
ifneq ($(PHP_VERSION), 8)
mkdir -p ${TEST_DIRECTORY}/templates/bundles/SyliusAdminBundle/
cp -R src/Resources/views/SyliusAdminBundle/* ${TEST_DIRECTORY}/templates/bundles/SyliusAdminBundle/
endif
install-sylius:
#${CONSOLE} sylius:install -n -s default
${CONSOLE} doctrine:database:create -n
${CONSOLE} messenger:setup-transports -n
${CONSOLE} doctrine:migration:migrate -n
${CONSOLE} sylius:fixture:load -n
${YARN} install
${YARN} build
${YARN} gulp
${CONSOLE} translation:extract en PayPlugSyliusPayPlugPlugin --dump-messages
${CONSOLE} translation:extract fr PayPlugSyliusPayPlugPlugin --dump-messages
${CONSOLE} cache:clear
phpunit-configure:
cp phpunit.xml.dist ${TEST_DIRECTORY}/phpunit.xml
echo -e "\nMOCK_SERVER_HOST=localhost\nMOCK_SERVER_PORT=8987\n" >> ${TEST_DIRECTORY}/.env.test.local
phpunit-run:
cd ${TEST_DIRECTORY} && ./vendor/bin/phpunit
behat-configure: ## Configure Behat
(cd ${TEST_DIRECTORY} && cp behat.yml.dist behat.yml)
(cd ${TEST_DIRECTORY} && sed -i "s#vendor/sylius/sylius/src/Sylius/Behat/Resources/config/suites.yml#vendor/${PLUGIN_NAME}/tests/Behat/Resources/suites.yml#g" behat.yml)
(cd ${TEST_DIRECTORY} && sed -i "s#vendor/sylius/sylius/features#vendor/${PLUGIN_NAME}/features#g" behat.yml)
(cd ${TEST_DIRECTORY} && sed -i '2i \ \ \ \ - { resource: "../vendor/${PLUGIN_NAME}/tests/Behat/Resources/services.xml\" }' config/services_test.yaml)
(cd ${TEST_DIRECTORY} && sed -i '3i \ \ \ \ - { resource: "../vendor/${PLUGIN_NAME}/src/Resources/config/services.xml" }' config/services_test.yaml)
(cd ${TEST_DIRECTORY} && sed -i '4i \ \ \ \ - { resource: "../vendor/sylius/refund-plugin/src/Resources/config/services.xml" }' config/services_test.yaml)
(cd ${TEST_DIRECTORY} && sed -i '5i \ \ \ \ - { resource: "../vendor/sylius/refund-plugin/tests/Behat/Resources/services.xml" }' config/services_test.yaml)
(cd ${TEST_DIRECTORY} && sed -i '6i \ \ \ \ - { resource: "services_payplug.yaml" }' config/services_test.yaml)
grumphp:
vendor/bin/grumphp run
help: SHELL=/bin/bash
help: ## Dislay this help
@IFS=$$'\n'; for line in `grep -h -E '^[a-zA-Z_#-]+:?.*?##.*$$' $(MAKEFILE_LIST)`; do if [ "$${line:0:2}" = "##" ]; then \
echo $$line | awk 'BEGIN {FS = "## "}; {printf "\033[33m %s\033[0m\n", $$2}'; else \
echo $$line | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m%s\n", $$1, $$2}'; fi; \
done; unset IFS;
.PHONY: help