latest sources commit

This commit is contained in:
mikx
2023-11-07 05:04:30 -05:00
commit 749adf47ca
7570 changed files with 5705168 additions and 0 deletions

16
deps/acore/bash-lib/src/event/hooks.sh vendored Normal file
View 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 "
}

View 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"
}

View 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"
}