port --app syntax to dokku_client. closes #1638

This commit is contained in:
Michael Hobbs committed 2016-03-04 12:38:23 -08:00
1 parent 62731aa434
commit 4204d210c1
3 files changed
+20 -50

No files matched your search

+10 -47
View File
@@ -54,23 +54,8 @@ if [[ ! -z $DOKKU_HOST ]]; then
echo "This is not a git repository" echo "This is not a git repository"
fi fi
if [[ "$appname" != "" ]] && [[ -n "$*" ]]; then
case "$1" in case "$1" in
apps|help|plugins*|ps:restartall|trace|version) apps:create)
true
;;
apps:destroy)
if [[ -z "$2" ]] || [[ "$2" == "force" ]]; then
donotshift="YES"
fi
;;
*)
donotshift="YES"
;;
esac
fi
if [[ "$1" = "apps:create" ]]; then
if [[ -z "$2" ]]; then if [[ -z "$2" ]]; then
appname=$(random_name) appname=$(random_name)
counter=0 counter=0
@@ -96,38 +81,16 @@ if [[ ! -z $DOKKU_HOST ]]; then
fi fi
git push dokku master git push dokku master
return $? return $?
fi ;;
apps:destroy)
git remote remove dokku
;;
esac
if [[ -z "$donotshift" ]]; then [[ -n "$@" ]] && [[ -n "$appname" ]] && app_arg="--app $appname"
# shellcheck disable=SC2029 # echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@"
ssh -o LogLevel=QUIET -p "$DOKKU_PORT" -t "dokku@$DOKKU_HOST" "$@" # shellcheck disable=SC2068,SC2086
exit $? ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@
fi
if [[ -z "$verb" ]]; then
if [[ ! "$1" =~ --* ]]; then
verb=$1
shift
if [[ "$1" == "$appname" ]]; then
shift
fi
args="$*"
else
long_args="--"
for arg in "$@"; do
if [[ "$arg" =~ --* ]]; then
long_args+=" $arg"
args=("${args[@]/$arg}")
else
verb="$arg"
fi
done
fi
fi
# shellcheck disable=SC2086,SC2029
ssh -o LogLevel=QUIET -p "$DOKKU_PORT" -t "dokku@$DOKKU_HOST" $long_args "$verb" "$appname" "${args[@]}"
} }
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then
+8 -1
View File
@@ -113,7 +113,14 @@ execute_dokku_cmd() {
if [[ "$(readlink -f "$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}")" == *core-plugins* ]] ; then if [[ "$(readlink -f "$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}")" == *core-plugins* ]] ; then
[[ ${argv[0]} == "$PLUGIN_CMD" ]] && shift 1 [[ ${argv[0]} == "$PLUGIN_CMD" ]] && shift 1
[[ ! -z $DOKKU_APP_NAME ]] && set -- "$DOKKU_APP_NAME" "$@" if [[ ! -z $DOKKU_APP_NAME ]]; then
if [[ "$PLUGIN_CMD" == config* ]] && [[ ${argv[1]} == "--no-restart" ]]; then
shift 1
set -- "--no-restart" "$DOKKU_APP_NAME" "$@"
else
set -- "$DOKKU_APP_NAME" "$@"
fi
fi
set -- "$PLUGIN_CMD" "$@" set -- "$PLUGIN_CMD" "$@"
fi fi
+2 -2
View File
@@ -34,7 +34,7 @@ teardown() {
echo "status: "$status echo "status: "$status
assert_success assert_success
git remote | grep dokku git remote | grep dokku
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh --force apps:destroy" run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:destroy --force"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
@@ -49,7 +49,7 @@ teardown() {
assert_success assert_success
git remote | grep dokku git remote | grep dokku
git remote -v | grep $test_app_name git remote -v | grep $test_app_name
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh --force apps:destroy" run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:destroy --force"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success