diff --git a/.gitignore b/.gitignore index 775fdadbac917dea544ccc63c48d18fdff2e1d68..126e75d91d7d3869ee379a0ca6323e7f3e314d30 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 76e658649fe3bb8130a8d114cbe2d5912fa783a3..3657d3b9425c21c410dc5113203030a8eeaeb7a3 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 de2a46e99fc0d729d6905916755f8deccc12ce50..881da5fbea526ced6e1ae27552ba192bee2aaad4 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 1e747f64f1b29256b8053bd0874e53e69fe60c4c..5c25a7686d6ada57b97dfdc88f6b1e279b469b1f 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" },