[
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2010-2016 Soenke Ruempler\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README",
    "content": "git-hooks collection (ABANDONED)\n\nCurrently just a pre-commit hook for PHP Codesniffer\n\n"
  },
  {
    "path": "phpcs-pre-commit/README",
    "content": "PHP Codesniffer Pre-Commit Hook for GIT\n\nAuthor: Soenke Ruempler <soenke@ruempler.eu>\nWebsite: http://github.com/s0enke/git-hooks\n\nREQUIREMENTS\n\n * Bash\n * PHP CodeSniffer: http://pear.php.net/package/PHP_CodeSniffer/redirected\n\n\nFEATURES\n\n * Check Coding style and forbid the commit if violations are found\n * Configuration file for Coding Standard, Path to PHPCS, Ignore List\n * Shows output in a 'less' pipe following the smart git principles\n\n\nUSAGE\n\n * Put the script \"pre-commit\" into your .git/hooks directory \n * OR: add the script to your pre-commit \"chain\" (you probably know what to do then)\n * Put the Config file \"config\" into the same dir as the \"pre-commit\" script and\n   edit it to your requirements\n * Ensure that the script is executable. \n\n"
  },
  {
    "path": "phpcs-pre-commit/config",
    "content": "# path to phpcs \"binary\"\nPHPCS_BIN=/usr/bin/phpcs\n\n# the coding standard, you can also specify a path to your own standard here \n# e. g. /path/to/my/standard/dir/\nPHPCS_CODING_STANDARD=PEAR\n\n# comma-separated list of file patterns being ignored\nPHPCS_IGNORE=\n\n# comma-seperated list of sniffs from the standard that should be used\n# use `phpcs --standard=PSR1 -e` to list sniffs for your standard\nPHPCS_SNIFFS=Generic.Files.ByteOrderMark,Generic.PHP.DisallowShortOpenTag\n\n# egrep compatible pattern of  files to be checked\nPHPCS_FILE_PATTERN=\"\\.(php|phtml)$\"\n\n# ignore warnings\nPHPCS_IGNORE_WARNINGS=1\n\n# encoding\nPHPCS_ENCODING=utf-8\n"
  },
  {
    "path": "phpcs-pre-commit/pre-commit",
    "content": "#!/bin/bash\n# PHP CodeSniffer pre-commit hook for git\n#\n# @author Soenke Ruempler <soenke@ruempler.eu>\n# @author Sebastian Kaspari <s.kaspari@googlemail.com>\n#\n# see the README\n\nPHPCS_BIN=/usr/bin/phpcs\nPHPCS_CODING_STANDARD=PEAR\nPHPCS_IGNORE=\nTMP_STAGING=\".tmp_staging\"\n\n# parse config\nCONFIG_FILE=$(dirname $0)/config\nif [ -e $CONFIG_FILE ]; then\n    . $CONFIG_FILE\nfi\n\n# simple check if code sniffer is set up correctly\nif [ ! -x $PHPCS_BIN ]; then\n    echo \"PHP CodeSniffer bin not found or executable -> $PHPCS_BIN\"\n    exit 1\nfi\n\n# stolen from template file\nif git rev-parse --verify HEAD\nthen\n    against=HEAD\nelse\n    # Initial commit: diff against an empty tree object\n    against=4b825dc642cb6eb9a060e54bf8d69288fbee4904\nfi\n\n# this is the magic: \n# retrieve all files in staging area that are added, modified or renamed\n# but no deletions etc\nFILES=$(git diff-index --name-only --cached --diff-filter=ACMR $against -- )\n\nif [ \"$FILES\" == \"\" ]; then\n    exit 0\nfi\n\n# create temporary copy of staging area\nif [ -e $TMP_STAGING ]; then\n    rm -rf $TMP_STAGING\nfi\nmkdir $TMP_STAGING\n\n# match files against whitelist\nFILES_TO_CHECK=\"\"\nfor FILE in $FILES\ndo\n    echo \"$FILE\" | egrep -q \"$PHPCS_FILE_PATTERN\"\n    RETVAL=$?\n    if [ \"$RETVAL\" -eq \"0\" ]\n    then\n        FILES_TO_CHECK=\"$FILES_TO_CHECK $FILE\"\n    fi\ndone\n\nif [ \"$FILES_TO_CHECK\" == \"\" ]; then\n    exit 0\nfi\n\n# execute the code sniffer\nif [ \"$PHPCS_IGNORE\" != \"\" ]; then\n    IGNORE=\"--ignore=$PHPCS_IGNORE\"\nelse\n    IGNORE=\"\"\nfi\n\nif [ \"$PHPCS_SNIFFS\" != \"\" ]; then\n    SNIFFS=\"--sniffs=$PHPCS_SNIFFS\"\nelse\n    SNIFFS=\"\"\nfi\n\nif [ \"$PHPCS_ENCODING\" != \"\" ]; then\n    ENCODING=\"--encoding=$PHPCS_ENCODING\"\nelse\n    ENCODING=\"\"\nfi\n\nif [ \"$PHPCS_IGNORE_WARNINGS\" == \"1\" ]; then\n    IGNORE_WARNINGS=\"-n\"\nelse\n    IGNORE_WARNINGS=\"\"\nfi\n\n# Copy contents of staged version of files to temporary staging area\n# because we only want the staged version that will be commited and not\n# the version in the working directory\nSTAGED_FILES=\"\"\nfor FILE in $FILES_TO_CHECK\ndo\n  ID=$(git diff-index --cached $against $FILE | cut -d \" \" -f4)\n\n  # create staged version of file in temporary staging area with the same\n  # path as the original file so that the phpcs ignore filters can be applied\n  mkdir -p \"$TMP_STAGING/$(dirname $FILE)\"\n  git cat-file blob $ID > \"$TMP_STAGING/$FILE\"\n  STAGED_FILES=\"$STAGED_FILES $TMP_STAGING/$FILE\"\ndone\n\nOUTPUT=$($PHPCS_BIN -s $IGNORE_WARNINGS --standard=$PHPCS_CODING_STANDARD $ENCODING $IGNORE $SNIFFS $STAGED_FILES)\nRETVAL=$?\n\n# delete temporary copy of staging area\nrm -rf $TMP_STAGING\n\nif [ $RETVAL -ne 0 ]; then\n    echo \"$OUTPUT\" | less\nfi\n\nexit $RETVAL\n"
  }
]