# Path: wikked/commands/base.py
# class WikkedCommand(object):
#     def __init__(self):
#         self.name = None
#         self.description = None
#         self.requires_wiki = True
# 
#     def setupParser(self, parser):
#         raise NotImplementedError()
# 
#     def run(self, ctx):
#         raise NotImplementedError()
# 
#     def _doRun(self, ctx):
#         if ctx.wiki is None and self.requires_wiki:
#             raise Exception("No wiki found here.")
#         result = self.run(ctx)
#         if result is None:
#             result = 0
#         return result
# 
# def register_command(cls):
#     command_classes.append(cls)
#     return cls


import os
import os.path
import imp
import logging
        import wikked.settings
from wikked.commands.base import WikkedCommand, register_command
        from wikked.web import app
        from wikked.tasks import celery_app
        # When running from the command line, we only have one web server
        # so make it also serve static files.
        wikked.settings.WIKI_SERVE_FILES = True
        if not ctx.args.no_update:
            wikked.settings.WIKI_AUTO_RELOAD = True

        # Start with the Witch wiki parameters.
        wikked.settings.WIKI_FACTORY_PARAMETERS = ctx.params

        # Set the debug mode for the Flask app.
        # We can't wait until we call `app.run` to do this because it can
        # create its Jinja environment before that, and so we would be missing
        # the ability to edit view templates on the fly.
        if ctx.args.dev:
            wikked.settings.DEBUG = True

        # Create/import the app.
        ctx.wiki.db.hookupWebApp(app)

        # Update if needed.
        if (bool(app.config.get('WIKI_UPDATE_ON_START')) and
                not ctx.args.no_startup_update):
            ctx.wiki.updateAll()

        # Run!
        app.run(host=ctx.args.host,
                port=ctx.args.port)


@register_command

# Path: wikked/commands/base.py
# class WikkedCommand(object):
#     def __init__(self):
#         self.name = None
#         self.description = None
#         self.requires_wiki = True
# 
#     def setupParser(self, parser):
#         raise NotImplementedError()
# 
#     def run(self, ctx):
#         raise NotImplementedError()
# 
#     def _doRun(self, ctx):
#         if ctx.wiki is None and self.requires_wiki:
#             raise Exception("No wiki found here.")
#         result = self.run(ctx)
#         if result is None:
#             result = 0
#         return result
# 
# def register_command(cls):
#     command_classes.append(cls)
#     return cls


# Path: wikked/commands/web.py
import os
import os.path
import imp
import logging
        import wikked.settings
from wikked.commands.base import WikkedCommand, register_command
        from wikked.web import app
        from wikked.tasks import celery_app

        # When running from the command line, we only have one web server
        # so make it also serve static files.
        wikked.settings.WIKI_SERVE_FILES = True
        if not ctx.args.no_update:
            wikked.settings.WIKI_AUTO_RELOAD = True

        # Start with the Witch wiki parameters.
        wikked.settings.WIKI_FACTORY_PARAMETERS = ctx.params

        # Set the debug mode for the Flask app.
        # We can't wait until we call `app.run` to do this because it can
        # create its Jinja environment before that, and so we would be missing
        # the ability to edit view templates on the fly.
        if ctx.args.dev:
            wikked.settings.DEBUG = True

        # Create/import the app.
        ctx.wiki.db.hookupWebApp(app)

        # Update if needed.
        if (bool(app.config.get('WIKI_UPDATE_ON_START')) and
                not ctx.args.no_startup_update):
            ctx.wiki.updateAll()

        # Run!
        app.run(host=ctx.args.host,
                port=ctx.args.port)


@register_command

class RunTasksCommand(WikkedCommand):