diff options
author | Yehonal <yehonal.azeroth@gmail.com> | 2016-08-13 20:25:34 +0200 |
---|---|---|
committer | Yehonal <yehonal.azeroth@gmail.com> | 2016-08-13 20:32:21 +0200 |
commit | ff6201921c7da018ec200ca52ed023e92c83f747 (patch) | |
tree | be1b9a1b8376841b88c46b4c360e842b66cfd49c /modules | |
parent | 86fc3b01f4867e28b58c07e2f86506f0549e3587 (diff) |
created hw-core bash libraries
will be traited as a git subtree
Diffstat (limited to 'modules')
-rw-r--r-- | modules/hw-core/bash-lib-event/src/hooks.sh | 16 | ||||
-rwxr-xr-x | modules/hw-core/bash-lib-git/bin/git-subtree-list | 7 | ||||
-rw-r--r-- | modules/hw-core/bash-lib-git/src/subtree.sh | 3 |
3 files changed, 26 insertions, 0 deletions
diff --git a/modules/hw-core/bash-lib-event/src/hooks.sh b/modules/hw-core/bash-lib-event/src/hooks.sh new file mode 100644 index 0000000000..b791a600fb --- /dev/null +++ b/modules/hw-core/bash-lib-event/src/hooks.sh @@ -0,0 +1,16 @@ +# par 1: hook_name +function hwc_event_run_hooks() { + hook_name="HOOKS_MAP_$1" + read -r -a SRCS <<< ${!hook_name} + echo "Running hooks: $hook_name" + for i in "${SRCS[@]}" + do + $i # run registered hook + done +} + +function hwc_event_register_hooks() { + hook_name="HOOKS_MAP_$1" + hooks=${@:2} + declare -g "$hook_name+=$hooks " +} diff --git a/modules/hw-core/bash-lib-git/bin/git-subtree-list b/modules/hw-core/bash-lib-git/bin/git-subtree-list new file mode 100755 index 0000000000..d3af413e9c --- /dev/null +++ b/modules/hw-core/bash-lib-git/bin/git-subtree-list @@ -0,0 +1,7 @@ +#!/bin/bash + +CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +source $CUR_DIR"/../src/subtree.sh" + +hwc_git_subtree_list diff --git a/modules/hw-core/bash-lib-git/src/subtree.sh b/modules/hw-core/bash-lib-git/src/subtree.sh new file mode 100644 index 0000000000..08820e6405 --- /dev/null +++ b/modules/hw-core/bash-lib-git/src/subtree.sh @@ -0,0 +1,3 @@ +function hwc_git_subtree_list() { + git log | grep git-subtree-dir | tr -d ' ' | cut -d ":" -f2 | sort | uniq +} |