From 2a76f7c3b3cb7086d6058ba88fbdb0400b256022 Mon Sep 17 00:00:00 2001 From: Guillaume Wuip Date: Sun, 26 Jun 2016 14:33:20 +0200 Subject: [PATCH 1/3] Allow apps:destroy when not in a project --- contrib/dokku_client.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 06cfdb4bd..568b9e597 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -33,6 +33,14 @@ client_help_msg() { exit 20 # exit with specific status. only used in units tests for now } +is_git_repo() { + git rev-parse &>/dev/null +} + +has_dokku_remote() { + git remote show dokku &>/dev/null +} + if [[ -z $DOKKU_HOST ]]; then if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true) @@ -81,7 +89,7 @@ if [[ ! -z $DOKKU_HOST ]]; then fi ;; apps:destroy) - git remote remove dokku + is_git_repo && has_dokku_remote && remote remove dokku ;; esac From 3cc1b42160269f81a2d76cf8d78209c76b0ad56a Mon Sep 17 00:00:00 2001 From: Guillaume Wuip Date: Sun, 26 Jun 2016 21:06:42 +0200 Subject: [PATCH 2/3] Fix has_dokku_remote `git remote show ` seems to really check if the remote is a git repo whereas we just want to know if a remote named "dokku" is present --- contrib/dokku_client.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 568b9e597..1c71c8934 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -38,7 +38,7 @@ is_git_repo() { } has_dokku_remote() { - git remote show dokku &>/dev/null + git remote show | grep dokku } if [[ -z $DOKKU_HOST ]]; then From 8d14d15acc9ac710497e8bfa5f78b801a95afa52 Mon Sep 17 00:00:00 2001 From: Guillaume Wuip Date: Sun, 26 Jun 2016 21:09:31 +0200 Subject: [PATCH 3/3] Fix obvious missing "git" --- contrib/dokku_client.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 1c71c8934..6ed95a804 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -89,7 +89,7 @@ if [[ ! -z $DOKKU_HOST ]]; then fi ;; apps:destroy) - is_git_repo && has_dokku_remote && remote remove dokku + is_git_repo && has_dokku_remote && git remote remove dokku ;; esac