feat: avoid deprecated functions

This commit is contained in:
Jose Diaz-Gonzalez
2020-03-10 18:19:31 -04:00
parent aa156b2834
commit 051a329873
7 changed files with 71 additions and 3 deletions

View File

@@ -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`

View File

@@ -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

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -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/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
is_valid_app_name "$APP"
! 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"
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