Merge pull request #1939 from pmclanahan/client-add-dokku-remote

(client) Add dokku git remote when specifying app name
This commit is contained in:
Jose Diaz-Gonzalez committed 2016-02-25 01:00:00 -05:00
commit 62b9748269
2 files changed
+22 -2

No files matched your search

+5 -1
View File
@@ -68,7 +68,8 @@ if [[ ! -z $DOKKU_HOST ]]; then
esac esac
fi fi
if [[ "$1" = "apps:create" ]] && [[ -z "$2" ]]; then if [[ "$1" = "apps:create" ]]; then
if [[ -z "$2" ]]; then
appname=$(random_name) appname=$(random_name)
counter=0 counter=0
while ssh "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do while ssh "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do
@@ -81,6 +82,9 @@ if [[ ! -z $DOKKU_HOST ]]; then
counter=$((counter+1)) counter=$((counter+1))
fi fi
done done
else
appname="$2"
fi
if git remote add dokku "dokku@$DOKKU_HOST:$appname"; then if git remote add dokku "dokku@$DOKKU_HOST:$appname"; then
echo "-----> Dokku remote added at $DOKKU_HOST" echo "-----> Dokku remote added at $DOKKU_HOST"
echo "-----> Application name is $appname" echo "-----> Application name is $appname"
+17 -1
View File
@@ -27,12 +27,28 @@ teardown() {
assert_success assert_success
} }
@test "(client) apps:create AND apps:destroy" { @test "(client) apps:create AND apps:destroy with random name" {
setup_client_repo setup_client_repo
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:create" run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:create"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
git remote | grep dokku
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh --force apps:destroy"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "(client) apps:create AND apps:destroy with name" {
setup_client_repo
local test_app_name=test-apps-create-with-name
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:create $test_app_name"
echo "output: "$output
echo "status: "$status
assert_success
git remote | grep dokku
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 --force apps:destroy"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status