mirror of
https://github.com/dokku/dokku.git
synced 2026-02-23 19:50:34 +01:00
feat: add ability to check if a plugin has been installed
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
plugin:disable <name> # Disable an installed plugin (third-party only)
|
||||
plugin:enable <name> # Enable a previously disabled plugin
|
||||
plugin:install [--core|git-url [--committish tag|branch|commit|--name custom-plugin-name]] # Optionally download git-url (with custom tag/committish) & run install trigger for active plugins (or only core ones)
|
||||
plugin:installed <name> # Checks if a plugin is installed
|
||||
plugin:install-dependencies [--core] # Run install-dependencies trigger for active plugins (or only core ones)
|
||||
plugin:list # Print active plugins
|
||||
plugin:trigger <args...>. # Trigger an arbitrary plugin hook
|
||||
@@ -63,6 +64,12 @@ plugn: dev
|
||||
trace 0.20.0 enabled dokku core trace plugin
|
||||
```
|
||||
|
||||
You can check if a plugin has been installed via the `pluginn:installed` command:
|
||||
|
||||
```shell
|
||||
dokku plugin:install postgres
|
||||
```
|
||||
|
||||
Installing a plugin is easy as well using the `plugin:install` command. This command will also trigger the `install` pluginhook on all existing plugins.
|
||||
|
||||
```shell
|
||||
|
||||
@@ -12,6 +12,15 @@ cmd-plugin-list() {
|
||||
plugn list
|
||||
}
|
||||
|
||||
cmd-plugin-installed() {
|
||||
declare desc="checks if a plugin is installed"
|
||||
declare cmd="plugin:installed"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare PLUGIN_NAME="$1"
|
||||
|
||||
plugn list | awk '{print $1}' | grep -q "^${PLUGIN_NAME}$"
|
||||
}
|
||||
|
||||
plugin_prime_bash_completion() {
|
||||
declare desc="primes the bash-completion cache"
|
||||
|
||||
|
||||
6
plugins/plugin/subcommands/installed
Executable file
6
plugins/plugin/subcommands/installed
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/plugin/internal-functions"
|
||||
|
||||
cmd-plugin-installed "$@"
|
||||
@@ -39,11 +39,21 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "(plugin) plugin:install, plugin:disable, plugin:update plugin:uninstall" {
|
||||
run /bin/bash -c "dokku plugin:installed $TEST_PLUGIN_NAME"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku plugin:install $TEST_PLUGIN_GIT_REPO --name $TEST_PLUGIN_NAME"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku plugin:installed $TEST_PLUGIN_NAME"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku plugin:update $TEST_PLUGIN_NAME"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
|
||||
Reference in New Issue
Block a user