Exemplo n.º 1
0
def gen():
    pluginManager = PluginManager()
    pluginManager.find_plugins( OrchestratorConfig() )
    for plugin_type in categories:
        with open(path.join(here, plugin_type + ".rst"), "w") as f:
            name = get_plugin_type_display_name(plugin_type)
            print >>f, name
            print >>f, "*" * len(name)
            print >>f, ""
            print >>f, get_plugin_type_description(plugin_type)
            print >>f, ""
            plugins = pluginManager.get_plugins(plugin_type)
            if plugins:
                for plugin_id in sorted(plugins.keys()):
                    plugin_info = plugins[plugin_id]
                    display_name = "%s (*%s*)" % (plugin_info.display_name, plugin_id[plugin_id.rfind("/")+1:])
                    description = plugin_info.description
                    description = description.replace("\r\n", "\n")
                    description = description.replace("\n", "\n\n")
                    print >>f, display_name
                    print >>f, "=" * len(display_name)
                    print >>f, ""
                    print >>f, description
                    print >>f, ""
                    if plugin_info.plugin_args:
                        width_key = 17
                        width_value = 17
                        for key, value in plugin_info.plugin_args.iteritems():
                            if key in plugin_info.plugin_passwd_args:
                                value = "\\*" * 16
                            width_key = max(width_key, len(key))
                            width_value = max(width_value, len(value))
                        print >>f, "%s %s" % (("=" * width_key), ("=" * width_value))
                        print >>f, ("**Argument name**%s **Default value**%s" % ((" " * (width_key - 17)), (" " * (width_value - 17)))).rstrip()
                        print >>f, "%s %s" % (("-" * width_key), ("-" * width_value))
                        for key, value in plugin_info.plugin_args.iteritems():
                            value = value.replace("\r\n", "\n")
                            value = value.replace("\n", " ")
                            if key in plugin_info.plugin_passwd_args:
                                value = "\\*" * 16
                            pad_key = (" " * (width_key - len(key)))
                            pad_value = (" " * (width_value - len(value)))
                            print >>f, ("%s%s %s%s" % (key, pad_key, value, pad_value)).rstrip()
                        print >>f, ("%s %s" % (("=" * width_key), ("=" * width_value))).rstrip()
                        print >>f, ""
            else:
                print >>f, "There are currently no plugins in this category."
                print >>f, ""
        with open(path.join(here, plugin_type + ".rst"), "rU") as f:
            data = f.read()
        with open(path.join(here, plugin_type + ".rst"), "wb") as f:
            f.write(data)
    with open("index.rst", "wb") as f:
        f.write(index)
        for plugin_type in categories:
            f.write("   %s\n" % plugin_type)
Exemplo n.º 2
0
            parser.error("too many arguments")

        # Load the plugins list.
        try:
            manager = PluginManager()
            manager.find_plugins(cmdParams)
        except Exception, e:
            parser.error("error loading plugins list: %s" % str(e))

        # Show the list of plugins.
        print colorize("-------------", "red")
        print colorize(" Plugin list",  "red")
        print colorize("-------------", "red")

        # Import plugins...
        import_plugins = manager.get_plugins("import")
        if import_plugins:
            print
            print colorize("-= Import plugins =-", "yellow")
            for name in sorted(import_plugins.keys()):
                info = import_plugins[name]
                print "\n%s:\n    %s" % (colorize(name[7:], "cyan"), info.description)

        # Testing plugins...
        testing_plugins = manager.get_plugins("testing")
        if testing_plugins:
            names = sorted(testing_plugins.keys())
            names = [x[8:] for x in names]
            stages = [ (v,k) for (k,v) in manager.STAGES.iteritems() ]
            stages.sort()
            for _, stage in stages:
Exemplo n.º 3
0
def gen():
    pluginManager = PluginManager()
    pluginManager.find_plugins(OrchestratorConfig())
    for plugin_type in categories:
        with open(path.join(here, plugin_type + ".rst"), "w") as f:
            name = get_plugin_type_display_name(plugin_type)
            print >> f, name
            print >> f, "*" * len(name)
            print >> f, ""
            print >> f, get_plugin_type_description(plugin_type)
            print >> f, ""
            plugins = pluginManager.get_plugins(plugin_type)
            if plugins:
                for plugin_id in sorted(plugins.keys()):
                    plugin_info = plugins[plugin_id]
                    display_name = "%s (*%s*)" % (
                        plugin_info.display_name,
                        plugin_id[plugin_id.rfind("/") + 1:])
                    description = plugin_info.description
                    description = description.replace("\r\n", "\n")
                    description = description.replace("\n", "\n\n")
                    print >> f, display_name
                    print >> f, "=" * len(display_name)
                    print >> f, ""
                    print >> f, description
                    print >> f, ""
                    if plugin_info.plugin_args:
                        width_key = 17
                        width_value = 17
                        for key, value in plugin_info.plugin_args.iteritems():
                            if key in plugin_info.plugin_passwd_args:
                                value = "\\*" * 16
                            width_key = max(width_key, len(key))
                            width_value = max(width_value, len(value))
                        print >> f, "%s %s" % (("=" * width_key),
                                               ("=" * width_value))
                        print >> f, (
                            "**Argument name**%s **Default value**%s" %
                            ((" " * (width_key - 17)),
                             (" " * (width_value - 17)))).rstrip()
                        print >> f, "%s %s" % (("-" * width_key),
                                               ("-" * width_value))
                        for key, value in plugin_info.plugin_args.iteritems():
                            value = value.replace("\r\n", "\n")
                            value = value.replace("\n", " ")
                            if key in plugin_info.plugin_passwd_args:
                                value = "\\*" * 16
                            pad_key = (" " * (width_key - len(key)))
                            pad_value = (" " * (width_value - len(value)))
                            print >> f, (
                                "%s%s %s%s" %
                                (key, pad_key, value, pad_value)).rstrip()
                        print >> f, ("%s %s" % (("=" * width_key),
                                                ("=" * width_value))).rstrip()
                        print >> f, ""
            else:
                print >> f, "There are currently no plugins in this category."
                print >> f, ""
        with open(path.join(here, plugin_type + ".rst"), "rU") as f:
            data = f.read()
        with open(path.join(here, plugin_type + ".rst"), "wb") as f:
            f.write(data)
    with open("index.rst", "wb") as f:
        f.write(index)
        for plugin_type in categories:
            f.write("   %s\n" % plugin_type)