Skip to content

Commit

Permalink
Add demo documentation generation
Browse files Browse the repository at this point in the history
  • Loading branch information
tgianos committed Oct 26, 2016
1 parent 9ef093b commit 17e8f44
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 15 deletions.
38 changes: 27 additions & 11 deletions build.gradle
Expand Up @@ -236,31 +236,47 @@ tasks.coveralls {
}
}

task collectDocumentation(group: "documentation", description: "Copy the documentation from subprojects") {
dependsOn "aggregateJavadocs"
inputs.dir new File(project(":genie-web").buildDir, "asciidoc/html5")
inputs.dir new File(project(":genie-docs").buildDir, "asciidoc/html5")
inputs.dir new File(project(":genie-demo").buildDir, "asciidoc/html5")
outputs.dir new File(project.buildDir, "docs")

doLast {
copy {
from new File(project(":genie-web").buildDir, "asciidoc/html5")
into "${project.buildDir}/docs/rest"
}
copy {
from new File(project(":genie-docs").buildDir, "asciidoc/html5")
into "${project.buildDir}/docs/reference"
}
copy {
from new File(project(":genie-demo").buildDir, "asciidoc/html5")
into "${project.buildDir}/docs/demo"
}
}
}

githubPages {
credentials {
username = System.getenv("GH_TOKEN")
password = ""
}

commitMessage = "Documentation generated for ${version} by Travis Build ${System.env.TRAVIS_BUILD_NUMBER}"
commitMessage = "Documentation generated for ${project.version} by Travis Build ${System.env.TRAVIS_BUILD_NUMBER}"

pages {
from("${project.buildDir}/docs/javadoc") {
into "docs/${project.version}/javadoc"
}
from(new File(project(":genie-web").buildDir, "asciidoc/html5")) {
into "docs/${project.version}/rest"
}
from(new File(project(":genie-docs").buildDir, "asciidoc/html5")) {
into "docs/${project.version}/reference"
}
from "${project.buildDir}/docs/"
into "docs/${project.version}/"
}
}

prepareGhPages {
// This also depends on asciidoctor task for some subprojects but that dependency is reverse mapped in the
// pertinent subproject build file
dependsOn "aggregateJavadocs"
dependsOn tasks.collectDocumentation
}

publishGhPages {
Expand Down
12 changes: 12 additions & 0 deletions genie-demo/build.gradle
@@ -1,3 +1,15 @@
apply plugin: "org.asciidoctor.convert"

project.parent.tasks.collectDocumentation.dependsOn project.tasks.asciidoctor

// This is needed cause some things like attributes for asciidoctor don't serialize project.version properly at runtime
def genieVersion = project.version.toString()

asciidoctor {
inputs.dir new File(project.projectDir, "/src/docs/asciidoc")
attributes "revnumber": genieVersion
}

def dockerDir = new File(project.projectDir, "/src/main/docker")

task demoStart(type: Exec, group: "Demo", description: "Bring up the Genie demo containers") {
Expand Down
9 changes: 9 additions & 0 deletions genie-demo/src/docs/asciidoc/index.adoc
@@ -0,0 +1,9 @@
= Genie Demo Guide
Tom Gianos <NetflixOSS@netflix.com>
v{revnumber}, {localdate}
:description: Reference documentation for Netflix OSS Genie
:keywords: genie, netflix, documentation, big data, cloud, oss, open source software
:toc:

== Something
{project-version}
4 changes: 2 additions & 2 deletions genie-docs/build.gradle
@@ -1,11 +1,11 @@
apply plugin: "org.asciidoctor.convert"

project.parent.tasks.prepareGhPages.dependsOn project.tasks.asciidoctor
project.parent.tasks.collectDocumentation.dependsOn project.tasks.asciidoctor

// This is needed cause some things like attributes for asciidoctor don't serialize project.version properly at runtime
def genieVersion = project.version.toString()

asciidoctor {
inputs.dir new File(project.projectDir, "/src/main/asciidoc")
inputs.dir new File(project.projectDir, "/src/docs/asciidoc")
attributes "revnumber": genieVersion
}
4 changes: 2 additions & 2 deletions genie-web/build.gradle
Expand Up @@ -6,7 +6,7 @@ plugins {

apply plugin: "org.asciidoctor.convert"

project.parent.tasks.prepareGhPages.dependsOn project.tasks.asciidoctor
project.parent.tasks.collectDocumentation.dependsOn project.tasks.asciidoctor

ext {
snippetsDir = file("build/generated-snippets")
Expand Down Expand Up @@ -96,7 +96,7 @@ def genieVersion = project.version.toString()
asciidoctor {
dependsOn test
inputs.dir snippetsDir
inputs.dir new File(project.projectDir, "/src/main/asciidoc")
inputs.dir new File(project.projectDir, "/src/docs/asciidoc")
attributes "snippets": snippetsDir, "revnumber": genieVersion
}

Expand Down

0 comments on commit 17e8f44

Please sign in to comment.