Browse Source

pep8 standard organized code

bugfixes
harshadyeola 10 years ago
parent
commit
7fb7f7dd42
  1. 7
      ee/cli/controllers/base.py
  2. 14
      ee/cli/controllers/clean.py
  3. 18
      ee/cli/controllers/debug.py
  4. 15
      ee/cli/controllers/info.py
  5. 15
      ee/cli/controllers/isl.py
  6. 17
      ee/cli/controllers/secure.py
  7. 47
      ee/cli/controllers/site.py
  8. 9
      ee/cli/controllers/stack.py
  9. 1
      ee/cli/main.py
  10. 2
      ee/utils/test.py
  11. 7
      tests/cli/test_ee.py

7
ee/cli/controllers/base.py

@ -2,14 +2,17 @@
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
class EEBaseController(CementBaseController): class EEBaseController(CementBaseController):
class Meta: class Meta:
label = 'base' label = 'base'
description = 'easyengine is the commandline tool to manage your websites based on wordpress and nginx with easy to use commands.' description = 'easyengine is the commandline tool to manage your \
websites based on wordpress and nginx with easy to \
use commands.'
arguments = [ arguments = [
(['-f', '--foo'], (['-f', '--foo'],
dict(help='the notorious foo option', dest='foo', action='store', dict(help='the notorious foo option', dest='foo', action='store',
metavar='TEXT') ), metavar='TEXT')),
] ]
@expose(hide=True) @expose(hide=True)

14
ee/cli/controllers/clean.py

@ -2,27 +2,29 @@
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
class EECleanController(CementBaseController): class EECleanController(CementBaseController):
class Meta: class Meta:
label = 'clean' label = 'clean'
stacked_on = 'base' stacked_on = 'base'
stacked_type = 'nested' stacked_type = 'nested'
description = 'clean command cleans different cache with following options' description = 'clean command cleans different cache with following \
options'
arguments = [ arguments = [
(['--all'], (['--all'],
dict(help='clean all cache', action='store_true') ), dict(help='clean all cache', action='store_true')),
(['--fastcgi'], (['--fastcgi'],
dict(help='clean fastcgi cache', action='store_true')), dict(help='clean fastcgi cache', action='store_true')),
(['--memcache'], (['--memcache'],
dict(help='clean memcache', action='store_true')), dict(help='clean memcache', action='store_true')),
(['--opcache'], (['--opcache'],
dict(help='clean opcode cache cache', action='store_true')) dict(help='clean opcode cache cache', action='store_true'))
] ]
@expose(hide=True) @expose(hide=True)
def default(self): def default(self):
# TODO Default action for ee clean command here # TODO Default action for ee clean command here
print ("Inside EECleanController.default().") print("Inside EECleanController.default().")
# clean command Options and subcommand calls and definations to # clean command Options and subcommand calls and definations to
# mention here # mention here

18
ee/cli/controllers/debug.py

@ -2,31 +2,33 @@
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
class EEDebugController(CementBaseController): class EEDebugController(CementBaseController):
class Meta: class Meta:
label = 'debug' label = 'debug'
stacked_on = 'base' stacked_on = 'base'
stacked_type = 'nested' stacked_type = 'nested'
description = 'debug command used for debugging issued with stack or site specific configuration' description = 'debug command used for debugging issued with stack or \
site specific configuration'
arguments = [ arguments = [
(['--fpm'], (['--fpm'],
dict(help='debug fpm', action='store_true') ), dict(help='debug fpm', action='store_true')),
(['--mysql'], (['--mysql'],
dict(help='debug mysql', action='store_true') ), dict(help='debug mysql', action='store_true')),
(['--nginx'], (['--nginx'],
dict(help='debug nginx', action='store_true') ), dict(help='debug nginx', action='store_true')),
(['--php'], (['--php'],
dict(help='debug php', action='store_true') ), dict(help='debug php', action='store_true')),
(['--rewrite'], (['--rewrite'],
dict(help='debug rewrite', action='store_true') ), dict(help='debug rewrite', action='store_true')),
(['--stop'], (['--stop'],
dict(help='stop debugging', action='store_true') ), dict(help='stop debugging', action='store_true')),
] ]
@expose(hide=True) @expose(hide=True)
def default(self): def default(self):
# TODO Default action for ee debug command # TODO Default action for ee debug command
print ("Inside EEDebugController.default().") print("Inside EEDebugController.default().")
# debug command Options and subcommand calls and definations to # debug command Options and subcommand calls and definations to
# mention here # mention here

15
ee/cli/controllers/info.py

@ -1,21 +1,26 @@
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
class EEInfoController(CementBaseController): class EEInfoController(CementBaseController):
class Meta: class Meta:
label = 'info' label = 'info'
stacked_on = 'base' stacked_on = 'base'
stacked_type = 'nested' stacked_type = 'nested'
description = 'info command used for debugging issued with stack or site specific configuration' description = 'info command used for debugging issued with stack or \
site specific configuration'
arguments = [ arguments = [
(['--mysql'], (['--mysql'],
dict(help='get mysql configuration information', action='store_true') ), dict(help='get mysql configuration information',
action='store_true')),
(['--php'], (['--php'],
dict(help='get php configuration information', action='store_true') ), dict(help='get php configuration information',
action='store_true')),
(['--nginx'], (['--nginx'],
dict(help='get nginx configuration information', action='store_true') ), dict(help='get nginx configuration information',
action='store_true')),
] ]
@expose(hide=True) @expose(hide=True)
def default(self): def default(self):
# TODO Default action for ee debug command # TODO Default action for ee debug command
print ("Inside EEInfoController.default().") print("Inside EEInfoController.default().")

15
ee/cli/controllers/isl.py

@ -1,21 +1,26 @@
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
class EEImportslowlogController(CementBaseController): class EEImportslowlogController(CementBaseController):
class Meta: class Meta:
label = 'import_slow_log' label = 'import_slow_log'
stacked_on = 'base' stacked_on = 'base'
stacked_type = 'nested' stacked_type = 'nested'
description = 'info command used for debugging issued with stack or site specific configuration' description = 'info command used for debugging issued with stack or \
site specific configuration'
arguments = [ arguments = [
(['--mysql'], (['--mysql'],
dict(help='get mysql configuration information', action='store_true') ), dict(help='get mysql configuration information',
action='store_true')),
(['--php'], (['--php'],
dict(help='get php configuration information', action='store_true') ), dict(help='get php configuration information',
action='store_true')),
(['--nginx'], (['--nginx'],
dict(help='get nginx configuration information', action='store_true') ), dict(help='get nginx configuration information',
action='store_true')),
] ]
@expose(hide=True) @expose(hide=True)
def default(self): def default(self):
# TODO Default action for ee debug command # TODO Default action for ee debug command
print ("Inside EEImportslowlogController.default().") print("Inside EEImportslowlogController.default().")

17
ee/cli/controllers/secure.py

@ -1,22 +1,27 @@
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
class EESecureController(CementBaseController): class EESecureController(CementBaseController):
class Meta: class Meta:
label = 'secure' label = 'secure'
stacked_on = 'base' stacked_on = 'base'
stacked_type = 'nested' stacked_type = 'nested'
description = 'secure command used for debugging issued with stack or site specific configuration' description = 'secure command used for debugging issued with stack or \
site specific configuration'
arguments = [ arguments = [
(['--ip'], (['--ip'],
dict(help='whitelist ip addresses to access admin tools without authentication', dict(help='whitelist ip addresses to access admin tools without \
action='store_true') ), authentication',
action='store_true')),
(['--auth'], (['--auth'],
dict(help='change http auth credentials', action='store_true') ), dict(help='change http auth credentials',
action='store_true')),
(['--port'], (['--port'],
dict(help='change port for admin tools default is 22222', action='store_true') ), dict(help='change port for admin tools default is 22222',
action='store_true')),
] ]
@expose(hide=True) @expose(hide=True)
def default(self): def default(self):
# TODO Default action for ee debug command # TODO Default action for ee debug command
print ("Inside EESecureController.default().") print("Inside EESecureController.default().")

47
ee/cli/controllers/site.py

@ -3,15 +3,17 @@
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
from ee.core.dummy import EEDummy from ee.core.dummy import EEDummy
class EESiteController(CementBaseController): class EESiteController(CementBaseController):
class Meta: class Meta:
label = 'site' label = 'site'
stacked_on = 'base' stacked_on = 'base'
stacked_type = 'nested' stacked_type = 'nested'
description = 'site command manages website configuration with the help of the following subcommands' description = 'site command manages website configuration with the help \
of the following subcommands'
arguments = [ arguments = [
(['site_name'], (['site_name'],
dict(help='website name') ), dict(help='website name')),
] ]
@expose(hide=True) @expose(hide=True)
@ -65,29 +67,28 @@ class EESiteController(CementBaseController):
print("Inside EESiteController.cd().") print("Inside EESiteController.cd().")
class EESiteCreateController(CementBaseController): class EESiteCreateController(CementBaseController):
class Meta: class Meta:
label = 'create' label = 'create'
stacked_on = 'site' stacked_on = 'site'
stacked_type = 'nested' stacked_type = 'nested'
description = 'create command manages website configuration with the help of the following subcommands' description = 'create command manages website configuration with the \
help of the following subcommands'
arguments = [ arguments = [
(['site_name'], (['site_name'],
dict(help='the notorious foo option') ), dict(help='the notorious foo option')),
(['--html'], (['--html'],
dict(help="html site", action='store_true')), dict(help="html site", action='store_true')),
(['--php'], (['--php'],
dict(help="php site", action='store_true')), dict(help="php site", action='store_true')),
(['--mysql'], (['--mysql'],
dict(help="mysql site", action='store_true')), dict(help="mysql site", action='store_true')),
(['--wp'], (['--wp'],
dict(help="wordpress site", action='store_true')), dict(help="wordpress site", action='store_true')),
(['--wpsubdir'], (['--wpsubdir'],
dict(help="wpsubdir site", action='store_true')), dict(help="wpsubdir site", action='store_true')),
(['--wpsubdomain'], (['--wpsubdomain'],
dict(help="wpsubdomain site", action='store_true')), dict(help="wpsubdomain site", action='store_true')),
] ]
@expose(hide=True) @expose(hide=True)
@ -95,36 +96,36 @@ class EESiteCreateController(CementBaseController):
# TODO Default action for ee site command # TODO Default action for ee site command
print("Inside EESiteCreateController.default().") print("Inside EESiteCreateController.default().")
class EESiteUpdateController(CementBaseController): class EESiteUpdateController(CementBaseController):
class Meta: class Meta:
label = 'update' label = 'update'
stacked_on = 'site' stacked_on = 'site'
stacked_type = 'nested' stacked_type = 'nested'
description = 'update command manages website configuration with the help of the following subcommands' description = 'update command manages website configuration with the \
help of the following subcommands'
arguments = [ arguments = [
(['site_name'], (['site_name'],
dict(help='website name', nargs="1") ), dict(help='website name', nargs="1")),
(['--html'], (['--html'],
dict(help="html site", action='store_true')), dict(help="html site", action='store_true')),
(['--php'], (['--php'],
dict(help="php site", action='store_true')), dict(help="php site", action='store_true')),
(['--mysql'], (['--mysql'],
dict(help="mysql site", action='store_true')), dict(help="mysql site", action='store_true')),
(['--wp'], (['--wp'],
dict(help="wordpress site", action='store_true')), dict(help="wordpress site", action='store_true')),
(['--wpsubdir'], (['--wpsubdir'],
dict(help="wpsubdir site", action='store_true')), dict(help="wpsubdir site", action='store_true')),
(['--wpsubdomain'], (['--wpsubdomain'],
dict(help="wpsubdomain site", action='store_true')), dict(help="wpsubdomain site", action='store_true')),
] ]
@expose(help="update example.com") @expose(help="update example.com")
def default(self): def default(self):
# TODO Write code for ee site update here # TODO Write code for ee site update here
print("Inside EESiteUpdateController.default().") print("Inside EESiteUpdateController.default().")
# site command Options and subcommand calls and definations to # site command Options and subcommand calls and definations to
# mention here # mention here

9
ee/cli/controllers/stack.py

@ -2,6 +2,7 @@
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
class EEStackController(CementBaseController): class EEStackController(CementBaseController):
class Meta: class Meta:
label = 'stack' label = 'stack'
@ -10,17 +11,17 @@ class EEStackController(CementBaseController):
description = 'stack command manages stack operations' description = 'stack command manages stack operations'
arguments = [ arguments = [
(['--web'], (['--web'],
dict(help='Install web stack', action='store_true') ), dict(help='Install web stack', action='store_true')),
(['--admin'], (['--admin'],
dict(help='Install admin tools stack', action='store_true') ), dict(help='Install admin tools stack', action='store_true')),
(['--mail'], (['--mail'],
dict(help='Install mail server stack', action='store_true') ), dict(help='Install mail server stack', action='store_true')),
] ]
@expose(hide=True) @expose(hide=True)
def default(self): def default(self):
# TODO Default action for ee stack command # TODO Default action for ee stack command
print ("Inside EEStackController.default().") print("Inside EEStackController.default().")
# stack command Options and subcommand calls and definations to # stack command Options and subcommand calls and definations to
# mention here # mention here

1
ee/cli/main.py

@ -48,6 +48,7 @@ class EETestApp(EEApp):
# to import it as a global (rather than passing it into another class/func) # to import it as a global (rather than passing it into another class/func)
app = EEApp() app = EEApp()
def main(): def main():
try: try:
# Default our exit status to 0 (non-error) # Default our exit status to 0 (non-error)

2
ee/utils/test.py

@ -3,6 +3,7 @@
from ee.cli.main import EETestApp from ee.cli.main import EETestApp
from cement.utils.test import * from cement.utils.test import *
class EETestCase(CementTestCase): class EETestCase(CementTestCase):
app_class = EETestApp app_class = EETestApp
@ -13,4 +14,3 @@ class EETestCase(CementTestCase):
def tearDown(self): def tearDown(self):
"""Override teardown actions (for every test).""" """Override teardown actions (for every test)."""
super(EETestCase, self).tearDown() super(EETestCase, self).tearDown()

7
tests/cli/test_ee.py

@ -2,8 +2,15 @@
from ee.utils import test from ee.utils import test
class CliTestCase(test.EETestCase): class CliTestCase(test.EETestCase):
def test_ee_cli(self): def test_ee_cli(self):
self.app.setup() self.app.setup()
self.app.run() self.app.run()
self.app.close() self.app.close()
def test_ee_cli_site_create(self):
self.app = EETestApp(argv=['site', 'create', 'example.com'])
self.app.setup()
self.app.run()
self.app.close()

Loading…
Cancel
Save