From 051a329873749f70ec953d7301213f6cc5023f2c Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 10 Mar 2020 18:19:31 -0400 Subject: [PATCH] feat: avoid deprecated functions --- docs/appendices/0.20.0-migration-guide.md | 4 ++ docs/development/plugin-triggers.md | 60 +++++++++++++++++++++++ plugins/20_events/app-create | 1 + plugins/20_events/app-destroy | 1 + plugins/20_events/app-exists | 1 + plugins/20_events/app-maybe-create | 1 + plugins/git/functions | 6 +-- 7 files changed, 71 insertions(+), 3 deletions(-) create mode 120000 plugins/20_events/app-create create mode 120000 plugins/20_events/app-destroy create mode 120000 plugins/20_events/app-exists create mode 120000 plugins/20_events/app-maybe-create diff --git a/docs/appendices/0.20.0-migration-guide.md b/docs/appendices/0.20.0-migration-guide.md index e5a8de664..f42c3a4fe 100644 --- a/docs/appendices/0.20.0-migration-guide.md +++ b/docs/appendices/0.20.0-migration-guide.md @@ -58,3 +58,7 @@ The following changes on the `apps:report` command were made in this release - `nginx:show-conf` has been deprecated in favor of `nginx:show-config`. - `proxy#is_app_proxy_enabled()` is deprecated in favor of `plugn trigger proxy-is-enabled` - `proxy#get_app_proxy_type()` is deprecated in favor of `plugn trigger proxy-type` +- `apps#apps_create()` is deprecated in favor of `plugn trigger app-create` +- `apps#apps_destroy()` is deprecated in favor of `plugn trigger app-destroy` +- `apps#apps_exists()` is deprecated in favor of `plugn trigger app-exists` +- `apps#apps_maybe_create()` is deprecated in favor of `plugn trigger app-maybe-create` diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 6e588f35c..27780a8a2 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -29,6 +29,66 @@ The following plugin triggers describe those available to a Dokku installation. > The example plugin trigger code is not guaranteed to be implemented as in within dokku, and are merely simplified examples. Please look at the Dokku source for larger, more in-depth examples. +### `app-create` + +- Description: Creates an app +- Invoked by: +- Arguments: `$APP` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +# TODO +``` + +### `app-destroy` + +- Description: Destroys an app (with confirmation if force isn't specified) +- Invoked by: +- Arguments: `$APP` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +# TODO +``` + +### `app-exists` + +- Description: Creates an app +- Invoked by: +- Arguments: `$APP` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +# TODO +``` + +### `app-maybe-create` + +- Description: Creates an app (gated by whether this is globally enabled or not) +- Invoked by: +- Arguments: `$APP` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +# TODO +``` + ### `app-restart` - Description: Triggers an app restart diff --git a/plugins/20_events/app-create b/plugins/20_events/app-create new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/app-create @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/app-destroy b/plugins/20_events/app-destroy new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/app-destroy @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/app-exists b/plugins/20_events/app-exists new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/app-exists @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/20_events/app-maybe-create b/plugins/20_events/app-maybe-create new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/app-maybe-create @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/git/functions b/plugins/git/functions index 939e5d487..d85f80387 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -38,7 +38,7 @@ git_build_app_repo() { chmod 755 "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" unset GIT_DIR GIT_WORK_TREE - ! apps_exists "$APP" >/dev/null 2>&1 && apps_maybe_create "$APP" + ! plugn trigger app-exists "$APP" >/dev/null 2>&1 && plugn trigger app-maybe-create "$APP" if use_git_worktree; then # git worktree - this method uses git worktree which was introduced in git 2.5 @@ -205,7 +205,7 @@ cmd-git-upload-pack() { APP="$(echo "$APP" | perl -pe 's/(?/dev/null 2>&1 && apps_maybe_create "$APP" + ! plugn trigger app-exists "$APP" >/dev/null 2>&1 && plugn trigger app-maybe-create "$APP" plugn trigger git-pre-pull "$APP" cat | git-upload-pack "$DOKKU_ROOT/$APP" @@ -220,7 +220,7 @@ cmd-git-glob() { is_valid_app_name "$APP" if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then - ! apps_exists "$APP" >/dev/null 2>&1 && apps_maybe_create "$APP" + ! plugn trigger app-exists "$APP" >/dev/null 2>&1 && plugn trigger app-maybe-create "$APP" fn-git-create-hook "$APP" fi