Include google analytics in online version of docs. See #1892
This commit is contained in:
parent
6e22fe7ea7
commit
d0e498ca16
5 changed files with 39 additions and 7 deletions
|
|
@ -21,6 +21,23 @@
|
||||||
{% block relbar1 %}{% endblock %}
|
{% block relbar1 %}{% endblock %}
|
||||||
{% block relbar2 %}{% endblock %}
|
{% block relbar2 %}{% endblock %}
|
||||||
|
|
||||||
|
{% block extrahead %}
|
||||||
|
{%- if include_analytics %}
|
||||||
|
<!--Google Analytics-->
|
||||||
|
<script type="text/javascript">
|
||||||
|
var _gaq = _gaq || [];
|
||||||
|
_gaq.push(['_setAccount', 'UA-21117439-1']);
|
||||||
|
_gaq.push(['_setDomainName', 'akka.io']);
|
||||||
|
_gaq.push(['_trackPageview']);
|
||||||
|
(function() {
|
||||||
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||||
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||||
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||||
|
})()
|
||||||
|
</script>
|
||||||
|
{%- endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{%- block akkaheader %}
|
{%- block akkaheader %}
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,10 @@ html_show_copyright = True
|
||||||
htmlhelp_basename = 'Akkadoc'
|
htmlhelp_basename = 'Akkadoc'
|
||||||
html_add_permalinks = ''
|
html_add_permalinks = ''
|
||||||
|
|
||||||
|
html_context = {
|
||||||
|
'include_analytics': 'online' in tags
|
||||||
|
}
|
||||||
|
|
||||||
# -- Options for LaTeX output --------------------------------------------------
|
# -- Options for LaTeX output --------------------------------------------------
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import com.typesafe.schoir.SchoirPlugin.schoirSettings
|
||||||
import com.typesafe.sbtscalariform.ScalariformPlugin
|
import com.typesafe.sbtscalariform.ScalariformPlugin
|
||||||
import com.typesafe.sbtscalariform.ScalariformPlugin.ScalariformKeys
|
import com.typesafe.sbtscalariform.ScalariformPlugin.ScalariformKeys
|
||||||
import java.lang.Boolean.getBoolean
|
import java.lang.Boolean.getBoolean
|
||||||
|
import Sphinx.{ sphinxDocs, sphinxHtml, sphinxLatex, sphinxPdf, sphinxPygments, sphinxTags }
|
||||||
|
|
||||||
object AkkaBuild extends Build {
|
object AkkaBuild extends Build {
|
||||||
System.setProperty("akka.mode", "test") // Is there better place for this?
|
System.setProperty("akka.mode", "test") // Is there better place for this?
|
||||||
|
|
@ -30,7 +31,13 @@ object AkkaBuild extends Build {
|
||||||
parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", "false").toBoolean,
|
parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", "false").toBoolean,
|
||||||
Publish.defaultPublishTo in ThisBuild <<= crossTarget / "repository",
|
Publish.defaultPublishTo in ThisBuild <<= crossTarget / "repository",
|
||||||
Unidoc.unidocExclude := Seq(samples.id, tutorials.id),
|
Unidoc.unidocExclude := Seq(samples.id, tutorials.id),
|
||||||
Dist.distExclude := Seq(actorTests.id, akkaSbtPlugin.id, docs.id)
|
Dist.distExclude := Seq(actorTests.id, akkaSbtPlugin.id, docs.id),
|
||||||
|
// online version of docs
|
||||||
|
sphinxDocs <<= baseDirectory / "akka-docs",
|
||||||
|
sphinxTags in sphinxHtml += "online",
|
||||||
|
sphinxPygments <<= sphinxPygments in LocalProject(docs.id),
|
||||||
|
sphinxLatex <<= sphinxLatex in LocalProject(docs.id),
|
||||||
|
sphinxPdf <<= sphinxPdf in LocalProject(docs.id)
|
||||||
),
|
),
|
||||||
aggregate = Seq(actor, testkit, actorTests, remote, camel, cluster, slf4j, agent, transactor, mailboxes, zeroMQ, kernel, akkaSbtPlugin, actorMigration, samples, tutorials, docs)
|
aggregate = Seq(actor, testkit, actorTests, remote, camel, cluster, slf4j, agent, transactor, mailboxes, zeroMQ, kernel, akkaSbtPlugin, actorMigration, samples, tutorials, docs)
|
||||||
)
|
)
|
||||||
|
|
@ -258,7 +265,7 @@ object AkkaBuild extends Build {
|
||||||
id = "akka-docs",
|
id = "akka-docs",
|
||||||
base = file("akka-docs"),
|
base = file("akka-docs"),
|
||||||
dependencies = Seq(actor, testkit % "test->test", remote, cluster, slf4j, agent, transactor, fileMailbox, zeroMQ, camel),
|
dependencies = Seq(actor, testkit % "test->test", remote, cluster, slf4j, agent, transactor, fileMailbox, zeroMQ, camel),
|
||||||
settings = defaultSettings ++ Seq(
|
settings = defaultSettings ++ Sphinx.settings ++ Seq(
|
||||||
unmanagedSourceDirectories in Test <<= baseDirectory { _ ** "code" get },
|
unmanagedSourceDirectories in Test <<= baseDirectory { _ ** "code" get },
|
||||||
libraryDependencies ++= Dependencies.docs,
|
libraryDependencies ++= Dependencies.docs,
|
||||||
unmanagedSourceDirectories in ScalariformKeys.format in Test <<= unmanagedSourceDirectories in Test
|
unmanagedSourceDirectories in ScalariformKeys.format in Test <<= unmanagedSourceDirectories in Test
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,15 @@ object Dist {
|
||||||
distLibJars <<= (thisProjectRef, buildStructure, distExclude) flatMap aggregated(packageBin.task in Compile),
|
distLibJars <<= (thisProjectRef, buildStructure, distExclude) flatMap aggregated(packageBin.task in Compile),
|
||||||
distSrcJars <<= (thisProjectRef, buildStructure, distExclude) flatMap aggregated(packageSrc.task in Compile),
|
distSrcJars <<= (thisProjectRef, buildStructure, distExclude) flatMap aggregated(packageSrc.task in Compile),
|
||||||
distDocJars <<= (thisProjectRef, buildStructure, distExclude) flatMap aggregated(packageDoc.task in Compile),
|
distDocJars <<= (thisProjectRef, buildStructure, distExclude) flatMap aggregated(packageDoc.task in Compile),
|
||||||
distSources <<= (distDependencies, distLibJars, distSrcJars, distDocJars, Unidoc.unidoc, Sphinx.sphinx) map DistSources,
|
distSources <<= (distDependencies, distLibJars, distSrcJars, distDocJars, Unidoc.unidoc, Sphinx.sphinx in docsProject) map DistSources,
|
||||||
distDirectory <<= crossTarget / "dist",
|
distDirectory <<= crossTarget / "dist",
|
||||||
distUnzipped <<= distDirectory / "unzipped",
|
distUnzipped <<= distDirectory / "unzipped",
|
||||||
distFile <<= (distDirectory, version) { (dir, v) => dir / ("akka-" + v + ".zip") },
|
distFile <<= (distDirectory, version) { (dir, v) => dir / ("akka-" + v + ".zip") },
|
||||||
dist <<= distTask
|
dist <<= distTask
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def docsProject: ProjectReference = LocalProject(AkkaBuild.docs.id)
|
||||||
|
|
||||||
def aggregated[T](task: SettingKey[Task[T]])(projectRef: ProjectRef, structure: Load.BuildStructure, exclude: Seq[String]): Task[Seq[T]] = {
|
def aggregated[T](task: SettingKey[Task[T]])(projectRef: ProjectRef, structure: Load.BuildStructure, exclude: Seq[String]): Task[Seq[T]] = {
|
||||||
val projects = aggregatedProjects(projectRef, structure, exclude)
|
val projects = aggregatedProjects(projectRef, structure, exclude)
|
||||||
projects flatMap { task in LocalProject(_) get structure.data } join
|
projects flatMap { task in LocalProject(_) get structure.data } join
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ object Sphinx {
|
||||||
val sphinx = TaskKey[File]("sphinx", "Build all Sphinx documentation (HTML and PDF combined).")
|
val sphinx = TaskKey[File]("sphinx", "Build all Sphinx documentation (HTML and PDF combined).")
|
||||||
|
|
||||||
lazy val settings = Seq(
|
lazy val settings = Seq(
|
||||||
sphinxDocs <<= baseDirectory / "akka-docs",
|
sphinxDocs <<= baseDirectory,
|
||||||
sphinxTarget <<= crossTarget / "sphinx",
|
sphinxTarget <<= crossTarget / "sphinx",
|
||||||
sphinxPygmentsDir <<= sphinxDocs { _ / "_sphinx" / "pygments" },
|
sphinxPygmentsDir <<= sphinxDocs { _ / "_sphinx" / "pygments" },
|
||||||
sphinxTags in sphinxHtml := Seq.empty,
|
sphinxTags in sphinxHtml := Seq.empty,
|
||||||
|
|
@ -62,7 +62,9 @@ object Sphinx {
|
||||||
val changes = in.modified
|
val changes = in.modified
|
||||||
if (!changes.isEmpty) {
|
if (!changes.isEmpty) {
|
||||||
IO.delete(target)
|
IO.delete(target)
|
||||||
s.log.info("Building Sphinx %s documentation..." format builder)
|
val tagList = if (tags.isEmpty) "" else tags.mkString(" (", ", ", ")")
|
||||||
|
val desc = "%s%s" format (builder, tagList)
|
||||||
|
s.log.info("Building Sphinx %s documentation..." format desc)
|
||||||
changes.foreach(file => s.log.debug("Changed documentation source: " + file))
|
changes.foreach(file => s.log.debug("Changed documentation source: " + file))
|
||||||
val logger = newLogger(s)
|
val logger = newLogger(s)
|
||||||
val tagOptions = tags flatMap (Seq("-t", _))
|
val tagOptions = tags flatMap (Seq("-t", _))
|
||||||
|
|
@ -70,8 +72,8 @@ object Sphinx {
|
||||||
val env = "PYTHONPATH" -> pygments.absolutePath
|
val env = "PYTHONPATH" -> pygments.absolutePath
|
||||||
s.log.debug("Command: " + command.mkString(" "))
|
s.log.debug("Command: " + command.mkString(" "))
|
||||||
val exitCode = Process(command, docs, env) ! logger
|
val exitCode = Process(command, docs, env) ! logger
|
||||||
if (exitCode != 0) sys.error("Failed to build Sphinx %s documentation." format builder)
|
if (exitCode != 0) sys.error("Failed to build Sphinx %s documentation." format desc)
|
||||||
s.log.info("Sphinx %s documentation created: %s" format (builder, target))
|
s.log.info("Sphinx %s documentation created: %s" format (desc, target))
|
||||||
target.descendentsExcept("*", "").get.toSet
|
target.descendentsExcept("*", "").get.toSet
|
||||||
} else Set.empty
|
} else Set.empty
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue