Skip to content

Commit

Permalink
integrate akka-contrib docs into akka-docs build
Browse files Browse the repository at this point in the history
using the awesomized sbt-site plugin!
  • Loading branch information
rkuhn authored and bantonsson committed Oct 2, 2012
1 parent ed7d22d commit cc669c3
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ multiverse.log
.*.swp
akka-docs/_build/
akka-docs/rst_preprocessed/
akka-contrib/rst_preprocessed/
*.pyc
akka-docs/exts/
_akka_cluster/
Expand Down
85 changes: 85 additions & 0 deletions akka-contrib/docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# -*- coding: utf-8 -*-
#
# Akka documentation build configuration file.
#

import sys, os

# -- General configuration -----------------------------------------------------

sys.path.append(os.path.abspath('../../akka-docs/_sphinx/exts'))
extensions = ['sphinx.ext.todo', 'includecode']

templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
exclude_patterns = ['_build', 'pending', 'disabled']

project = u'Akka'
copyright = u'2011, Typesafe Inc'
version = '@version@'
release = '@version@'

pygments_style = 'simple'
highlight_language = 'scala'
add_function_parentheses = False
show_authors = True

# -- Options for HTML output ---------------------------------------------------

html_theme = 'akka'
html_theme_path = ['../../akka-docs/_sphinx/themes']
html_favicon = '../../akka-docs/_sphinx/static/favicon.ico'

html_title = 'Akka Documentation'
html_logo = '../../akka-docs/_sphinx/static/logo.png'
#html_favicon = None

html_static_path = ['../../akka-docs/_sphinx/static']

html_last_updated_fmt = '%b %d, %Y'
#html_sidebars = {}
#html_additional_pages = {}
html_domain_indices = False
html_use_index = False
html_show_sourcelink = False
html_show_sphinx = False
html_show_copyright = True
htmlhelp_basename = 'Akkadoc'
html_use_smartypants = False
html_add_permalinks = ''

html_context = {
'include_analytics': 'online' in tags
}

# -- Options for EPUB output ---------------------------------------------------
epub_author = "Typesafe Inc"
epub_language = "en"
epub_publisher = epub_author
epub_identifier = "http://doc.akka.io/docs/akka/snapshot/"
epub_scheme = "URL"
epub_cover = ("../../akka-docs/_sphinx/static/akka.png", "")

# -- Options for LaTeX output --------------------------------------------------

def setup(app):
from sphinx.util.texescape import tex_replacements
tex_replacements.append((u'⇒', ur'\(\Rightarrow\)'))

latex_paper_size = 'a4'
latex_font_size = '10pt'

latex_documents = [
('index', 'Akka.tex', u' Akka Documentation',
u'Typesafe Inc', 'manual'),
]

latex_elements = {
'classoptions': ',oneside,openany',
'babel': '\\usepackage[english]{babel}',
'fontpkg': '\\PassOptionsToPackage{warn}{textcomp} \\usepackage{times}',
'preamble': '\\definecolor{VerbatimColor}{rgb}{0.935,0.935,0.935}'
}

# latex_logo = '_sphinx/static/akka.png'
12 changes: 6 additions & 6 deletions akka-contrib/docs/reliable-proxy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ communication channel. The benefit is that the network in-between is taken out
of that equation.

When the target actor terminates, the proxy will terminate as well (on the
terms of :ref:`deathwatch-java` / :ref:`deathwath-scala`).
terms of :ref:`deathwatch-java` / :ref:`deathwatch-scala`).

How to use it
-------------
Expand All @@ -69,12 +69,12 @@ Since this implementation does not offer much in the way of configuration,
simply instantiate a proxy wrapping some target reference. From Java it looks
like this:

.. includecode:: ../src/test/java/akka/contrib/pattern/ReliableProxyTest.java#imports
.. includecode:: ../src/test/java/akka/contrib/pattern/ReliableProxyTest.java#demo-proxy
.. includecode:: @contribSrc@/src/test/java/akka/contrib/pattern/ReliableProxyTest.java#import
.. includecode:: @contribSrc@/src/test/java/akka/contrib/pattern/ReliableProxyTest.java#demo-proxy

And from Scala like this:

.. includecode:: ../src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala#demo
.. includecode:: @contribSrc@/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala#demo

Since the :class:`ReliableProxy` actor is an :ref:`fsm-scala`, it also offers
the capability to subscribe to state transitions. If you need to know when all
Expand All @@ -83,10 +83,10 @@ been forwarded to the target), you can subscribe to the FSM notifications and
observe a transition from state :class:`ReliableProxy.Active` to state
:class:`ReliableProxy.Idle`.

.. includecode:: ../src/test/java/akka/contrib/pattern/ReliableProxyTest.java#demo-transition
.. includecode:: @contribSrc@/src/test/java/akka/contrib/pattern/ReliableProxyTest.java#demo-transition

From Scala it would look like so:

.. includecode:: ../src/test/scala/akka/contrib/pattern/ReliableProxyDocSpec.scala#demo-transition
.. includecode:: @contribSrc@/src/test/scala/akka/contrib/pattern/ReliableProxyDocSpec.scala#demo-transition


4 changes: 2 additions & 2 deletions akka-docs/rst/experimental/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ to tell if the module has a maintainer that can take the responsibility
of the module over time. These modules live in the ``akka-contrib`` subproject:

.. toctree::
:maxdepth: 2
:maxdepth: 1

../b/../../../akka-contrib/docs/index.rst
../contrib/index

21 changes: 20 additions & 1 deletion project/AkkaBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,18 @@ object AkkaBuild extends Build {
settings = defaultSettings ++ SphinxSupport.settings ++ sphinxPreprocessing ++ cpsPlugin ++ Seq(
sourceDirectory in Sphinx <<= baseDirectory / "rst",
sphinxPackages in Sphinx <+= baseDirectory { _ / "_sphinx" / "pygments" },
// copy akka-contrib/docs into our rst_preprocess/contrib (and apply substitutions)
preprocess in Sphinx <<= (preprocess in Sphinx,
sourceDirectory in contrib in Sphinx,
target in preprocess in Sphinx,
cacheDirectory,
preprocessExts in Sphinx,
preprocessVars in Sphinx,
streams) map { (orig, src, target, cacheDir, exts, vars, s) =>
val contribSrc = Map("contribSrc" -> "../../../akka-contrib")
simplePreprocess(src, target / "contrib", cacheDir / "sphinx" / "preprocessed-contrib", exts, vars ++ contribSrc, s.log)
orig
},
enableOutput in generatePdf in Sphinx := true,
unmanagedSourceDirectories in Test <<= sourceDirectory in Sphinx apply { _ ** "code" get },
libraryDependencies ++= Dependencies.docs,
Expand All @@ -366,9 +378,16 @@ object AkkaBuild extends Build {
id = "akka-contrib",
base = file("akka-contrib"),
dependencies = Seq(remote, remoteTests % "compile;test->test"),
settings = defaultSettings ++ multiJvmSettings ++ Seq(
settings = defaultSettings ++ multiJvmSettings ++ SphinxSupport.settings ++ sphinxPreprocessing ++ Seq(
libraryDependencies ++= Dependencies.contrib,
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v"),
preprocessVars in Sphinx <<= (preprocessVars in Sphinx) { (old) =>
old ++ Map(
"contribSrc" -> ".."
)
},
sourceDirectory in Sphinx <<= baseDirectory / "docs",
sphinxPackages in Sphinx <+= baseDirectory { _ / ".." / "akka-docs" / "_sphinx" / "pygments" },
description := """|
|This subproject provides a home to modules contributed by external
|developers which may or may not move into the officially supported code
Expand Down

0 comments on commit cc669c3

Please sign in to comment.