diff --git a/config/ee.conf b/config/ee.conf index 6e2c379a..02078253 100644 --- a/config/ee.conf +++ b/config/ee.conf @@ -37,5 +37,3 @@ ### The maximun number of log files to maintain when rotating # max_files = 4 - - diff --git a/config/plugins.d/example.conf b/config/plugins.d/example.conf index 415e8499..b78a2ff5 100644 --- a/config/plugins.d/example.conf +++ b/config/plugins.d/example.conf @@ -5,7 +5,7 @@ ### If enabled, load a plugin named `example` either from the Python module ### `ee.cli.plugins.example` or from the file path ### `/var/lib/ee/plugins/example.py` -enable_plugin = true +enable_plugin = false ### Additional plugin configuration settings foo = bar diff --git a/config/plugins.d/stack.conf b/config/plugins.d/stack.conf new file mode 100644 index 00000000..f7bf9b80 --- /dev/null +++ b/config/plugins.d/stack.conf @@ -0,0 +1,8 @@ +### Example Plugin Configuration for EasyEngine + +[stack] + +### If enabled, load a plugin named `example` either from the Python module +### `ee.cli.plugins.example` or from the file path +### `/var/lib/ee/plugins/example.py` +enable_plugin = true diff --git a/ee/cli/bootstrap.py b/ee/cli/bootstrap.py index c65a5d3f..de3c5108 100644 --- a/ee/cli/bootstrap.py +++ b/ee/cli/bootstrap.py @@ -8,19 +8,18 @@ from ee.cli.controllers.base import EEBaseController from ee.cli.controllers.site import EESiteController from ee.cli.controllers.site import EESiteCreateController from ee.cli.controllers.site import EESiteUpdateController -from ee.cli.controllers.stack import EEStackController from ee.cli.controllers.debug import EEDebugController from ee.cli.controllers.clean import EECleanController from ee.cli.controllers.secure import EESecureController from ee.cli.controllers.isl import EEImportslowlogController from ee.cli.controllers.info import EEInfoController + def load(app): handler.register(EEBaseController) handler.register(EESiteController) handler.register(EESiteCreateController) handler.register(EESiteUpdateController) - handler.register(EEStackController) handler.register(EEDebugController) handler.register(EECleanController) handler.register(EEInfoController) diff --git a/ee/cli/controllers/stack.py b/ee/cli/plugins/stack.py similarity index 74% rename from ee/cli/controllers/stack.py rename to ee/cli/plugins/stack.py index 59b86adc..2fff8c84 100644 --- a/ee/cli/controllers/stack.py +++ b/ee/cli/plugins/stack.py @@ -1,6 +1,11 @@ -"""EasyEngine site controller.""" +"""Example Plugin for EasyEngine.""" from cement.core.controller import CementBaseController, expose +from cement.core import handler, hook + +def ee_stack_hook(app): + # do something with the ``app`` object here. + pass class EEStackController(CementBaseController): @@ -36,3 +41,11 @@ class EEStackController(CementBaseController): # The 'default.mustache' file would be loaded from # ``ee.cli.templates``, or ``/var/lib/ee/templates/``. # + + +def load(app): + # register the plugin class.. this only happens if the plugin is enabled + handler.register(EEStackController) + + # register a hook (function) to run after arguments are parsed. + hook.register('post_argument_parsing', ee_stack_hook)