TroveClient API Documentation cleanup

- The documentation index page will now contain a
Version 1 API Reference section with links to each v1 module and
documentation for each method in that module.

- Copied python-novaclients gen_ref method into the doc/source/conf.py file
that dyanamically generates the sphinx .rst files for each trove v1 module.
When it runs it will create generate a new folder named ref/v1/ and will
contain each module such as instances.rst with the filled out automodule
sphinx code.

Ex: /ref/v1/instances.rst

.. automodule:: troveclient.v1.instances
    :members:
    :undoc-members:
    :show-inheritance:

Change-Id: Ib311486564f5b6def205590a1ccc2e493f3fef97
This commit is contained in:
Edmond Kotowski 2015-02-11 18:29:18 -08:00
parent a67f6b1a78
commit 4acdad63ac
3 changed files with 49 additions and 18 deletions

View File

@ -18,6 +18,54 @@
#
# -*- coding: utf-8 -*-
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))
sys.path.insert(0, ROOT)
sys.path.insert(0, BASE_DIR)
def gen_ref(ver, title, names):
refdir = os.path.join(BASE_DIR, "ref")
pkg = "troveclient"
if ver:
pkg = "%s.%s" % (pkg, ver)
refdir = os.path.join(refdir, ver)
if not os.path.exists(refdir):
os.makedirs(refdir)
idxpath = os.path.join(refdir, "index.rst")
with open(idxpath, "w") as idx:
idx.write(("%(title)s\n"
"%(signs)s\n"+
"\n"
".. toctree::\n"
" :maxdepth: 1\n"
"\n") % {"title": title, "signs": "=" * len(title)})
for name in names:
idx.write(" %s\n" % name)
rstpath = os.path.join(refdir, "%s.rst" % name)
with open(rstpath, "w") as rst:
rst.write(("%(title)s\n"
"%(signs)s\n"
"\n"
".. automodule:: %(pkg)s.%(name)s\n"
" :members:\n"
" :undoc-members:\n"
" :show-inheritance:\n"
" :noindex:\n")
% {"title": name.capitalize(),
"signs": "=" * len(name),
"pkg": pkg, "name": name})
gen_ref("v1", "Version 1 API Reference",
["accounts", "backups", "client", "clusters", "configurations",
"databases", "datastores", "diagnostics", "flavors",
"hosts", "instances", "limits", "management", "metadata",
"quota", "root", "security_groups", "shell", "storage", "users"])
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',

View File

@ -19,11 +19,10 @@
:maxdepth: 2
usage
pydocs
ref/v1/index
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -1,16 +0,0 @@
PyDocs
=================
troveclient
--------------
.. automodule:: troveclient
:members:
:undoc-members:
:show-inheritance:
.. autoclass:: troveclient.compat.client.Dbaas
:members:
:undoc-members:
:show-inheritance: