From 4c80eab9e73b137609507b3d135da4c7936f2ba2 Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Fri, 17 Jun 2016 09:54:52 -0700 Subject: [PATCH] Added Sphinx-based documentation framework and specs repo. All of openstack's documentation infrastructure is run via sphinx, including templates, html parsing, uploading, and more. Thus it behooves us to keep our javascript documentation build as similar as possible. Since we want to avoid using tox, and littering the project with pythonic artifacts, we're instead using Sphinx' own recommended build method: A Makefile. This patch adds a small but complete documentation tree for this project, including the build tools needed to create it. It satisfies the need for narrative documentation, but does not (yet) satisfy the need for code doc generation. It also includes a section for specifications, as this effort is not yet large enough to warrant its own specification repo. Code documentation will need to be added in a subsequent patch, using Sphinx' jsdoc plugins. Change-Id: I40eab962d4e4c6eafd1b1499bb00e6af5d72ede0 --- .gitignore | 3 + doc/Makefile | 227 +++++++++++++++++++++++++++++++++ doc/source/conf.py | 87 +++++++++++++ doc/source/dev_get_started.rst | 17 +++ doc/source/getting_started.rst | 5 + doc/source/index.rst | 23 ++++ doc/source/specs.rst | 44 +++++++ doc/source/specs/template.rst | 107 ++++++++++++++++ package.json | 3 +- 9 files changed, 515 insertions(+), 1 deletion(-) create mode 100644 doc/Makefile create mode 100644 doc/source/conf.py create mode 100644 doc/source/dev_get_started.rst create mode 100644 doc/source/getting_started.rst create mode 100644 doc/source/index.rst create mode 100644 doc/source/specs.rst create mode 100644 doc/source/specs/template.rst diff --git a/.gitignore b/.gitignore index f099cce..30963a7 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,6 @@ bower_components # OS-specific .DS_Store + +# Doc build +doc/build diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..d370944 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,227 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build +VENVDIR = .venv + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + + +.PHONY: help +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " applehelp to make an Apple Help Book" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " epub3 to make an epub3" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " coverage to run coverage check of the documentation (if enabled)" + @echo " dummy to check syntax errors of document sources" + +.PHONY: clean +clean: + rm -rf $(BUILDDIR)/* + +.PHONY: html +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +.PHONY: dirhtml +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +.PHONY: singlehtml +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +.PHONY: pickle +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +.PHONY: json +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +.PHONY: htmlhelp +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +.PHONY: qthelp +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/openstack-lib.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/openstack-lib.qhc" + +.PHONY: applehelp +applehelp: + $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp + @echo + @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." + @echo "N.B. You won't be able to view it unless you put it in" \ + "~/Library/Documentation/Help or install it in your application" \ + "bundle." + +.PHONY: devhelp +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/openstack-lib" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/openstack-lib" + @echo "# devhelp" + +.PHONY: epub +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +.PHONY: epub3 +epub3: + $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3 + @echo + @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3." + +.PHONY: latex +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +.PHONY: latexpdf +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: latexpdfja +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: text +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +.PHONY: man +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +.PHONY: texinfo +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +.PHONY: info +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +.PHONY: gettext +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +.PHONY: changes +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +.PHONY: linkcheck +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +.PHONY: doctest +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +.PHONY: coverage +coverage: + $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage + @echo "Testing of coverage in the sources finished, look at the " \ + "results in $(BUILDDIR)/coverage/python.txt." + +.PHONY: xml +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +.PHONY: pseudoxml +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." + +.PHONY: dummy +dummy: + $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy + @echo + @echo "Build finished. Dummy builder generates no files." diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100644 index 0000000..e43b65c --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,87 @@ +# -*- 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 datetime +import os +import sys + +sys.path.insert(0, os.path.abspath('../..')) +# -- General configuration ---------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [ + 'sphinx.ext.autodoc', + 'oslosphinx' +] + +exclude_patterns = [ + 'template.rst', +] + +# Optionally allow the use of sphinxcontrib.spelling to verify the +# spelling of the documents. +try: + import sphinxcontrib.spelling + extensions.append('sphinxcontrib.spelling') +except ImportError: + pass + +# autodoc generation is a bit aggressive and a nuisance when doing heavy +# text edit cycles. +# execute "export SPHINX_DEBUG=1" in your terminal to disable + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'js-openstack-lib' +copyright = u'%s, OpenStack Foundation' % datetime.date.today().year + +# If true, '()' will be appended to :func: etc. cross-reference text. +add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +add_module_names = True + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# -- Options for HTML output -------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +# html_theme_path = ["."] +# html_theme = '_theme' +# html_static_path = ['static'] + +# Output file base name for HTML help builder. +htmlhelp_basename = '%sdoc' % project + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass +# [howto/manual]). +latex_documents = [ + ('index', + '%s.tex' % project, + u'%s Documentation' % project, + u'OpenStack Foundation', 'manual'), +] + +# Example configuration for intersphinx: refer to the Python standard library. +#intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/source/dev_get_started.rst b/doc/source/dev_get_started.rst new file mode 100644 index 0000000..c98dd11 --- /dev/null +++ b/doc/source/dev_get_started.rst @@ -0,0 +1,17 @@ +================================ +Contributing to js-openstack-lib +================================ + +If you would like to contribute to the development of OpenStack, +you must follow the steps in this page: + + http://docs.openstack.org/infra/manual/developers.html + +If you already have a good understanding of how the system works and your +OpenStack accounts are set up, you can skip to the development workflow section +of this documentation to learn how changes to OpenStack should be submitted for +review via the Gerrit tool: + + http://docs.openstack.org/infra/manual/developers.html#development-workflow + +More TBD. diff --git a/doc/source/getting_started.rst b/doc/source/getting_started.rst new file mode 100644 index 0000000..71d807e --- /dev/null +++ b/doc/source/getting_started.rst @@ -0,0 +1,5 @@ +=============== +Getting Started +=============== + +This section TBD. diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 0000000..54295b7 --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,23 @@ +======================== +OpenStack JavaScript SDK +======================== + +Welcome to the OpenStack JavaScript SDK. This SDK is still under +construction, and many design decisions are being made. If you'd like to be +involved in this process, please take a look at the specifications and +patches under discussion in gerrit_, or come visit us in +`#openstack-javascript`_ on FreeNode (IRC). + +Topics +====== + +.. toctree:: + :maxdepth: 2 + + getting_started + dev_get_started + specs + + +.. _gerrit: https://review.openstack.org/#/q/status:open+AND+project:openstack/js-openstack-lib,n,z +.. _#openstack-javascript: http://webchat.freenode.net/?channels=openstack-javascript diff --git a/doc/source/specs.rst b/doc/source/specs.rst new file mode 100644 index 0000000..6f2c33a --- /dev/null +++ b/doc/source/specs.rst @@ -0,0 +1,44 @@ +===================== +Design Specifications +===================== + +Priority Specifications +======================= + +This is a list of approved design specifications, which are considered +high-priority for this project. It is very likely that work is already in +progress, however contributions and reviews are always welcome. + +.. If you add additional projects to this list, please update the gerrit + query block. + +.. toctree:: + :maxdepth: 1 + + +Gerrit query for all changes related to priority efforts:: + + status:open AND project:openstack/js-openstack-lib + +https://review.openstack.org/#/q/status:open+AND+project:openstack/js-openstack-lib,n,z + +Approved Specifications +======================= + +These are specifications that have been approved; work may or may not +have started on these. Reviewers will review related changes as time +permits. + +.. toctree:: + :glob: + :maxdepth: 1 + + +Implemented Specifications +========================== + +These specifications have already been implemented and are listed here +for historical purposes. + +.. toctree:: + :maxdepth: 1 diff --git a/doc/source/specs/template.rst b/doc/source/specs/template.rst new file mode 100644 index 0000000..c1e63c2 --- /dev/null +++ b/doc/source/specs/template.rst @@ -0,0 +1,107 @@ +:: + + Copyright <--UPDATE THESE + + This work is licensed under a Creative Commons Attribution 3.0 + Unported License. + http://creativecommons.org/licenses/by/3.0/legalcode + +.. + This template should be in ReSTructured text. Please do not delete + any of the sections in this template. If you have nothing to say + for a whole section, just write: "None". For help with syntax, see + http://sphinx-doc.org/rest.html To test out your formatting, see + http://www.tele3.cz/jbar/rest/rest.html + +=============================== +The Title of Your Specification +=============================== + +Include the URL of your StoryBoard story: + +https://storyboard.openstack.org/... + +Introduction paragraph -- why are we doing anything? + +Problem Description +=================== + +A detailed description of the problem. + +Proposed Change +=============== + +Here is where you cover the change you propose to make in detail. How do you +propose to solve this problem? + +If this is one part of a larger effort make it clear where this piece ends. In +other words, what's the scope of this effort? + +Alternatives +------------ + +This is an optional section, where it does apply we'd just like a demonstration +that some thought has been put into why the proposed approach is the best one. + +Implementation +============== + +Assignee(s) +----------- + +Who is leading the writing of the code? Or is this a blueprint where you're +throwing it out there to see who picks it up? + +If more than one person is working on the implementation, please designate the +primary author and contact. + +Primary assignee: + + +Can optionally list additional ids if they intend on doing substantial +implementation work on this blueprint. + +Gerrit Topic +------------ + +Use Gerrit topic "" for all patches related to this spec. + +.. code-block:: bash + + git-review -t + +Work Items +---------- + +Work items or tasks -- break the feature up into the things that need to be +done to implement it. Those parts might end up being done by different people, +but we're mostly trying to understand the timeline for implementation. + +Documentation +------------- + +Will this require a documentation change? If so, which documents? +Will it impact developer workflow? Will additional communication need +to be made? + +Security +-------- + +Does this introduce any additional security risks, or are there +security-related considerations which should be discussed? + +Testing +------- + +What tests will be available or need to be constructed in order to +validate this? Unit/functional tests, development +environments/servers, etc. + +Dependencies +============ + +- Include specific references to specs and/or stories in storyboard, or in + other projects, that this one either depends on or is related to. + +- Does this feature require any new library or program dependencies + not already in use? diff --git a/package.json b/package.json index 40a00ca..2dcbf52 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "test": "exit 0", "lint": "eslint ./", - "prepublish": "nsp check" + "prepublish": "nsp check", + "doc": "(cd ./doc && make html)" }, "repository": { "type": "git",