Skip to content

Commit

Permalink
Add make target to generate compatibility patches
Browse files Browse the repository at this point in the history
Simplifying what's required from contributors to help us in this
project.
  • Loading branch information
lcobucci committed Dec 5, 2019
1 parent f9d89e0 commit 76c12e1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion 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', '>=');"`

Expand All @@ -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

0 comments on commit 76c12e1

Please sign in to comment.