# Path: webtools/management/base.py
# class Command(object):
#     def __init__(self, cmdapp):
#         self.cmdapp = cmdapp
# 
#     @classmethod
#     def get_name(cls):
#         name = cls.__name__.lower()
#         if name.endswith("command"):
#             name = name[:-7]
#         elif name.endswith("cmd"):
#             name = name[:-3]
#         return name
# 
#     @classmethod
#     def get_description(cls):
#         doc = inspect.getdoc(cls)
#         if not doc:
#             return ""
# 
#         return doc.strip().split("\n")[0]
# 
#     @classmethod
#     def get_parser(cls, root_parser):
#         """
#         Return an :class:`argparse.ArgumentParser`.
#         """
#         return root_parser
# 
#     def take_action(self, parsed_args):
#         """
#         Override to do something useful.
#         """
#         raise NotImplementedError
# 
#     def run(self, parsed_args):
#         """
#         Invoked by the application when the command is run.
# 
#         Developers implementing commands should override
#         :meth:`take_action`.
# 
#         Developers creating new command base classes (such as
#         :class:`Lister` and :class:`ShowOne`) should override this
#         method to wrap :meth:`take_action`.
#         """
#         self.take_action(parsed_args)
#         return 0
# 
# Path: webtools/database.py



from webtools.management.base import Command
from webtools.database import Base
        from webtools.application import Application
        from webtools.application import Application


class SyncdbCommand(Command):
    """
    Syncronize all available sqlalchemy defined tables
    to a database server.
    """

    def take_action(self, options):
        if not self.cmdapp.conf:
            raise RuntimeError("For start serverm --settings parameter"
                                " is mandatory!")

        app = Application(self.cmdapp.conf)

        print("Create theese tables:")
        for tbl in Base.metadata.sorted_tables:
            print(" * {0}".format(tbl.name))

        res = input("Create [Y/n] ")
        if not res or res.lower() == "y":
            res = True
        else:
            res = False


        if res:

# Path: webtools/management/base.py
# class Command(object):
#     def __init__(self, cmdapp):
#         self.cmdapp = cmdapp
# 
#     @classmethod
#     def get_name(cls):
#         name = cls.__name__.lower()
#         if name.endswith("command"):
#             name = name[:-7]
#         elif name.endswith("cmd"):
#             name = name[:-3]
#         return name
# 
#     @classmethod
#     def get_description(cls):
#         doc = inspect.getdoc(cls)
#         if not doc:
#             return ""
# 
#         return doc.strip().split("\n")[0]
# 
#     @classmethod
#     def get_parser(cls, root_parser):
#         """
#         Return an :class:`argparse.ArgumentParser`.
#         """
#         return root_parser
# 
#     def take_action(self, parsed_args):
#         """
#         Override to do something useful.
#         """
#         raise NotImplementedError
# 
#     def run(self, parsed_args):
#         """
#         Invoked by the application when the command is run.
# 
#         Developers implementing commands should override
#         :meth:`take_action`.
# 
#         Developers creating new command base classes (such as
#         :class:`Lister` and :class:`ShowOne`) should override this
#         method to wrap :meth:`take_action`.
#         """
#         self.take_action(parsed_args)
#         return 0
# 
# Path: webtools/database.py



# Path: webtools/management/commands/syncdb.py
from webtools.management.base import Command
from webtools.database import Base
        from webtools.application import Application
        from webtools.application import Application



class SyncdbCommand(Command):
    """
    Syncronize all available sqlalchemy defined tables
    to a database server.
    """

    def take_action(self, options):
        if not self.cmdapp.conf:
            raise RuntimeError("For start serverm --settings parameter"
                                " is mandatory!")

        app = Application(self.cmdapp.conf)

        print("Create theese tables:")
        for tbl in Base.metadata.sorted_tables:
            print(" * {0}".format(tbl.name))

        res = input("Create [Y/n] ")
        if not res or res.lower() == "y":
            res = True
        else:
            res = False


        if res:

            Base.metadata.create_all(app.engine)