Skip to content

Commit

Permalink
Merge pull request #39 from xsnippet/docs
Browse files Browse the repository at this point in the history
docs: produce API docs from OpenAPI spec
  • Loading branch information
malor committed Apr 8, 2017
2 parents 1df2251 + 2d07890 commit b16c02d
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ matrix:
- python: 3.6
env: TOXENV=py36
- env: TOXENV=openapi
- python: 3.6
env: TOXENV=docs

services:
- docker
Expand Down
29 changes: 29 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import os
import pkg_resources


here = os.path.abspath(os.path.dirname(__file__))

project = 'XSnippet API'
copyright = '2017, The XSnippet Team'
release = pkg_resources.get_distribution('xsnippet-api').version
version = '.'.join(release.split('.')[:2])
extensions = [
'sphinxcontrib.redoc',
]
source_suffix = '.rst'
master_doc = 'index'
exclude_patterns = ['_build']
pygments_style = 'sphinx'
redoc = [
{
'name': project,
'page': 'api/index',
'spec': os.path.join(here, '..', 'contrib', 'openapi', 'spec.yml'),
},
]

if not os.environ.get('READTHEDOCS') == 'True':
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
4 changes: 4 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
XSnippet API
============

At the time we do not have docs other than `API docs <api>`_.
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sphinxcontrib-redoc >= 1.0
9 changes: 9 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ usedevelop = false
deps = flex
commands =
swagger-flex -s contrib/openapi/spec.yml

[testenv:docs]
basepython = python3
deps =
sphinx
sphinx_rtd_theme
-rdocs/requirements.txt
commands =
sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/

0 comments on commit b16c02d

Please sign in to comment.