From f10f2de9682dff1ec5c54fddf0d6e6e69f9255c9 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Wed, 24 Dec 2014 19:14:47 +0530 Subject: [PATCH] ee site create command started --- config/plugins.d/site.conf | 8 +++ ee/cli/plugins/site.py | 72 +++++++++++++++++++++++++-- ee/cli/templates/virtualconf.mustache | 2 +- 3 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 config/plugins.d/site.conf diff --git a/config/plugins.d/site.conf b/config/plugins.d/site.conf new file mode 100644 index 00000000..2fb468fe --- /dev/null +++ b/config/plugins.d/site.conf @@ -0,0 +1,8 @@ +### Example Plugin Configuration for EasyEngine + +[site] + +### 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/plugins/site.py b/ee/cli/plugins/site.py index 7848c305..cd0c9c6b 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -1,6 +1,7 @@ """EasyEngine site controller.""" from cement.core.controller import CementBaseController, expose from cement.core import handler, hook +import sys def ee_site_hook(app): @@ -93,15 +94,72 @@ class EESiteCreateController(CementBaseController): dict(help="wpsubdir site", action='store_true')), (['--wpsubdomain'], dict(help="wpsubdomain site", action='store_true')), + (['--w3tc'], + dict(help="w3tc", action='store_true')), + (['--wpfc'], + dict(help="wpfc", action='store_true')), + (['--wpsc'], + dict(help="wpsc", action='store_true')), ] @expose(hide=True) def default(self): # TODO Default action for ee site command - data = dict(foo='EESiteCreateController.default().') - self.app.render((data), 'default.mustache') - - # print("Inside EESiteCreateController.default().") + # data = dict(foo='EESiteCreateController.default().') + # self.app.render((data), 'default.mustache') + if self.app.pargs.html: + data = dict(site_name=self.app.pargs.site_name, + static=True, basic=False, wp=False, w3tc=False, + wpfc=False, wpsc=False, multisite=False, + wpsubdir=False) + + if self.app.pargs.php: + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=True, wp=False, w3tc=False, + wpfc=False, wpsc=False, multisite=False, + wpsubdir=False) + + if self.app.pargs.mysql: + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=True, wp=False, w3tc=False, + wpfc=False, wpsc=False, multisite=False, + wpsubdir=False) + + if (self.app.pargs.wp or self.app.pargs.w3tc or self.app.pargs.wpfc + or self.app.pargs.wpsc): + if self.app.pargs.wp: + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=True, wp=True, w3tc=False, + wpfc=False, wpsc=False, multisite=False, + wpsubdir=False) + if self.app.pargs.w3tc: + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=False, wp=True, w3tc=True, + wpfc=False, wpsc=False, multisite=False, + wpsubdir=False) + if self.app.pargs.wpfc: + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=False, wp=True, w3tc=False, + wpfc=True, wpsc=False, multisite=False, + wpsubdir=False) + if self.app.pargs.wpsc: + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=False, wp=True, w3tc=False, + wpfc=False, wpsc=True, multisite=False, + wpsubdir=False) + + if self.app.pargs.wpsubdir: + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=True, wp=True, w3tc=False, + wpfc=False, wpsc=False, multisite=True, + wpsubdir=True) + + if self.app.pargs.wpsubdomain: + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=True, wp=True, w3tc=False, + wpfc=False, wpsc=False, multisite=True, + wpsubdir=False) + self.app.render((data), 'virtualconf.mustache') class EESiteUpdateController(CementBaseController): @@ -126,6 +184,12 @@ class EESiteUpdateController(CementBaseController): dict(help="wpsubdir site", action='store_true')), (['--wpsubdomain'], dict(help="wpsubdomain site", action='store_true')), + (['--w3tc'], + dict(help="w3tc", action='store_true')), + (['--wpfc'], + dict(help="wpfc", action='store_true')), + (['--wpsc'], + dict(help="wpsc", action='store_true')), ] @expose(help="update example.com") diff --git a/ee/cli/templates/virtualconf.mustache b/ee/cli/templates/virtualconf.mustache index d51b0acd..2ad0278d 100644 --- a/ee/cli/templates/virtualconf.mustache +++ b/ee/cli/templates/virtualconf.mustache @@ -25,7 +25,7 @@ try_files $uri $uri/ /index.html; } {{/static}} -include {{#basic}}common/php.conf;{{/basic}}{{#w3tc}}common/w3tc.conf;{{/w3tc}}{{#wpfc}}common/wpfc.conf;{{/wpfc}} {{#wpsc}}common/wpsc.conf;{{/wpsc}} +{{^static}}include{{/static}} {{#basic}}common/php.conf;{{/basic}}{{#w3tc}}common/w3tc.conf;{{/w3tc}}{{#wpfc}}common/wpfc.conf;{{/wpfc}} {{#wpsc}}common/wpsc.conf;{{/wpsc}} {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}} {{#wp}}include common/wpcommon.conf;{{/wp}} include common/locations.conf;