yage
fa9bb38462
===================================================================== Finally decided to port personal scripts into a standalone library. --- Release Notes ------------------------ - added support for python, zsh, and zx scripts - added support for "interactive" scripts which drop the user to a REPL - added support for passing arguments to commands - added support for python/node virtualenv management through scwrypts - added contributing and usage docs - updated zsh plugin to write commands to history - licensed under GPLv3 --- New Scripts -------------------------- zsh/scwrypts ) - configure - environment/copy - environment/delete - environment/edit - environment/synchronize - logs/clear - logs/view zsh ) - aws/ecr/login - aws/efs/mount - aws/efs/unmount - aws/route53/backup - aws/s3/media-sync/pull - aws/s3/media-sync/push python ) - redis/interactive =====================================================================
35 lines
785 B
Bash
35 lines
785 B
Bash
source ${0:a:h}/../common.zsh
|
|
|
|
__CHECK_DEPENDENCIES \
|
|
;
|
|
|
|
__CHECK_ENV_VARS \
|
|
AWS__S3__MEDIA_TARGETS \
|
|
AWS__S3__MEDIA_BUCKET \
|
|
;
|
|
|
|
AWS__S3__MEDIA_TARGETS=($(echo $AWS__S3__MEDIA_TARGETS | sed 's/,/\n/g'))
|
|
|
|
#####################################################################
|
|
|
|
__SYNC_MEDIA() {
|
|
local ACTION="$1"
|
|
local REMOTE_TARGET="s3://$AWS__S3__MEDIA_BUCKET/$2"
|
|
local LOCAL_TARGET="$HOME/$2"
|
|
|
|
local A B
|
|
case $ACTION in
|
|
push ) A="$LOCAL_TARGET"; B="$REMOTE_TARGET" ;;
|
|
pull ) A="$REMOTE_TARGET"; B="$LOCAL_TARGET" ;;
|
|
|
|
* ) __ERROR "unknown action '$1'"; return 1 ;;
|
|
esac
|
|
|
|
local FLAGS=(${@:3})
|
|
|
|
__STATUS "${ACTION}ing $2"
|
|
_AWS s3 sync $REMOTE_TARGET $LOCAL_TARGET $FLAGS \
|
|
&& __SUCCESS "$2 up-to-date" \
|
|
|| { __ERROR "unable to sync $2 (see above)"; return 1; }
|
|
}
|