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
class EEBaseController(CementBaseController):
class Meta:
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 = [
(['-f', '--foo'],
dict(help='the notorious foo option', dest='foo', action='store',
metavar='TEXT') ),
metavar='TEXT')),
]
@expose(hide=True)

14
ee/cli/controllers/clean.py

@ -2,27 +2,29 @@
from cement.core.controller import CementBaseController, expose
class EECleanController(CementBaseController):
class Meta:
label = 'clean'
stacked_on = 'base'
stacked_type = 'nested'
description = 'clean command cleans different cache with following options'
description = 'clean command cleans different cache with following \
options'
arguments = [
(['--all'],
dict(help='clean all cache', action='store_true') ),
dict(help='clean all cache', action='store_true')),
(['--fastcgi'],
dict(help='clean fastcgi cache', action='store_true')),
dict(help='clean fastcgi cache', action='store_true')),
(['--memcache'],
dict(help='clean memcache', action='store_true')),
dict(help='clean memcache', action='store_true')),
(['--opcache'],
dict(help='clean opcode cache cache', action='store_true'))
dict(help='clean opcode cache cache', action='store_true'))
]
@expose(hide=True)
def default(self):
# 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
# mention here

18
ee/cli/controllers/debug.py

@ -2,31 +2,33 @@
from cement.core.controller import CementBaseController, expose
class EEDebugController(CementBaseController):
class Meta:
label = 'debug'
stacked_on = 'base'
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 = [
(['--fpm'],
dict(help='debug fpm', action='store_true') ),
dict(help='debug fpm', action='store_true')),
(['--mysql'],
dict(help='debug mysql', action='store_true') ),
dict(help='debug mysql', action='store_true')),
(['--nginx'],
dict(help='debug nginx', action='store_true') ),
dict(help='debug nginx', action='store_true')),
(['--php'],
dict(help='debug php', action='store_true') ),
dict(help='debug php', action='store_true')),
(['--rewrite'],
dict(help='debug rewrite', action='store_true') ),
dict(help='debug rewrite', action='store_true')),
(['--stop'],
dict(help='stop debugging', action='store_true') ),
dict(help='stop debugging', action='store_true')),
]
@expose(hide=True)
def default(self):
# TODO Default action for ee debug command
print ("Inside EEDebugController.default().")
print("Inside EEDebugController.default().")
# debug command Options and subcommand calls and definations to
# mention here

15
ee/cli/controllers/info.py

@ -1,21 +1,26 @@
from cement.core.controller import CementBaseController, expose
class EEInfoController(CementBaseController):
class Meta:
label = 'info'
stacked_on = 'base'
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 = [
(['--mysql'],
dict(help='get mysql configuration information', action='store_true') ),
dict(help='get mysql configuration information',
action='store_true')),
(['--php'],
dict(help='get php configuration information', action='store_true') ),
dict(help='get php configuration information',
action='store_true')),
(['--nginx'],
dict(help='get nginx configuration information', action='store_true') ),
dict(help='get nginx configuration information',
action='store_true')),
]
@expose(hide=True)
def default(self):
# 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
class EEImportslowlogController(CementBaseController):
class Meta:
label = 'import_slow_log'
stacked_on = 'base'
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 = [
(['--mysql'],
dict(help='get mysql configuration information', action='store_true') ),
dict(help='get mysql configuration information',
action='store_true')),
(['--php'],
dict(help='get php configuration information', action='store_true') ),
dict(help='get php configuration information',
action='store_true')),
(['--nginx'],
dict(help='get nginx configuration information', action='store_true') ),
dict(help='get nginx configuration information',
action='store_true')),
]
@expose(hide=True)
def default(self):
# 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
class EESecureController(CementBaseController):
class Meta:
label = 'secure'
stacked_on = 'base'
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 = [
(['--ip'],
dict(help='whitelist ip addresses to access admin tools without authentication',
action='store_true') ),
dict(help='whitelist ip addresses to access admin tools without \
authentication',
action='store_true')),
(['--auth'],
dict(help='change http auth credentials', action='store_true') ),
dict(help='change http auth credentials',
action='store_true')),
(['--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)
def default(self):
# 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 ee.core.dummy import EEDummy
class EESiteController(CementBaseController):
class Meta:
label = 'site'
stacked_on = 'base'
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 = [
(['site_name'],
dict(help='website name') ),
dict(help='website name')),
]
@expose(hide=True)
@ -65,29 +67,28 @@ class EESiteController(CementBaseController):
print("Inside EESiteController.cd().")
class EESiteCreateController(CementBaseController):
class Meta:
label = 'create'
stacked_on = 'site'
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 = [
(['site_name'],
dict(help='the notorious foo option') ),
dict(help='the notorious foo option')),
(['--html'],
dict(help="html site", action='store_true')),
dict(help="html site", action='store_true')),
(['--php'],
dict(help="php site", action='store_true')),
dict(help="php site", action='store_true')),
(['--mysql'],
dict(help="mysql site", action='store_true')),
dict(help="mysql site", action='store_true')),
(['--wp'],
dict(help="wordpress site", action='store_true')),
dict(help="wordpress site", action='store_true')),
(['--wpsubdir'],
dict(help="wpsubdir site", action='store_true')),
dict(help="wpsubdir site", action='store_true')),
(['--wpsubdomain'],
dict(help="wpsubdomain site", action='store_true')),
dict(help="wpsubdomain site", action='store_true')),
]
@expose(hide=True)
@ -95,36 +96,36 @@ class EESiteCreateController(CementBaseController):
# TODO Default action for ee site command
print("Inside EESiteCreateController.default().")
class EESiteUpdateController(CementBaseController):
class Meta:
label = 'update'
stacked_on = 'site'
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 = [
(['site_name'],
dict(help='website name', nargs="1") ),
dict(help='website name', nargs="1")),
(['--html'],
dict(help="html site", action='store_true')),
dict(help="html site", action='store_true')),
(['--php'],
dict(help="php site", action='store_true')),
dict(help="php site", action='store_true')),
(['--mysql'],
dict(help="mysql site", action='store_true')),
dict(help="mysql site", action='store_true')),
(['--wp'],
dict(help="wordpress site", action='store_true')),
dict(help="wordpress site", action='store_true')),
(['--wpsubdir'],
dict(help="wpsubdir site", action='store_true')),
dict(help="wpsubdir site", action='store_true')),
(['--wpsubdomain'],
dict(help="wpsubdomain site", action='store_true')),
dict(help="wpsubdomain site", action='store_true')),
]
@expose(help="update example.com")
def default(self):
# TODO Write code for ee site update here
print("Inside EESiteUpdateController.default().")
# site command Options and subcommand calls and definations to
# mention here

9
ee/cli/controllers/stack.py

@ -2,6 +2,7 @@
from cement.core.controller import CementBaseController, expose
class EEStackController(CementBaseController):
class Meta:
label = 'stack'
@ -10,17 +11,17 @@ class EEStackController(CementBaseController):
description = 'stack command manages stack operations'
arguments = [
(['--web'],
dict(help='Install web stack', action='store_true') ),
dict(help='Install web stack', action='store_true')),
(['--admin'],
dict(help='Install admin tools stack', action='store_true') ),
dict(help='Install admin tools stack', action='store_true')),
(['--mail'],
dict(help='Install mail server stack', action='store_true') ),
dict(help='Install mail server stack', action='store_true')),
]
@expose(hide=True)
def default(self):
# TODO Default action for ee stack command
print ("Inside EEStackController.default().")
print("Inside EEStackController.default().")
# stack command Options and subcommand calls and definations to
# 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)
app = EEApp()
def main():
try:
# Default our exit status to 0 (non-error)

2
ee/utils/test.py

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

7
tests/cli/test_ee.py

@ -2,8 +2,15 @@
from ee.utils import test
class CliTestCase(test.EETestCase):
def test_ee_cli(self):
self.app.setup()
self.app.run()
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