Add captainhook/captainhook to dev environment

This commit is contained in:
DariusIII
2019-07-24 09:48:04 +02:00
parent df255dcbd7
commit aaa40223ac
5 changed files with 282 additions and 65 deletions
+2
View File
@@ -1,3 +1,5 @@
2019-07-24 DariusIII
* Chg: Add captainhook/captainhook for dev work
2019-07-22 DariusIII
* Chg: Update spatie/async (1.0.2 => 1.0.3)
2019-07-21 DariusIII
+13 -62
View File
@@ -1,64 +1,15 @@
#!/usr/bin/env bash
#version=10
#
# The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
#!/usr/bin/env php
<?php
$autoLoader = __DIR__ . '/../../vendor/autoload.php';
if git rev-parse --verify HEAD >/dev/null 2>&1
then
AGAINST=HEAD
else
# Initial commit: diff against an empty tree object
AGAINST=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
if (!file_exists($autoLoader)) {
fwrite(STDERR, 'Composer autoload.php could not be found');
exit(1);
}
require $autoLoader;
$config = realpath(__DIR__ . '/../../captainhook.json');
$app = new CaptainHook\App\Console\Application\Hook();
$app->setHook('pre-commit');
$app->setConfigFile($config);
$app->run();
#####################################################################################################
EXIT_STATUS=0
NNTMUX=`pwd`
HOOK_DIR=/build/git-hooks
GIT=/.git/hooks
PC=/pre-commit
# Strip off the current directory path if we are run from in the git-hooks directory.
PROJECT=${NNTMUX%${HOOK_DIR}}
HOOKS=${PROJECT}${HOOK_DIR}
FILE_LIST=${HOOKS}/git_hook_list.txt
# stash any unstaged changes
# git stash -q --keep-index
if [ -e ${FILE_LIST} ]
then
rm ${FILE_LIST}
fi
touch ${FILE_LIST}
for FILE in `git diff-index --cached --name-only --diff-filter=AM ${AGAINST}`
do
echo ${PROJECT}/${FILE} >> ${FILE_LIST}
done
EXIT_STATUS=$?
if [ -e ${FILE_LIST} ]
then
rm ${FILE_LIST}
fi
if [ ${EXIT_STATUS} -gt 0 ]
then
exit ${EXIT_STATUS}
fi
# If there are whitespace errors, print the offending file names and fail.
#exec git diff-index --check --cached ${AGAINST} --
# Remove trailing white-space in commits.
${HOOKS}/white-space-removal
# unstash the saved stuff
# git stash pop -q
+50
View File
@@ -0,0 +1,50 @@
{
"commit-msg": {
"enabled": true,
"actions": [
{
"action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Beams",
"options": {
"subjectLength": 50,
"bodyLineLength": 72
},
"conditions": []
}
]
},
"pre-push": {
"enabled": false,
"actions": []
},
"pre-commit": {
"enabled": true,
"actions": [
{
"action": "\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting",
"options": [],
"conditions": []
},
{
"action": "vendor/bin/php-cs-fixer fix",
"options": [],
"conditions": []
}
]
},
"prepare-commit-msg": {
"enabled": false,
"actions": []
},
"post-commit": {
"enabled": false,
"actions": []
},
"post-merge": {
"enabled": false,
"actions": []
},
"post-checkout": {
"enabled": false,
"actions": []
}
}
+3 -2
View File
@@ -160,6 +160,8 @@
"barryvdh/laravel-debugbar": "^3.1",
"barryvdh/laravel-ide-helper": "^2.4",
"beyondcode/laravel-dump-server": "^1.0",
"captainhook/captainhook": "^4.4",
"captainhook/plugin-composer": "^4.0",
"filp/whoops": "~2.0",
"friendsofphp/php-cs-fixer": "^2.14",
"fzaninotto/faker": "~1.4",
@@ -186,8 +188,7 @@
],
"post-update-cmd": [
"Blacklight\\build\\ComposerScripts::postUpdate",
"@php artisan ide-helper:generate --ansi",
"@php artisan ide-helper:meta --ansi"
"@php artisan ide-helper:generate --ansi"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
Generated
+214 -1
View File
@@ -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": "a6818f464a209bafe68554b05a963cee",
"content-hash": "344580b9adfd4f74a476559fa23a6823",
"packages": [
{
"name": "aharen/omdbapi",
@@ -8790,6 +8790,126 @@
],
"time": "2018-10-04T07:22:24+00:00"
},
{
"name": "captainhook/captainhook",
"version": "4.4.1",
"source": {
"type": "git",
"url": "https://github.com/CaptainHookPhp/captainhook.git",
"reference": "08139dedb95adc5c3a557ca5519e26f17aec6a49"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/CaptainHookPhp/captainhook/zipball/08139dedb95adc5c3a557ca5519e26f17aec6a49",
"reference": "08139dedb95adc5c3a557ca5519e26f17aec6a49",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-simplexml": "*",
"ext-spl": "*",
"php": "^7.1",
"sebastianfeldmann/cli": "^3.0",
"sebastianfeldmann/git": "^2.2",
"symfony/console": ">=2.7"
},
"replace": {
"sebastianfeldmann/captainhook": "*"
},
"require-dev": {
"composer/composer": "~1",
"phpunit/phpunit": "^7.0"
},
"bin": [
"captainhook",
"captainhook-run"
],
"type": "library",
"extra": {
"captainhook-config": "captainhook.json",
"captainhook-git-dir": ".git",
"branch-alias": {
"dev-master": "4.3.x-dev"
}
},
"autoload": {
"psr-4": {
"CaptainHook\\App\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sebastian Feldmann",
"email": "sf@sebastian-feldmann.info"
}
],
"description": "PHP git hook manager",
"homepage": "https://github.com/captainhookphp/captainhook",
"keywords": [
"commit-msg",
"git",
"hooks",
"pre-commit",
"pre-push",
"prepare-commit-msg"
],
"time": "2019-07-15T21:15:26+00:00"
},
{
"name": "captainhook/plugin-composer",
"version": "4.0.0",
"source": {
"type": "git",
"url": "https://github.com/CaptainHookPhp/plugin-composer.git",
"reference": "61b6c505e0e6855e7ad653f9efe0ae81304340e0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/CaptainHookPhp/plugin-composer/zipball/61b6c505e0e6855e7ad653f9efe0ae81304340e0",
"reference": "61b6c505e0e6855e7ad653f9efe0ae81304340e0",
"shasum": ""
},
"require": {
"captainhook/captainhook": "^4.0",
"composer-plugin-api": "^1.1",
"php": "^7.1"
},
"require-dev": {
"composer/composer": "*"
},
"type": "composer-plugin",
"extra": {
"class": "CaptainHook\\Plugin\\Composer\\ComposerPlugin",
"branch-alias": {
"dev-fluffy_hedgehog": "5.0.x-dev"
}
},
"autoload": {
"psr-4": {
"CaptainHook\\Plugin\\Composer\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andreas Heigl",
"email": "andreas@heigl.org"
},
{
"name": "Sebastian Feldmann",
"email": "sf@sebastian-feldmann.info"
}
],
"description": "Composer-Plugin handling your git-hooks",
"time": "2019-01-10T19:29:52+00:00"
},
{
"name": "composer/composer",
"version": "1.8.6",
@@ -12103,6 +12223,99 @@
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2016-10-03T07:35:21+00:00"
},
{
"name": "sebastianfeldmann/cli",
"version": "3.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianfeldmann/cli.git",
"reference": "fbd21f4d2b7978cd7e79432726070dd2ee04cce5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianfeldmann/cli/zipball/fbd21f4d2b7978cd7e79432726070dd2ee04cce5",
"reference": "fbd21f4d2b7978cd7e79432726070dd2ee04cce5",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"SebastianFeldmann\\Cli\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sebastian Feldmann",
"email": "sf@sebastian-feldmann.info"
}
],
"description": "PHP cli helper classes",
"homepage": "https://github.com/sebastianfeldmann/cli",
"keywords": [
"cli"
],
"time": "2019-06-17T22:31:05+00:00"
},
{
"name": "sebastianfeldmann/git",
"version": "2.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianfeldmann/git.git",
"reference": "cc6190a13827b14307d2ba8595e720d6df883486"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianfeldmann/git/zipball/cc6190a13827b14307d2ba8595e720d6df883486",
"reference": "cc6190a13827b14307d2ba8595e720d6df883486",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^7.1",
"sebastianfeldmann/cli": "^3.0.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
}
},
"autoload": {
"psr-4": {
"SebastianFeldmann\\Git\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sebastian Feldmann",
"email": "sf@sebastian-feldmann.info"
}
],
"description": "PHP git wrapper",
"homepage": "https://github.com/sebastianfeldmann/git",
"keywords": [
"git"
],
"time": "2019-06-12T23:35:18+00:00"
},
{
"name": "seld/jsonlint",
"version": "1.7.1",