latest sources commit
This commit is contained in:
16
deps/acore/bash-lib/src/event/hooks.sh
vendored
Normal file
16
deps/acore/bash-lib/src/event/hooks.sh
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# par 1: hook_name
|
||||
function acore_event_runHooks() {
|
||||
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 acore_event_registerHooks() {
|
||||
hook_name="HOOKS_MAP_$1"
|
||||
hooks=${@:2}
|
||||
declare -g "$hook_name+=$hooks "
|
||||
}
|
||||
36
deps/acore/bash-lib/src/git-utils/subrepo.sh
vendored
Normal file
36
deps/acore/bash-lib/src/git-utils/subrepo.sh
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
|
||||
CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
|
||||
|
||||
echo "> Init and updating submodules..."
|
||||
|
||||
function subrepoUpdate() {
|
||||
repo=$1
|
||||
branch=$2
|
||||
folder=$3
|
||||
|
||||
toClone=$(git ls-remote --heads "$repo" "$branch" | wc -l)
|
||||
|
||||
if [[ -d "$folder" ]]; then
|
||||
if [[ ! -f "$folder/.gitrepo" ]]; then
|
||||
git subrepo init "$folder" -r "$repo" -b "$branch"
|
||||
fi
|
||||
|
||||
if [[ $toClone -eq 0 ]]; then
|
||||
git subrepo push "$folder"
|
||||
fi
|
||||
else
|
||||
# try-catch
|
||||
set +e
|
||||
git subrepo clone "$repo" "$folder" -b "$branch"
|
||||
set -e
|
||||
fi
|
||||
|
||||
git subrepo clean "$folder"
|
||||
git subrepo pull "$folder"
|
||||
git subrepo push "$folder" -s
|
||||
git subrepo clean "$folder"
|
||||
}
|
||||
12
deps/acore/bash-lib/src/git-utils/subtree.sh
vendored
Normal file
12
deps/acore/bash-lib/src/git-utils/subtree.sh
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
function subtreeFlow {
|
||||
local name=$1
|
||||
local path=$2
|
||||
local repo=$3
|
||||
local branch=$4
|
||||
local prefix="$path/$name"
|
||||
|
||||
echo "> Adding subtree if not exists"
|
||||
git subtree add --prefix "$prefix" "$repo" "$branch"
|
||||
echo "> Pulling latest changes from remote subtree"
|
||||
git subtree pull --prefix "$prefix" "$repo" "$branch"
|
||||
}
|
||||
Reference in New Issue
Block a user