# Path: memsql_loader/util/bootstrap.py
# def bootstrap(force=False):
#     logger = log.get_logger('Bootstrap')  # noqa
# 
#     def write_log(title, name, msg):
#         log_title_width = 28
#         title = ("%s [%s]: " % (title, name)).rjust(log_title_width, ' ')
#         logger.info(title + msg)
# 
#     write_log('Database', storage.MEMSQL_LOADER_DB, 'Checking...')
#     if force:
#         write_log('Database', storage.MEMSQL_LOADER_DB, 'Dropping...')
#         storage.LoaderStorage.drop_database()
#     write_log('Database', storage.MEMSQL_LOADER_DB, 'Ready.')
# 
#     for Model in MODELS.values():
#         instance = Model()
#         if not instance.ready():
#             write_log('Table', Model.__name__, 'Bootstrapping...')
#             instance.setup()
#         write_log('Table', Model.__name__, 'Ready.')


from memsql_loader.util import bootstrap

class Command(object):
    def __init__(self, options):
        self.options = options
        self.ensure_bootstrapped()
        self.run()

    @staticmethod
    def configure(parser, subparsers):
        raise NotImplemented('Every command needs a static configure(...) method')

    def ensure_bootstrapped(self):

# Path: memsql_loader/util/bootstrap.py
# def bootstrap(force=False):
#     logger = log.get_logger('Bootstrap')  # noqa
# 
#     def write_log(title, name, msg):
#         log_title_width = 28
#         title = ("%s [%s]: " % (title, name)).rjust(log_title_width, ' ')
#         logger.info(title + msg)
# 
#     write_log('Database', storage.MEMSQL_LOADER_DB, 'Checking...')
#     if force:
#         write_log('Database', storage.MEMSQL_LOADER_DB, 'Dropping...')
#         storage.LoaderStorage.drop_database()
#     write_log('Database', storage.MEMSQL_LOADER_DB, 'Ready.')
# 
#     for Model in MODELS.values():
#         instance = Model()
#         if not instance.ready():
#             write_log('Table', Model.__name__, 'Bootstrapping...')
#             instance.setup()
#         write_log('Table', Model.__name__, 'Ready.')


# Path: memsql_loader/util/command.py
from memsql_loader.util import bootstrap


class Command(object):
    def __init__(self, options):
        self.options = options
        self.ensure_bootstrapped()
        self.run()

    @staticmethod
    def configure(parser, subparsers):
        raise NotImplemented('Every command needs a static configure(...) method')

    def ensure_bootstrapped(self):

        if not bootstrap.check_bootstrapped():