2020-03-03 17:50:26 +03:00
|
|
|
ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
|
|
PRESTASHOP_DIR=$(ROOT_DIR)/../PrestaShop
|
2021-01-21 14:39:32 +03:00
|
|
|
FILE = $(ROOT_DIR)/VERSION
|
2018-05-28 17:09:31 +03:00
|
|
|
VERSION = `cat $(FILE)`
|
2018-06-14 13:15:12 +03:00
|
|
|
ARCHIVE_NAME = '/tmp/retailcrm-'$(VERSION)'.zip'
|
2018-05-28 17:09:31 +03:00
|
|
|
|
2020-03-05 10:41:50 +03:00
|
|
|
.PHONY: build_archive delete_archive
|
2018-05-28 17:09:31 +03:00
|
|
|
|
|
|
|
build_archive:
|
|
|
|
zip -r $(ARCHIVE_NAME) ./retailcrm/*
|
2018-10-05 17:50:20 +03:00
|
|
|
zip -r /tmp/retailcrm.zip ./retailcrm/*
|
2018-05-28 17:09:31 +03:00
|
|
|
|
|
|
|
delete_archive:
|
|
|
|
rm -f $(ARCHIVE_NAME)
|
2018-10-05 17:50:20 +03:00
|
|
|
rm -f /tmp/retailcrm.zip
|
2020-03-03 17:50:26 +03:00
|
|
|
|
|
|
|
clone_prestashop:
|
2020-03-04 17:01:50 +03:00
|
|
|
cd $(ROOT_DIR)/../ && git clone https://github.com/PrestaShop/PrestaShop
|
2022-09-30 11:48:25 +03:00
|
|
|
cd $(PRESTASHOP_DIR) && git checkout $(BRANCH)
|
|
|
|
|
2023-09-25 09:27:47 +03:00
|
|
|
# Required for versions 1.7.7.x - 1.7.8.x
|
|
|
|
# Only this command work in Makefile for replace $sfContainer->get('translator')
|
|
|
|
# sed -i 's/$$sfContainer->get('"'"'translator'"'"')/Context::getContext()->getTranslator()/g' classes/Language.php
|
|
|
|
fix_lang_bugs:
|
|
|
|
cd $(PRESTASHOP_DIR) && sed -i \
|
|
|
|
-e "s/throw new Exception/#throw new Exception/g" \
|
|
|
|
-e "s/SymfonyContainer::getInstance()->get('translator')/Context::getContext()->getTranslator()/g" \
|
|
|
|
-e 's/$$sfContainer->get('"'"'translator'"'"')/Context::getContext()->getTranslator()/g' \
|
|
|
|
src/PrestaShopBundle/Install/DatabaseDump.php classes/lang/DataLang.php classes/Language.php
|
|
|
|
|
|
|
|
install_composer:
|
|
|
|
# Required for versions 1.7.7.x
|
2022-09-30 11:48:25 +03:00
|
|
|
ifeq ($(COMPOSERV1),1)
|
2023-09-25 09:27:47 +03:00
|
|
|
composer self-update --1
|
2022-09-30 11:48:25 +03:00
|
|
|
endif
|
2023-09-25 09:27:47 +03:00
|
|
|
cd $(PRESTASHOP_DIR) && composer install
|
2020-03-03 17:50:26 +03:00
|
|
|
|
2023-09-25 09:27:47 +03:00
|
|
|
install_prestashop: clone_prestashop fix_lang_bugs install_composer
|
2023-01-26 12:55:52 +03:00
|
|
|
ifeq ($(LOCAL_TEST),1)
|
|
|
|
cd $(PRESTASHOP_DIR) && php install-dev/index_cli.php --db_server=db --db_user=root --db_create=1
|
|
|
|
else
|
|
|
|
cd $(PRESTASHOP_DIR) && php install-dev/index_cli.php --db_server=127.0.0.1:$(MYSQL_PORT) --db_user=root --db_create=1
|
2023-09-25 09:27:47 +03:00
|
|
|
mkdir coverage
|
2023-01-26 12:55:52 +03:00
|
|
|
endif
|
2020-03-03 17:50:26 +03:00
|
|
|
|
2021-11-03 16:19:39 +07:00
|
|
|
lint:
|
|
|
|
php-cs-fixer fix --config=$(ROOT_DIR)/.php-cs-fixer.php -v
|
|
|
|
|
2022-09-09 12:47:47 +03:00
|
|
|
lint-docker:
|
|
|
|
docker run --rm -it -w=/app -v ${PWD}:/app oskarstark/php-cs-fixer-ga:latest --config=.php-cs-fixer.php -v
|
2021-11-03 16:19:39 +07:00
|
|
|
|
2020-03-03 17:50:26 +03:00
|
|
|
test:
|
2023-09-25 09:27:47 +03:00
|
|
|
cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0
|
|
|
|
|
2021-01-21 14:39:32 +03:00
|
|
|
ifeq ($(COMPOSERV1),1)
|
2023-09-25 09:27:47 +03:00
|
|
|
phpunit -c $(ROOT_DIR)/phpunit.xml.dist
|
2021-01-21 14:39:32 +03:00
|
|
|
else
|
|
|
|
phpunit -c phpunit.xml.dist
|
|
|
|
endif
|
|
|
|
|
|
|
|
coverage:
|
2021-12-06 14:37:43 +03:00
|
|
|
wget https://phar.phpunit.de/phpcov-2.0.2.phar && php phpcov-2.0.2.phar merge coverage/ --clover coverage.xml
|
2023-01-26 12:55:52 +03:00
|
|
|
|
|
|
|
run_local_tests:
|
|
|
|
docker-compose up -d --build
|
2023-09-25 09:27:47 +03:00
|
|
|
docker exec app_prestashop_test make install_prestashop test
|
2023-01-26 12:55:52 +03:00
|
|
|
docker-compose down
|