summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJUN JIE NAN <nanjj@cn.ibm.com>2013-12-23 11:16:17 +0800
committerJUN JIE NAN <nanjj@cn.ibm.com>2014-01-06 13:25:00 +0800
commit276b1e4ed51af02af2c31cf4bfc0334285c23899 (patch)
tree5660b23a3c493f6a47da318d93811bf93fefbb7c /doc
parentb6f81d5124a254d7de5b5a8dc1bb4a5d8be15276 (diff)
downloadpython-heatclient-276b1e4ed51af02af2c31cf4bfc0334285c23899.tar.gz
Added API reference document
The API reference document is missing so addded it and enabled pep8 check for conf.py. Change-Id: I04236c5427d7ac624781fbfc920a79f855d8cd75
Diffstat (limited to 'doc')
-rw-r--r--doc/.gitignore1
-rw-r--r--doc/source/conf.py12
-rw-r--r--doc/source/ext/gen_ref.py58
-rw-r--r--doc/source/index.rst9
4 files changed, 80 insertions, 0 deletions
diff --git a/doc/.gitignore b/doc/.gitignore
index 567609b..8e0be80 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -1 +1,2 @@
build/
+source/ref/
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 62a6725..aafb0c1 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -1,4 +1,15 @@
# -*- coding: utf-8 -*-
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
#
# python-heatclient documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 6 14:19:25 2009.
@@ -19,6 +30,7 @@ import os
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
+execfile(os.path.join("ext", "gen_ref.py"))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
diff --git a/doc/source/ext/gen_ref.py b/doc/source/ext/gen_ref.py
new file mode 100644
index 0000000..97b9bfd
--- /dev/null
+++ b/doc/source/ext/gen_ref.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import os
+import sys
+
+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 = "heatclient"
+ 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("", "Client Reference", ["client", "exc"])
+gen_ref("v1", "Version 1 API Reference",
+ ["stacks", "resources", "events", "actions"])
diff --git a/doc/source/index.rst b/doc/source/index.rst
index aeb15ec..02fa7af 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -20,6 +20,15 @@ Once you have done so, you can use the API like so::
>>> from heatclient.client import Client
>>> heat = Client('1', endpoint=heat_url, token=auth_token)
+Reference
+---------
+
+.. toctree::
+ :maxdepth: 1
+
+ ref/index
+ ref/v1/index
+
Command-line Tool
=================