diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 2fff8c84..13724ce8 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -2,6 +2,9 @@ from cement.core.controller import CementBaseController, expose from cement.core import handler, hook +from ee.core.variables import EEVariables +from ee.core.aptget import EEAptGet + def ee_stack_hook(app): # do something with the ``app`` object here. @@ -21,6 +24,14 @@ class EEStackController(CementBaseController): dict(help='Install admin tools stack', action='store_true')), (['--mail'], dict(help='Install mail server stack', action='store_true')), + (['--nginx'], + dict(help='Install Nginx stack', action='store_true')), + (['--php'], + dict(help='Install PHP stack', action='store_true')), + (['--mysql'], + dict(help='Install MySQL stack', action='store_true')), + (['--postfix'], + dict(help='Install Postfix stack', action='store_true')), ] @expose(hide=True) @@ -28,19 +39,77 @@ class EEStackController(CementBaseController): # TODO Default action for ee stack command print("Inside EEStackController.default().") - # stack command Options and subcommand calls and definations to - # mention here - - # If using an output handler such as 'mustache', you could also - # render a data dictionary using a template. For example: - # - # data = dict(foo='bar') - # self.app.render(data, 'default.mustache') - # - # - # The 'default.mustache' file would be loaded from - # ``ee.cli.templates``, or ``/var/lib/ee/templates/``. - # + @expose() + def install(self): + pkg = EEAptGet() + packages = [] + if self.app.pargs.web: + packages = (packages + EEVariables.ee_nginx + EEVariables.ee_php + + EEVariables.ee_mysql) + if self.app.pargs.admin: + pass + #packages = packages + EEVariables.ee_nginx + if self.app.pargs.mail: + pass + #packages = packages + EEVariables.ee_nginx + if self.app.pargs.nginx: + packages = packages + EEVariables.ee_nginx + if self.app.pargs.php: + packages = packages + EEVariables.ee_php + if self.app.pargs.mysql: + packages = packages + EEVariables.ee_mysql + if self.app.pargs.postfix: + packages = packages + EEVariables.ee_postfix + print(packages) + pkg.install(packages) + + @expose() + def remove(self): + pkg = EEAptGet() + packages = [] + if self.app.pargs.web: + packages = (packages + EEVariables.ee_nginx + EEVariables.ee_php + + EEVariables.ee_mysql) + if self.app.pargs.admin: + pass + #packages = packages + EEVariables.ee_nginx + if self.app.pargs.mail: + pass + #packages = packages + EEVariables.ee_nginx + if self.app.pargs.nginx: + packages = packages + EEVariables.ee_nginx + if self.app.pargs.php: + packages = packages + EEVariables.ee_php + if self.app.pargs.mysql: + packages = packages + EEVariables.ee_mysql + if self.app.pargs.postfix: + packages = packages + EEVariables.ee_postfix + print(packages) + pkg.remove(packages) + + @expose() + def purge(self): + pkg = EEAptGet() + packages = [] + if self.app.pargs.web: + packages = (packages + EEVariables.ee_nginx + EEVariables.ee_php + + EEVariables.ee_mysql) + if self.app.pargs.admin: + pass + #packages = packages + EEVariables.ee_nginx + if self.app.pargs.mail: + pass + #packages = packages + EEVariables.ee_nginx + if self.app.pargs.nginx: + packages = packages + EEVariables.ee_nginx + if self.app.pargs.php: + packages = packages + EEVariables.ee_php + if self.app.pargs.mysql: + packages = packages + EEVariables.ee_mysql + if self.app.pargs.postfix: + packages = packages + EEVariables.ee_postfix + print(packages) + pkg.purge(packages) def load(app): diff --git a/ee/core/variables.py b/ee/core/variables.py index 52e4fa62..020927c4 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -3,15 +3,24 @@ class EEVariables(): """Intialization of core variables""" - def ___init__(): - #EasyEngine core variables - ee_version + # EasyEngine core variables + ee_version = "3.0.0" - #EasyEngine stack installation varibales - ee_nginx_repo = "ppa:rtcamp/nginx" - ee_nginx = "nginx-full" - ee_php_repo = "ppa:ondrej/php5" - ee_php = "php5" - ee_mysql_repo = "" - ee_mysql = "" + # EasyEngine stack installation varibales + # Nginx repo and packages + ee_nginx_repo = "ppa:rtcamp/nginx" + ee_nginx = ["nginx-custom"] + + # PHP repo and packages + ee_php_repo = "ppa:ondrej/php5" + ee_php = ["php5-curl", "php5-gd", "php5-cli", "php5-fpm", "php5-imap", + "php5-mcrypt", "php5-xdebug"] + + # MySQL repo and packages + ee_mysql_repo = "" + ee_mysql = ["mysql-server-5.6"] + + # Postfix repo and packages + ee_postfix_repo = "" + ee_postfix = ["postfix"]