yage
d1a17e4285
===================================================================== --- Changes ------------------------------ - updated python scwrypts API to use latest pattern established in the nodejs library - SCWRYPTS_ROOT__scwrypts is now supports loading with each run and detects managed installations vs manual installations; this now means SCWRYPTS_ROOT can no longer be injected to scwrypts (this was a v2 legacy support thing and probably does not apply to you) --- New Features ------------------------- - pypi/scwrypts ) added 'get_generator' API to testing utilities to provide a nice way to include default generator options --- Bug Fixes ---------------------------- - scwrypts groups which use a required environment name regex no longer load specialized static files outside of the required environments.
88 lines
2.5 KiB
Bash
88 lines
2.5 KiB
Bash
[[ $__SCWRYPT -eq 1 ]] && return 0
|
|
#####################################################################
|
|
|
|
SCWRYPTS_ROOT="$(cd -- ${0:a:h}; git rev-parse --show-toplevel 2>/dev/null)"
|
|
|
|
[ $SCWRYPTS_ROOT ] && [ -d "$SCWRYPTS_ROOT" ] \
|
|
|| SCWRYPTS_ROOT="echo \"${0:a:h}\" | sed -n 's|\(share/scwrypts\).*$|\1|p'"
|
|
|
|
[ $SCWRYPTS_ROOT ] && [ -d "$SCWRYPTS_ROOT" ] || {
|
|
echo "cannot determine scwrypts root path for current installation; aborting"
|
|
exit 1
|
|
}
|
|
|
|
[ -f "$SCWRYPTS_ROOT__scwrypts/MANAGED_BY" ] \
|
|
&& export SCWRYPTS_INSTALLATION_TYPE=$(cat "$SCWRYPTS_ROOT__scwrypts/MANAGED_BY") \
|
|
|| export SCWRYPTS_INSTALLATION_TYPE=manual \
|
|
;
|
|
|
|
export SCWRYPTS_ROOT__scwrypts="$SCWRYPTS_ROOT"
|
|
|
|
#####################################################################
|
|
|
|
DEFAULT_CONFIG="$SCWRYPTS_ROOT/zsh/lib/config.user.zsh"
|
|
source "$DEFAULT_CONFIG"
|
|
|
|
USER_CONFIG_OVERRIDES="$SCWRYPTS_CONFIG_PATH/config.zsh"
|
|
[ ! -f "$USER_CONFIG_OVERRIDES" ] && {
|
|
mkdir -p $(dirname "$USER_CONFIG_OVERRIDES")
|
|
cp "$DEFAULT_CONFIG" "$USER_CONFIG_OVERRIDES"
|
|
}
|
|
source "$USER_CONFIG_OVERRIDES"
|
|
|
|
mkdir -p \
|
|
"$SCWRYPTS_CONFIG_PATH" \
|
|
"$SCWRYPTS_DATA_PATH" \
|
|
"$SCWRYPTS_ENV_PATH" \
|
|
"$SCWRYPTS_LOG_PATH" \
|
|
"$SCWRYPTS_OUTPUT_PATH" \
|
|
;
|
|
|
|
export \
|
|
SCWRYPTS_GROUPS \
|
|
SCWRYPTS_CONFIG_PATH \
|
|
SCWRYPTS_DATA_PATH \
|
|
SCWRYPTS_SHORTCUT \
|
|
SCWRYPTS_ENV_SHORTCUT \
|
|
SCWRYPTS_LOG_PATH \
|
|
SCWRYPTS_OUTPUT_PATH \
|
|
;
|
|
|
|
SCWRYPTS_GROUPS=(scwrypts $(echo $SCWRYPTS_GROUPS | sed 's/\s\+/\n/g' | sort -u))
|
|
|
|
source "$SCWRYPTS_ROOT/zsh/lib/config.group.zsh" \
|
|
|| FAIL 69 'failed to set up scwrypts group; aborting'
|
|
|
|
#####################################################################
|
|
|
|
for plugin in $(ls $SCWRYPTS_ROOT__scwrypts/plugins)
|
|
do
|
|
[[ $(eval 'echo $SCWRYPTS_PLUGIN_ENABLED__'$plugin) -eq 1 ]] && {
|
|
source "$SCWRYPTS_ROOT/plugins/$plugin/$plugin.scwrypts.zsh"
|
|
}
|
|
done
|
|
|
|
#####################################################################
|
|
|
|
for GROUP_LOADER in $(env | sed -n 's/^SCWRYPTS_GROUP_LOADER__[a-z_]\+=//p')
|
|
do
|
|
[ -f "$GROUP_LOADER" ] && source "$GROUP_LOADER"
|
|
done
|
|
|
|
: \
|
|
&& [ ! "$SCWRYPTS_AUTODETECT_GROUP_BASEDIR" ] \
|
|
&& [ $GITHUB_WORKSPACE ] \
|
|
&& [ ! $SCWRYPTS_GITHUB_NO_AUTOLOAD ] \
|
|
&& SCWRYPTS_AUTODETECT_GROUP_BASEDIR="$GITHUB_WORKSPACE" \
|
|
;
|
|
|
|
[ "$SCWRYPTS_AUTODETECT_GROUP_BASEDIR" ] && [ -d "$SCWRYPTS_AUTODETECT_GROUP_BASEDIR" ] && {
|
|
for GROUP_LOADER in $(find "$SCWRYPTS_AUTODETECT_GROUP_BASEDIR" -type f -name \*scwrypts.zsh)
|
|
do
|
|
[ -f "$GROUP_LOADER" ] && source "$GROUP_LOADER"
|
|
done
|
|
}
|
|
|
|
#####################################################################
|
|
__SCWRYPT=1 # arbitrary; indicates currently inside a scwrypt
|