v2.6.3
===================================================================== --- Bug fixes ---------------------------- - s3/media-sync/push now pushes (instead of pull -- oops!) - fixed a typo in the launch-or-show help - environment actions no longer overwrite overwrite symlinks
This commit is contained in:
parent
73e26a2ecb
commit
a1256bb0af
@ -24,7 +24,7 @@ __SYNC_MEDIA() {
|
|||||||
local FLAGS=(${@:3})
|
local FLAGS=(${@:3})
|
||||||
|
|
||||||
__STATUS "${ACTION}ing $2"
|
__STATUS "${ACTION}ing $2"
|
||||||
_AWS s3 sync $REMOTE_TARGET $LOCAL_TARGET $FLAGS \
|
_AWS s3 sync $A $B $FLAGS \
|
||||||
&& __SUCCESS "$2 up-to-date" \
|
&& __SUCCESS "$2 up-to-date" \
|
||||||
|| { __ERROR "unable to sync $2 (see above)"; return 1; }
|
|| { __ERROR "unable to sync $2 (see above)"; return 1; }
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ source ${0:a:h}/common.zsh
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
LAUNCH_OR_SHOW() {
|
LAUNCH_OR_SHOW() {
|
||||||
|
__INFO $@
|
||||||
local USAGE="
|
local USAGE="
|
||||||
usage: <path-executable> [client-class] [...options...]
|
usage: <path-executable> [client-class] [...options...]
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ LAUNCH_OR_SHOW() {
|
|||||||
Depending on state, performs one of three useful functions
|
Depending on state, performs one of three useful functions
|
||||||
1) starts application
|
1) starts application
|
||||||
2) adds application window to the scratchpad
|
2) adds application window to the scratchpad
|
||||||
3) pulls applciation from scratchpad to foreground on active screen
|
3) pulls application from scratchpad to foreground on active screen
|
||||||
"
|
"
|
||||||
local APPLICATION CLIENT_CLASS
|
local APPLICATION CLIENT_CLASS
|
||||||
|
|
||||||
|
@ -6,7 +6,9 @@ source ${0:a:h}/../common.zsh
|
|||||||
_SORT_ENV() {
|
_SORT_ENV() {
|
||||||
local ENV_FILE="$1"
|
local ENV_FILE="$1"
|
||||||
|
|
||||||
sed -i "/^# /d; /^$/d" "$ENV_FILE"
|
_SED -i "/^# /d; /^$/d" "$ENV_FILE"
|
||||||
sed -i "s/^[A-Z]/export &/; s/^[^#=]\\+$/&=/" "$ENV_FILE"
|
_SED -i "s/^[A-Z]/export &/; s/^[^#=]\\+$/&=/" "$ENV_FILE"
|
||||||
LC_COLLATE=C sort -uo "$ENV_FILE" "$ENV_FILE"
|
LC_COLLATE=C sort -uo "$ENV_FILE" "$ENV_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_SED() { sed --follow-symlinks $@; }
|
||||||
|
@ -25,7 +25,7 @@ cp "$TEMPLATE_ENV_FILE" "$ENV_FILE" \
|
|||||||
|| __FAIL 3 "unable to create '$ENV_NAME'"
|
|| __FAIL 3 "unable to create '$ENV_NAME'"
|
||||||
|
|
||||||
__STATUS 'stripping inherited values'
|
__STATUS 'stripping inherited values'
|
||||||
sed -i 's/ # inherited from.*$//' "$ENV_FILE" 2>/dev/null
|
_SED -i 's/ # inherited from.*$//' "$ENV_FILE" 2>/dev/null
|
||||||
|
|
||||||
__RUN_SCWRYPT zsh/scwrypts/environment/synchronize -- --no-prompt \
|
__RUN_SCWRYPT zsh/scwrypts/environment/synchronize -- --no-prompt \
|
||||||
|| __FAIL 4 'failed to run environment sync'
|
|| __FAIL 4 'failed to run environment sync'
|
||||||
|
@ -27,7 +27,7 @@ _SORT_ENV $ENV_FILE
|
|||||||
|
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
ENV_VAR=$(echo "$line" | sed 's/=.*$//; s/^export //')
|
ENV_VAR=$(echo "$line" | _SED 's/=.*$//; s/^export //')
|
||||||
grep -q "$ENV_VAR" $__ENV_TEMPLATE || {
|
grep -q "$ENV_VAR" $__ENV_TEMPLATE || {
|
||||||
((NEW_VAR+=1))
|
((NEW_VAR+=1))
|
||||||
echo "export $ENV_VAR=" >> $__ENV_TEMPLATE
|
echo "export $ENV_VAR=" >> $__ENV_TEMPLATE
|
||||||
|
@ -20,7 +20,7 @@ _SYNCHRONIZE() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_SORT_ENV "$__ENV_TEMPLATE"
|
_SORT_ENV "$__ENV_TEMPLATE"
|
||||||
sed -i '/__[a-z_]\+=$/d' "$__ENV_TEMPLATE"
|
_SED -i '/__[a-z_]\+=$/d' "$__ENV_TEMPLATE"
|
||||||
git add $__ENV_TEMPLATE >/dev/null 2>&1
|
git add $__ENV_TEMPLATE >/dev/null 2>&1
|
||||||
|
|
||||||
ENVIRONMENTS=$(__GET_ENV_NAMES | sort -r)
|
ENVIRONMENTS=$(__GET_ENV_NAMES | sort -r)
|
||||||
@ -40,7 +40,7 @@ _CLEAR_INHERITED_VARIABLES() {
|
|||||||
for ENV_NAME in $(echo $ENVIRONMENTS)
|
for ENV_NAME in $(echo $ENVIRONMENTS)
|
||||||
do
|
do
|
||||||
ENV_FILE=$(__GET_ENV_FILE $ENV_NAME)
|
ENV_FILE=$(__GET_ENV_FILE $ENV_NAME)
|
||||||
sed -i 's/ # inherited from.*//' "$ENV_FILE"
|
_SED -i 's/ # inherited from.*//' "$ENV_FILE"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ _INSERT_NEW_VARIABLES() {
|
|||||||
echo $line >> $ENV_FILE && __STATUS "added '$line' to '$ENV_NAME'"
|
echo $line >> $ENV_FILE && __STATUS "added '$line' to '$ENV_NAME'"
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
done < <(sed -n '/^./p' "$__ENV_TEMPLATE")
|
done < <(_SED -n '/^./p' "$__ENV_TEMPLATE")
|
||||||
}
|
}
|
||||||
|
|
||||||
_REMOVE_OLD_VARIABLES() {
|
_REMOVE_OLD_VARIABLES() {
|
||||||
@ -69,11 +69,11 @@ _REMOVE_OLD_VARIABLES() {
|
|||||||
ENV_FILE=$(__GET_ENV_FILE $ENV_NAME)
|
ENV_FILE=$(__GET_ENV_FILE $ENV_NAME)
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
ENV_VAR=$(echo "$line" | sed 's/=.*/=/')
|
ENV_VAR=$(echo "$line" | _SED 's/=.*/=/')
|
||||||
echo $ENV_VAR | grep -q '__[a-z_]\+=' && continue
|
echo $ENV_VAR | grep -q '__[a-z_]\+=' && continue
|
||||||
|
|
||||||
grep -q "$ENV_VAR" "$__ENV_TEMPLATE" || {
|
grep -q "$ENV_VAR" "$__ENV_TEMPLATE" || {
|
||||||
sed -i "\\%$ENV_VAR%d" "$ENV_FILE"
|
_SED -i "\\%$ENV_VAR%d" "$ENV_FILE"
|
||||||
echo "$ENV_VAR" | grep -qv '^#' \
|
echo "$ENV_VAR" | grep -qv '^#' \
|
||||||
&& __WARNING "removed unwanted '$ENV_VAR' from '$ENV_NAME'"
|
&& __WARNING "removed unwanted '$ENV_VAR' from '$ENV_NAME'"
|
||||||
}
|
}
|
||||||
@ -114,8 +114,8 @@ _CASCADE_ENVIRONMENT() {
|
|||||||
|
|
||||||
while read PARENT_VAR
|
while read PARENT_VAR
|
||||||
do
|
do
|
||||||
VAR_PATTERN=$(echo "$PARENT_VAR" | sed 's/=.*/=/; s/\//\/\//g')
|
VAR_PATTERN=$(echo "$PARENT_VAR" | _SED 's/=.*/=/; s/\//\/\//g')
|
||||||
__STATUS "propagating '$(echo $VAR_PATTERN | sed 's/^export \([^=]*\)=/\1/')' to children"
|
__STATUS "propagating '$(echo $VAR_PATTERN | _SED 's/^export \([^=]*\)=/\1/')' to children"
|
||||||
|
|
||||||
PARENT_VAR+=" # inherited from $PARENT_NAME"
|
PARENT_VAR+=" # inherited from $PARENT_NAME"
|
||||||
|
|
||||||
@ -123,10 +123,10 @@ _CASCADE_ENVIRONMENT() {
|
|||||||
do
|
do
|
||||||
CHILD_FILE=$(__GET_ENV_FILE $CHILD_NAME)
|
CHILD_FILE=$(__GET_ENV_FILE $CHILD_NAME)
|
||||||
|
|
||||||
sed -i "/^$VAR_PATTERN/d" "$CHILD_FILE"
|
_SED -i "/^$VAR_PATTERN/d" "$CHILD_FILE"
|
||||||
echo $PARENT_VAR >> "$CHILD_FILE"
|
echo $PARENT_VAR >> "$CHILD_FILE"
|
||||||
done
|
done
|
||||||
done < <(sed -n '/^[^#][^=]*=[^#]\+$/p' "$PARENT_FILE")
|
done < <(_SED -n '/^[^#][^=]*=[^#]\+$/p' "$PARENT_FILE")
|
||||||
|
|
||||||
__SUCCESS "finished '$PARENT_NAME' propagation"
|
__SUCCESS "finished '$PARENT_NAME' propagation"
|
||||||
}
|
}
|
||||||
@ -135,18 +135,18 @@ _ADD_DESCRIPTIONS() {
|
|||||||
__STATUS 'updating descriptions'
|
__STATUS 'updating descriptions'
|
||||||
while read DESCRIPTION_LINE
|
while read DESCRIPTION_LINE
|
||||||
do
|
do
|
||||||
ENV_VAR=$(echo $DESCRIPTION_LINE | sed 's/ \+| .*$//')
|
ENV_VAR=$(echo $DESCRIPTION_LINE | _SED 's/ \+| .*$//')
|
||||||
DESCRIPTION=$(echo $DESCRIPTION_LINE | sed 's/^.* | //')
|
DESCRIPTION=$(echo $DESCRIPTION_LINE | _SED 's/^.* | //')
|
||||||
for ENV_NAME in $(echo $ENVIRONMENTS)
|
for ENV_NAME in $(echo $ENVIRONMENTS)
|
||||||
do
|
do
|
||||||
sed -i "/^export $ENV_VAR=/i # $DESCRIPTION" "$(__GET_ENV_FILE $ENV_NAME)"
|
_SED -i "/^export $ENV_VAR=/i # $DESCRIPTION" "$(__GET_ENV_FILE $ENV_NAME)"
|
||||||
done
|
done
|
||||||
done < <(sed -n '/^[^ ]\+ \+| /p' "$__ENV_TEMPLATE.descriptions")
|
done < <(_SED -n '/^[^ ]\+ \+| /p' "$__ENV_TEMPLATE.descriptions")
|
||||||
|
|
||||||
for ENV_NAME in $(echo $ENVIRONMENTS)
|
for ENV_NAME in $(echo $ENVIRONMENTS)
|
||||||
do
|
do
|
||||||
sed -i "/^# /i \ " "$(__GET_ENV_FILE $ENV_NAME)"
|
_SED -i "/^# /i \ " "$(__GET_ENV_FILE $ENV_NAME)"
|
||||||
sed -i "s/^ $//" "$(__GET_ENV_FILE $ENV_NAME)"
|
_SED -i "s/^ $//" "$(__GET_ENV_FILE $ENV_NAME)"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ __PRINT() {
|
|||||||
printf "${COLOR}${MESSAGE}${__COLOR_RESET}${LINE_END}"
|
printf "${COLOR}${MESSAGE}${__COLOR_RESET}${LINE_END}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ ! $ERRORS ] && export ERRORS=0
|
||||||
__ERROR() { __PRINT $__RED "ERROR ✖ : $@" >&2; ((ERRORS+=1)); }
|
__ERROR() { __PRINT $__RED "ERROR ✖ : $@" >&2; ((ERRORS+=1)); }
|
||||||
__SUCCESS() { __PRINT $__GREEN "SUCCESS ✔ : $@" >&2; }
|
__SUCCESS() { __PRINT $__GREEN "SUCCESS ✔ : $@" >&2; }
|
||||||
__WARNING() { __PRINT $__ORANGE "WARNING : $@" >&2; }
|
__WARNING() { __PRINT $__ORANGE "WARNING : $@" >&2; }
|
||||||
|
Loading…
Reference in New Issue
Block a user