From 7e745e47639c8602e75129bcc22fca84ddac41e6 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Fri, 18 Mar 2016 23:44:25 +0100 Subject: [PATCH] Add post-merge hook to handle composer updates, update README.md --- Changelog | 1 + README.md | 6 ++++++ build/git-hooks/addHooks.sh | 7 +++++++ build/git-hooks/post-merge | 14 ++++++++++++++ 4 files changed, 28 insertions(+) create mode 100755 build/git-hooks/post-merge diff --git a/Changelog b/Changelog index 7eb6c5d90..713e5319f 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2016-03-18 DariusIII + * Upd: Add post-merge hook to handle composer updates, update README.md * Upd: Add back TV processing to NFO processing. * Chg: Add match_prefiles to tmux. 2016-03-17 DariusIII diff --git a/README.md b/README.md index 840cb3d7e..77abb47e9 100755 --- a/README.md +++ b/README.md @@ -39,6 +39,12 @@ I started adapting some of more interesting scripts from nZEDb, but they require When you have downloaded and installed composer, run "php composer.phar install" to install dependencies and create required folders and autoloader for them. + Next: sudo cp composer.phar /usr/local/bin/composer + sudo chmod a+x /usr/local/bin/composer + +# Git hooks + + Note: run addHooks.sh from build/git-hooks folder to add required git hooks. # yEnc: diff --git a/build/git-hooks/addHooks.sh b/build/git-hooks/addHooks.sh index 50ea8cbed..6c047f9ae 100755 --- a/build/git-hooks/addHooks.sh +++ b/build/git-hooks/addHooks.sh @@ -4,6 +4,7 @@ NNTMUX=`pwd` HOOKS=/build/git-hooks GIT=/.git/hooks PC=/pre-commit +PM=/post-merge NNTMUX=${NNTMUX%${HOOKS}} @@ -13,5 +14,11 @@ then rm "${NNTMUX}${GIT}${PC}" echo . fi +if [ -x "${NNTMUX}${GIT}${PM}" ] +then + rm "${NNTMUX}${GIT}${PM}" + echo . +fi ln -s ${NNTMUX}${HOOKS}${PC} ${NNTMUX}${GIT}${PC} +ln -s ${NNTMUX}${HOOKS}${PM} ${NNTMUX}${GIT}${PM} diff --git a/build/git-hooks/post-merge b/build/git-hooks/post-merge new file mode 100755 index 000000000..1eb491fa1 --- /dev/null +++ b/build/git-hooks/post-merge @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# MIT © Sindre Sorhus - sindresorhus.com +# forked by Gianluca Guarini +# phponly by Ivo Bathke ;) + +changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" + +check_run() { + echo "$changed_files" | grep --quiet "$1" && eval "$2" +} + +# `composer install` if the `composer.lock` file gets changed +# to update all the php dependencies +check_run composer.lock "composer install --no-dev" \ No newline at end of file