automatically reference right scalaVersion in RST
using epilog_rst configuration variable in sphinx, which reads akka-docs/epilog_rst, which is written in sphinx-scala-version task by SBT, which is referenced by the other docs tasks as a dependency
This commit is contained in:
parent
b9e91d69d7
commit
d41160f4bf
7 changed files with 25 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -49,6 +49,7 @@ multiverse.log
|
|||
.eprj
|
||||
.*.swp
|
||||
akka-docs/_build/
|
||||
akka-docs/epilog_rst
|
||||
*.pyc
|
||||
akka-docs/exts/
|
||||
_akka_cluster/
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ highlight_language = 'scala'
|
|||
add_function_parentheses = False
|
||||
show_authors = True
|
||||
|
||||
f = open('epilog_rst', 'U')
|
||||
rst_epilog = "\n" + f.read()
|
||||
f.close()
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
|
||||
html_theme = 'akka'
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ You can add it as a plugin by adding the following to your project/plugins.sbt::
|
|||
|
||||
You can then add multi-JVM testing to ``project/Build.scala`` by including the ``MultiJvm``
|
||||
settings and config. For example, here is how the akka-remote project adds
|
||||
multi-JVM testing::
|
||||
multi-JVM testing:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
import sbt._
|
||||
import Keys._
|
||||
|
|
@ -47,7 +49,7 @@ multi-JVM testing::
|
|||
lazy val buildSettings = Defaults.defaultSettings ++ Seq(
|
||||
organization := "com.typesafe.akka",
|
||||
version := "2.1-SNAPSHOT",
|
||||
scalaVersion := "2.10.0-M6",
|
||||
scalaVersion := "|scalaVersion|",
|
||||
crossPaths := false
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -140,9 +140,9 @@ when you are uncertain of what configuration is used.
|
|||
If in doubt, you can also easily and nicely inspect configuration objects
|
||||
before or after using them to construct an actor system:
|
||||
|
||||
.. code-block:: scala
|
||||
.. parsed-literal::
|
||||
|
||||
Welcome to Scala version 2.10.0-M6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27).
|
||||
Welcome to Scala version |scalaVersion| (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27).
|
||||
Type in expressions to have them evaluated.
|
||||
Type :help for more information.
|
||||
|
||||
|
|
|
|||
|
|
@ -120,13 +120,15 @@ Summary of the essential parts for using Akka with SBT:
|
|||
|
||||
SBT installation instructions on `https://github.com/harrah/xsbt/wiki/Setup <https://github.com/harrah/xsbt/wiki/Setup>`_
|
||||
|
||||
``build.sbt`` file::
|
||||
``build.sbt`` file:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
name := "My Project"
|
||||
|
||||
version := "1.0"
|
||||
|
||||
scalaVersion := "2.10.0-M6"
|
||||
scalaVersion := "|scalaVersion|"
|
||||
|
||||
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ After extracting data from a ``ByteIterator``, the remaining content can also be
|
|||
.. includecode:: code/akka/docs/io/BinaryCoding.scala
|
||||
:include: rest-to-seq
|
||||
|
||||
with no copying from bytes to rest involved. In general, conversions from ByteString to ByteIterator and vice versa are O(1) for non-chunked ``ByteString``s and (at worst) O(nChunks) for chunked ByteStrings.
|
||||
with no copying from bytes to rest involved. In general, conversions from ByteString to ByteIterator and vice versa are O(1) for non-chunked ``ByteString`` and (at worst) O(nChunks) for chunked ByteStrings.
|
||||
|
||||
|
||||
Encoding of data also is very natural, using ``ByteStringBuilder``
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import java.io.File
|
|||
object Sphinx {
|
||||
val sphinxDocs = SettingKey[File]("sphinx-docs")
|
||||
val sphinxTarget = SettingKey[File]("sphinx-target")
|
||||
val sphinxScalaVersion = TaskKey[String]("sphinx-scala-version")
|
||||
val sphinxPygmentsDir = SettingKey[File]("sphinx-pygments-dir")
|
||||
val sphinxTags = SettingKey[Seq[String]]("sphinx-tags")
|
||||
val sphinxPygments = TaskKey[File]("sphinx-pygments", "Sphinx: install pygments styles")
|
||||
|
|
@ -22,6 +23,7 @@ object Sphinx {
|
|||
lazy val settings = Seq(
|
||||
sphinxDocs <<= baseDirectory,
|
||||
sphinxTarget <<= crossTarget / "sphinx",
|
||||
sphinxScalaVersion <<= scalaVersionTask,
|
||||
sphinxPygmentsDir <<= sphinxDocs { _ / "_sphinx" / "pygments" },
|
||||
sphinxTags in sphinxHtml := Seq.empty,
|
||||
sphinxTags in sphinxLatex := Seq.empty,
|
||||
|
|
@ -32,6 +34,12 @@ object Sphinx {
|
|||
sphinx <<= sphinxTask
|
||||
)
|
||||
|
||||
def scalaVersionTask = (scalaVersion, streams) map { (v, s) =>
|
||||
s.log.info("writing version file")
|
||||
IO.write(file("akka-docs/epilog_rst"), ".. |scalaVersion| replace:: " + v + "\n")
|
||||
v
|
||||
}
|
||||
|
||||
def pygmentsTask = (sphinxDocs, sphinxPygmentsDir, sphinxTarget, streams) map {
|
||||
(cwd, pygments, baseTarget, s) => {
|
||||
val target = baseTarget / "site-packages"
|
||||
|
|
@ -50,7 +58,7 @@ object Sphinx {
|
|||
}
|
||||
target
|
||||
}
|
||||
}
|
||||
} dependsOn sphinxScalaVersion
|
||||
|
||||
def buildTask(builder: String, tagsKey: SettingKey[Seq[String]]) = {
|
||||
(cacheDirectory, sphinxDocs, sphinxTarget, sphinxPygments, tagsKey, streams) map {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue