From 18d234a9250ab2f4e500f989010c7a0dd19b331b Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 8 Sep 2015 12:14:57 -0700 Subject: [PATCH] move plugin-* to plugin: namespace --- Makefile | 4 +- debian/postinst | 4 +- docs/development/plugin-creation.md | 2 +- docs/development/pluginhooks.md | 8 ++-- docs/plugins.md | 2 +- dokku | 47 +--------------------- plugins/plugin/commands | 62 +++++++++++++++++++++++++++++ plugins/plugin/plugin.toml | 4 ++ 8 files changed, 77 insertions(+), 56 deletions(-) create mode 100755 plugins/plugin/commands create mode 100644 plugins/plugin/plugin.toml diff --git a/Makefile b/Makefile index 7a427c900..dd6cc517a 100644 --- a/Makefile +++ b/Makefile @@ -70,10 +70,10 @@ version: git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION plugin-dependencies: plugn - dokku plugins-install-dependencies --core + dokku plugin:install-dependencies --core plugins: plugn docker - dokku plugins-install --core + dokku plugin:install --core dependencies: apt-update sshcommand plugn docker help2man man-db $(MAKE) -e stack diff --git a/debian/postinst b/debian/postinst index a0e8dd590..07c27fe4e 100755 --- a/debian/postinst +++ b/debian/postinst @@ -16,7 +16,7 @@ case "$1" in sshcommand create dokku /usr/local/bin/dokku egrep -i "^docker" /etc/group || groupadd docker usermod -aG docker dokku - dokku plugins-install --core + dokku plugin:install --core rm -f /home/dokku/VERSION cp /var/lib/dokku/STABLE_VERSION /home/dokku/VERSION @@ -31,7 +31,7 @@ case "$1" in db_get "dokku/vhost_enable" if [ "$RET" = "true" ]; then - db_get "dokku/hostname" + db_get "dokku/hostname" echo "$RET" > "${DOKKU_ROOT}/VHOST" else rm -f "${DOKKU_ROOT}/VHOST" diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index 9290a6707..6a967d5d1 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -65,7 +65,7 @@ A few notes: ```shell IMAGE=$(docker images | grep "user/repo" | awk '{print $3}') if [[ -z $IMAGE ]]; then - dokku_log_fail "user/repo image not found... Did you run 'dokku plugins-install'?" + dokku_log_fail "user/repo image not found... Did you run 'dokku plugin:install'?" fi ``` diff --git a/docs/development/pluginhooks.md b/docs/development/pluginhooks.md index 71360ae75..ea7cd3a3a 100644 --- a/docs/development/pluginhooks.md +++ b/docs/development/pluginhooks.md @@ -32,7 +32,7 @@ The following plugn triggers describe those available to a dokku installation. A ### `install` - Description: Used to setup any files/configuration for a plugn. -- Invoked by: `dokku plugins-install`. +- Invoked by: `dokku plugin:install`. - Arguments: None - Example: @@ -50,8 +50,8 @@ fi ### `dependencies` -- Description: Used to install system-level dependencies. Invoked by `plugins-install-dependencies`. -- Invoked by: `dokku plugins-install-dependencies` +- Description: Used to install system-level dependencies. Invoked by `plugin:install-dependencies`. +- Invoked by: `dokku plugin:install-dependencies` - Arguments: None - Example: @@ -77,7 +77,7 @@ esac ### `update` - Description: Can be used to run plugn updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates. -- Invoked by: `dokku plugins-update`. +- Invoked by: `dokku plugin:update`. - Arguments: None - Example: diff --git a/docs/plugins.md b/docs/plugins.md index 610724ed5..b1f71dba5 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -15,7 +15,7 @@ Let's take a quick look at the current dokku nginx plugin that's shipped with do ```shell cd /var/lib/dokku/plugins/available git clone -dokku plugins-install +dokku plugin:install ``` ## Creating your own plugin diff --git a/dokku b/dokku index 662203a2e..53db1b7f2 100755 --- a/dokku +++ b/dokku @@ -36,7 +36,7 @@ if [[ "${args[0]}" =~ ^--.* ]]; then fi ! has_tty && DOKKU_QUIET_OUTPUT=1 -if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then +if [[ $(id -un) != "dokku" && $1 != plugin:install* && $1 != "plugin:update" ]]; then sudo -u dokku -E -H $0 "$@" exit fi @@ -200,45 +200,6 @@ case "$1" in docker_cleanup ;; - plugins) - plugn list - ;; - - plugins-install) - if [[ $2 == "--core" ]]; then - export PLUGIN_PATH="$PLUGIN_CORE_PATH" - fi - plugn trigger install - ;; - - plugins-install-dependencies) - if [[ $2 == "--core" ]]; then - export PLUGIN_PATH="$PLUGIN_CORE_PATH" - fi - plugn trigger dependencies - ;; - - plugins-update) - plugn trigger update - ;; - - plugins:disable) - PLUGIN="$2" - [[ -e $PLUGIN_CORE_PATH/$PLUGIN ]] && echo "Cannot disable a core plugin" && exit 1 - [[ -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin already disabled" && exit 1 - [[ ! -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 - mv "$PLUGIN_PATH/$PLUGIN" "$PLUGIN_DISABLED_PATH" - echo "Plugin $PLUGIN disabled" - ;; - - plugins:enable) - PLUGIN="$2" - [[ -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin already enabled" && exit 1 - [[ ! -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 - mv "$PLUGIN_DISABLED_PATH/$PLUGIN" "$PLUGIN_PATH" - echo "Plugin $PLUGIN enabled" - ;; - # DEPRECATED as of v0.3.14 deploy:all) echo "*DEPRECATED* in v0.3.14: deploy:all will be removed in future versions" @@ -252,12 +213,6 @@ case "$1" in cat<, Enable a previously disabled plugin - plugins:disable , Disable an installed plugin (third-party only) EOF ;; diff --git a/plugins/plugin/commands b/plugins/plugin/commands new file mode 100755 index 000000000..213111c8e --- /dev/null +++ b/plugins/plugin/commands @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_PATH/available/common/functions" + +case "$1" in + plugin) + plugn list + ;; + + plugin:install) + if [[ $2 == "--core" ]]; then + export PLUGIN_PATH="$PLUGIN_CORE_PATH" + fi + plugn trigger install + ;; + + plugin:install-dependencies) + if [[ $2 == "--core" ]]; then + export PLUGIN_PATH="$PLUGIN_CORE_PATH" + fi + plugn trigger dependencies + ;; + + plugin:update) + plugn trigger update + ;; + + plugins:disable) + PLUGIN="$2" + [[ -e $PLUGIN_CORE_PATH/$PLUGIN ]] && echo "Cannot disable a core plugin" && exit 1 + [[ -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin already disabled" && exit 1 + [[ ! -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 + mv "$PLUGIN_PATH/$PLUGIN" "$PLUGIN_DISABLED_PATH" + echo "Plugin $PLUGIN disabled" + ;; + + plugins:enable) + PLUGIN="$2" + [[ -e $PLUGIN_PATH/$PLUGIN ]] && echo "Plugin already enabled" && exit 1 + [[ ! -e $PLUGIN_DISABLED_PATH/$PLUGIN ]] && echo "Plugin does not exist" && exit 1 + mv "$PLUGIN_DISABLED_PATH/$PLUGIN" "$PLUGIN_PATH" + echo "Plugin $PLUGIN enabled" + ;; + + help | ps:help) + cat<, Enable a previously disabled plugin + plugin:disable , Disable an installed plugin (third-party only) +EOF + ;; + + *) + exit $DOKKU_NOT_IMPLEMENTED_EXIT + ;; + +esac + + diff --git a/plugins/plugin/plugin.toml b/plugins/plugin/plugin.toml new file mode 100644 index 000000000..fbcfc4da7 --- /dev/null +++ b/plugins/plugin/plugin.toml @@ -0,0 +1,4 @@ +[plugin] +description = "dokku core plugin plugin" +version = "0.4.0" +[plugin.config]