From 76c12e1b9ff086fef0bbe524947017326a169aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Thu, 5 Dec 2019 22:44:36 +0100 Subject: [PATCH] Add make target to generate compatibility patches Simplifying what's required from contributors to help us in this project. --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2efde2b3..c7b47790 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: test test-report test-fix +.PHONY: test test-report test-fix update-compatibility-patch PHP_74_OR_NEWER=`php -r "echo (int) version_compare(PHP_VERSION, '7.4', '>=');"` @@ -15,5 +15,12 @@ test-fix: vendor @vendor/bin/phpcbf tests/input2; diff tests/input2 tests/fixed; if [ $$? -ne 0 ]; then rm -rf tests/input2/ && if [ $(PHP_74_OR_NEWER) -eq 1 ]; then git apply -R tests/php-compatibility.patch; fi; exit 1; fi @rm -rf tests/input2/ && if [ $(PHP_74_OR_NEWER) -eq 1 ]; then git apply -R tests/php-compatibility.patch; fi +update-compatibility-patch: + @git apply tests/php-compatibility.patch + @echo -e "Please open your editor and apply your changes\n" + @until [ "$${compatibility_resolved}" == "y" ]; do read -p "Have finished your changes (y|n)? " compatibility_resolved; done && compatibility_resolved= + @git diff -- tests/expected_report.txt tests/fixed > .tmp-patch && mv .tmp-patch tests/php-compatibility.patch && git apply -R tests/php-compatibility.patch + @git commit -m 'Update compatibility patch' tests/php-compatibility.patch + vendor: composer.json composer update