From bb03f483daaa6a98fd0e88ea43545d577a04a520 Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Wed, 25 Aug 2021 11:31:44 +0200 Subject: [PATCH] Add commit hooks --- .gitignore | 4 ++- composer.json | 12 +++++++-- composer.lock | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++- symfony.lock | 3 +++ 4 files changed, 90 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 775fdad..126e75d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,6 @@ /_coverage /public/docs -/*.cache \ No newline at end of file +/*.cache + +cghooks.lock \ No newline at end of file diff --git a/composer.json b/composer.json index 76e6586..3657d3b 100644 --- a/composer.json +++ b/composer.json @@ -48,10 +48,12 @@ "assets:install %PUBLIC_DIR%": "symfony-cmd" }, "post-install-cmd": [ - "@auto-scripts" + "@auto-scripts", + "cghooks add --ignore-lock" ], "post-update-cmd": [ - "@auto-scripts" + "@auto-scripts", + "cghooks update" ], "test": [ "@php bin/phpunit" @@ -86,9 +88,15 @@ "symfony": { "allow-contrib": false, "require": "^5.2" + }, + "hooks": { + "pre-commit": [ + "composer lint" + ] } }, "require-dev": { + "brainmaestro/composer-git-hooks": "^2.8", "friendsofphp/php-cs-fixer": "^3.0", "phpstan/phpstan": "^0.12.7", "phpstan/phpstan-phpunit": "^0.12.6", diff --git a/composer.lock b/composer.lock index de2a46e..881da5f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a47adaded0fc690c92b125ace4691f60", + "content-hash": "1d9a7f2fad509942445cf5be4506c6ee", "packages": [ { "name": "api-platform/core", @@ -6635,6 +6635,79 @@ ], "time": "2021-03-30T17:13:30+00:00" }, + { + "name": "brainmaestro/composer-git-hooks", + "version": "v2.8.5", + "source": { + "type": "git", + "url": "https://github.com/BrainMaestro/composer-git-hooks.git", + "reference": "ffed8803690ac12214082120eee3441b00aa390e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/BrainMaestro/composer-git-hooks/zipball/ffed8803690ac12214082120eee3441b00aa390e", + "reference": "ffed8803690ac12214082120eee3441b00aa390e", + "shasum": "" + }, + "require": { + "php": "^5.6 || >=7.0", + "symfony/console": "^3.2 || ^4.0 || ^5.0" + }, + "require-dev": { + "ext-json": "*", + "friendsofphp/php-cs-fixer": "^2.9", + "phpunit/phpunit": "^5.7 || ^7.0" + }, + "bin": [ + "cghooks" + ], + "type": "library", + "extra": { + "hooks": { + "pre-commit": "composer check-style", + "pre-push": [ + "composer test", + "appver=$(grep -o -E '\\d.\\d.\\d' cghooks)", + "tag=$(git describe --tags --abbrev=0)", + "if [ \"$tag\" != \"v$appver\" ]; then", + "echo \"The most recent tag $tag does not match the application version $appver\\n\"", + "tag=${tag#v}", + "sed -i -E \"s/$appver/$tag/\" cghooks", + "exit 1", + "fi" + ] + } + }, + "autoload": { + "psr-4": { + "BrainMaestro\\GitHooks\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ezinwa Okpoechi", + "email": "brainmaestro@outlook.com" + } + ], + "description": "Easily manage git hooks in your composer config", + "keywords": [ + "HOOK", + "composer", + "git" + ], + "support": { + "issues": "https://github.com/BrainMaestro/composer-git-hooks/issues", + "source": "https://github.com/BrainMaestro/composer-git-hooks/tree/v2.8.5" + }, + "time": "2021-02-08T15:59:11+00:00" + }, { "name": "composer/package-versions-deprecated", "version": "1.11.99.2", diff --git a/symfony.lock b/symfony.lock index 1e747f6..5c25a76 100644 --- a/symfony.lock +++ b/symfony.lock @@ -22,6 +22,9 @@ "src/Entity/.gitignore" ] }, + "brainmaestro/composer-git-hooks": { + "version": "v2.8.5" + }, "brick/math": { "version": "0.9.2" }, -- GitLab