add test mode to publish
This commit is contained in:
parent
e6833ab0ea
commit
067eeebafb
1 changed files with 16 additions and 8 deletions
20
publish
20
publish
|
|
@ -5,21 +5,29 @@ bail() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# test
|
||||||
|
if [[ "$1" = "-t" ]]; then
|
||||||
|
prefix=echo
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
[[ "$PUBLISH_HOST" != "" ]] && [[ "$publish_host" = "" ]] && publish_host="$PUBLISH_HOST"
|
[[ "$PUBLISH_HOST" != "" ]] && [[ "$publish_host" = "" ]] && publish_host="$PUBLISH_HOST"
|
||||||
[[ "$PUBLISH_DIR" != "" ]] && [[ "$publish_dir" = "" ]] && publish_dir="$PUBLISH_DIR"
|
[[ "$PUBLISH_DIR" != "" ]] && [[ "$publish_dir" = "" ]] && publish_dir="$PUBLISH_DIR"
|
||||||
|
|
||||||
orig_pwd="$PWD"
|
orig_pwd="$PWD"
|
||||||
while ! [[ -f .publish ]]; do
|
if [[ ! -f .publish ]]; then
|
||||||
|
while ! [[ -f .publish ]]; do
|
||||||
[[ "$PWD" = "/" ]] && bail "no .publish file found"
|
[[ "$PWD" = "/" ]] && bail "no .publish file found"
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
subdir="${PWD#$orig_pwd}"
|
subdir="${orig_pwd#$PWD/}"
|
||||||
|
fi
|
||||||
|
|
||||||
source .publish
|
source .publish
|
||||||
cd "$orig_pwd"
|
|
||||||
|
|
||||||
|
cd $orig_pwd
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
scp -r * "$publish_host":"${publish_dir}${subdir}"
|
$prefix scp -r * "$publish_host":"${publish_dir}${subdir}"
|
||||||
else
|
else
|
||||||
scp "$@" "$publish_host":"${publish_dir}${subdir}"
|
$prefix scp -r "$@" "$publish_host":"${publish_dir}${subdir}"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue