Ejemplo n.º 1
0
def reset_plugin(manager):
    if not manager.options.reset_plugin:
        return
    manager.disable_tasks()
    plugin = manager.options.reset_plugin
    if plugin == '__list__':
        console('%-20s Ver Tables' % 'Name')
        console('-' * 79)
        for k, v in sorted(plugin_schemas.iteritems()):
            tables = ''
            line_len = 0
            for name in v['tables']:
                if line_len + len(name) + 2 >= 53:
                    tables += '\n'
                    tables += ' ' * 25
                    line_len = len(name) + 2
                else:
                    line_len += len(name) + 2
                tables += name + ', '
            tables = tables.rstrip(', ')
            console('%-20s %s   %s' % (k, v['version'], tables))
    else:
        try:
            reset_schema(plugin)
            console('The database for `%s` has been reset.' % plugin)
        except ValueError as e:
            console('Unable to reset %s: %s' % (plugin, e.message))
Ejemplo n.º 2
0
def reset_plugin(options):
    plugin = options.reset_plugin
    if not plugin:
        if options.porcelain:
            console('%-20s | Ver | Tables' % 'Name')
        else:
            console('-' * 79)
            console('%-20s Ver  Tables' % 'Name')
            console('-' * 79)
        for k, v in sorted(plugin_schemas.iteritems()):
            tables = ''
            line_len = 0
            for name in v['tables']:
                if options.porcelain:
                    pass
                else:
                    if line_len + len(name) + 2 >= 53:
                        tables += '\n'
                        tables += ' ' * 26
                        line_len = len(name) + 2
                    else:
                        line_len += len(name) + 2
                tables += name + ', '
            tables = tables.rstrip(', ')
            if options.porcelain:
                console('%-20s %s %-3s %s %s' %
                        (k, '|', v['version'], '|', tables))
            else:
                console('%-20s %-2s   %s' % (k, v['version'], tables))
    else:
        try:
            reset_schema(plugin)
            console('The database for `%s` has been reset.' % plugin)
        except ValueError as e:
            console('Unable to reset %s: %s' % (plugin, e.message))
Ejemplo n.º 3
0
def reset_plugin(manager):
    if not manager.options.reset_plugin:
        return
    manager.disable_tasks()
    plugin = manager.options.reset_plugin
    if plugin == '__list__':
        console('%-20s Ver Tables' % 'Name')
        console('-' * 79)
        for k, v in sorted(plugin_schemas.iteritems()):
            tables = ''
            line_len = 0
            for name in v['tables']:
                if line_len + len(name) + 2 >= 53:
                    tables += '\n'
                    tables += ' ' * 25
                    line_len = len(name) + 2
                else:
                    line_len += len(name) + 2
                tables += name + ', '
            tables = tables.rstrip(', ')
            console('%-20s %s   %s' % (k, v['version'], tables))
    else:
        try:
            reset_schema(plugin)
            console('The database for `%s` has been reset.' % plugin)
        except ValueError as e:
            console('Unable to reset %s: %s' % (plugin, e.message))
Ejemplo n.º 4
0
def reset_plugin(options):
    plugin = options.reset_plugin
    if not plugin:
        if options.porcelain:
            console('%-20s | Ver | Tables' % 'Name')
        else:
            console('-' * 79)
            console('%-20s Ver  Tables' % 'Name')
            console('-' * 79)
        for k, v in sorted(plugin_schemas.iteritems()):
            tables = ''
            line_len = 0
            for name in v['tables']:
                if options.porcelain:
                    pass
                else:
                    if line_len + len(name) + 2 >= 53:
                        tables += '\n'
                        tables += ' ' * 26
                        line_len = len(name) + 2
                    else:
                        line_len += len(name) + 2
                tables += name + ', '
            tables = tables.rstrip(', ')
            if options.porcelain:
                console('%-20s %s %-3s %s %s' % (k, '|', v['version'], '|', tables))
            else:
                console('%-20s %-2s   %s' % (k, v['version'], tables))
    else:
        try:
            reset_schema(plugin)
            console('The database for `%s` has been reset.' % plugin)
        except ValueError as e:
            console('Unable to reset %s: %s' % (plugin, e.message))
Ejemplo n.º 5
0
def reset_plugin(options):
    plugin = options.reset_plugin
    if not plugin:
        console("%-20s Ver Tables" % "Name")
        console("-" * 79)
        for k, v in sorted(plugin_schemas.iteritems()):
            tables = ""
            line_len = 0
            for name in v["tables"]:
                if line_len + len(name) + 2 >= 53:
                    tables += "\n"
                    tables += " " * 25
                    line_len = len(name) + 2
                else:
                    line_len += len(name) + 2
                tables += name + ", "
            tables = tables.rstrip(", ")
            console("%-20s %s   %s" % (k, v["version"], tables))
    else:
        try:
            reset_schema(plugin)
            console("The database for `%s` has been reset." % plugin)
        except ValueError as e:
            console("Unable to reset %s: %s" % (plugin, e.message))