forked from redhat-performance/tuned
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request redhat-performance#693 from zacikpa/autodocs
Automatic generation of plugin docs from their docstrings
- Loading branch information
Showing
31 changed files
with
261 additions
and
491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
tuned-*.tar.bz2 | ||
*~ | ||
*.html | ||
doc/manual/modules/performance/ref_available-tuned-plug-ins.adoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
import argparse | ||
import os | ||
import inspect | ||
from tuned.utils.plugin_loader import PluginLoader | ||
from tuned.plugins.base import Plugin | ||
|
||
|
||
class DocLoader(PluginLoader): | ||
def __init__(self): | ||
super(DocLoader, self).__init__() | ||
|
||
def _set_loader_parameters(self): | ||
self._namespace = "tuned.plugins" | ||
self._prefix = "plugin_" | ||
self._interface = Plugin | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("intro") | ||
parser.add_argument("out") | ||
args = parser.parse_args() | ||
|
||
with open(args.intro, "r") as intro_file: | ||
intro = intro_file.read() | ||
|
||
all_plugins = sorted(DocLoader().load_all_plugins(), key=lambda x: x.__module__) | ||
|
||
with open(args.out, "w") as out_file: | ||
out_file.write(intro) | ||
for plugin in all_plugins: | ||
plugin_file = inspect.getfile(plugin) | ||
plugin_name = os.path.basename(plugin_file)[7:-3] | ||
out_file.write("\n") | ||
out_file.write(f"== **{plugin_name}**\n") | ||
out_file.write(inspect.cleandoc(plugin.__doc__)) | ||
out_file.write("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
.PHONY: clean | ||
|
||
index.html: master.adoc assemblies/*.adoc meta/*.adoc modules/performance/*.adoc | ||
index.html: master.adoc assemblies/*.adoc meta/*.adoc modules/performance/*.adoc ../../tuned/plugins/plugin_*.py | ||
python3 ../../compile_plugin_docs.py modules/performance/ref_available-tuned-plug-ins_intro.adoc modules/performance/ref_available-tuned-plug-ins.adoc | ||
asciidoctor -o index.html master.adoc || asciidoc -o index.html master.adoc | ||
|
||
install: index.html | ||
install -Dpm 0644 index.html $(DESTDIR)$(DOCDIR)/manual/index.html | ||
|
||
clean: | ||
rm -f modules/performance/ref_available-tuned-plug-ins.adoc | ||
rm -f *.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
241 changes: 0 additions & 241 deletions
241
doc/manual/modules/performance/ref_available-tuned-plug-ins.adoc
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
doc/manual/modules/performance/ref_available-tuned-plug-ins_intro.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
:_module-type: REFERENCE | ||
[id="available-tuned-plug-ins_{context}"] | ||
= Available TuneD plug-ins | ||
|
||
[role="_abstract"] | ||
This section lists all monitoring and tuning plug-ins currently available in *TuneD*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.