2017 © Pedro Peláez
 

library git-hook-handler

Git Hook Handler

image

aequasi/git-hook-handler

Git Hook Handler

  • Tuesday, May 22, 2018
  • by aequasi
  • Repository
  • 2 Watchers
  • 1 Stars
  • 12,781 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 14 Versions
  • 9 % Grown

The README.md

git-hook-handler

Usage

Just create a git-hooks.yml file in your projects base directory, and fill it with an array of commands you want to run:, (*1)

# git-hook.yml
config:
    commit-on-error : true # or false
pre-commit:
    # Simple command
    - bin/phpcs
    # or more complex command
    - phpunit:
        description : 'Run PHPUnit'
        command : phpunit
        exitcode : 0
    phpcs-fixer:
        description : 'Checking PHP Syntax with PHP-CS-FIXER'
        exitcode : 0
        command : >4
            COMMIT_RANGE='HEAD~..HEAD' &&
            CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}") &&
            if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php_cs(\\.dist)?|composer\\.lock)$"; then IFS=$'\n' EXTRA_ARGS=('--path-mode=intersection' '--' ${CHANGED_FILES[@]}); fi
            && ./vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --using-cache=no "${EXTRA_ARGS[@]}"

post-merge:
    command_name:
        description : 'lorem ipsum'
        command : 'mycommand'
        exitcode : 0

and then place the following in your composer.json, then run composer install or composer update, (*2)

# composer.json
    "scripts": {
        "pre-update-cmd":  "Aequasi\\HookHandler\\HookScript::install",
        "pre-install-cmd": "Aequasi\\HookHandler\\HookScript::install"
    }

The Versions

22/05 2018

dev-master

9999999-dev

Git Hook Handler

  Sources   Download

Apache-2.0 Apache

The Requires

 

The Development Requires

22/05 2018
02/05 2018
01/05 2018
07/09 2016