Skip to content

Commit

Permalink
docs: Update online and offline docs generation
Browse files Browse the repository at this point in the history
  • Loading branch information
rsenden committed Mar 7, 2023
1 parent c44b535 commit 628b3d5
Show file tree
Hide file tree
Showing 5 changed files with 637 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ jobs:
mkdir -p "${dir}"
unzip artifact/docs-html.zip -d "${dir}"
# Recreate version data files, which may be empty if no versions available
mkdir -p _data/versions
touch _data/versions/release.yml
touch _data/versions/dev.yml
ls -d v*.*.* | sort -rV | while read line; do echo "- '$line'"; done > _data/versions/release.yml
ls -d dev_* | sort | while read line; do echo "- '$line'"; done > _data/versions/dev.yml
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
85 changes: 74 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -232,35 +232,98 @@ task generateManpageAsciiDoc(type: JavaExec) {
description = "Generate AsciiDoc manpage"
classpath(configurations.runtimeClasspath, configurations.annotationProcessor, sourceSets.main.runtimeClasspath)
main 'picocli.codegen.docgen.manpage.ManPageGenerator'
args mainClassName, "--outdir=${project.buildDir}/generated-picocli-docs", "-v"
args mainClassName, "--outdir=${project.buildDir}/generated-docs/src/manpage", "-v"
}

asciidoctor {
dependsOn(generateManpageAsciiDoc)
sourceDir = file("${project.buildDir}/generated-picocli-docs")
outputDir = file("${project.buildDir}/docs")
task copyStaticAsciiDoc(type: Copy) {
into "${project.buildDir}/generated-docs/src"
from("${projectDir}/doc-resources/asciidoc") {
include "*.adoc"
}
}

task prepareAsciiDoc {
dependsOn 'generateManpageAsciiDoc', 'copyStaticAsciiDoc'
}

task asciiDoctorManPage(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
dependsOn(prepareAsciiDoc)
sourceDir = file("${project.buildDir}/generated-docs/src/manpage")
outputDir = file("${project.buildDir}/generated-docs/manpage")
logDocuments = true
outputOptions {
backends = ['manpage']
}
}

task asciiDoctorHtml(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
dependsOn(prepareAsciiDoc)
sourceDir = file("${project.buildDir}/generated-docs/src")
outputDir = file("${project.buildDir}/generated-docs/html5")
logDocuments = true
outputOptions {
backends = ['manpage', 'html5']
backends = ['html5']
}
attributes = [
'toc' : 'left',
'sectanchors' : 'true',
'docinfo' : 'shared',
'docinfodir' : new File("${project.rootDir}/doc-resources/asciidoc/docinfo").absolutePath,
'jekyll' : false,
'bannertitle' : 'FCLI: The Universal Fortify CLI',
'docversion' : "${project.version}"
]
options = [
'template_dirs': [new File("${project.rootDir}/doc-resources/asciidoc/templates").absolutePath]
]
}

task asciidoctorJekyll(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
dependsOn(prepareAsciiDoc)
sourceDir = file("${project.buildDir}/generated-docs/src")
outputDir = file("${project.buildDir}/generated-docs/jekyll")
logDocuments = true
outputOptions {
backends = ['html5']
}
attributes = [
'toc' : 'left',
'sectanchors' : 'true',
'docinfo' : 'shared',
'docinfodir' : new File("${project.rootDir}/doc-resources/asciidoc/docinfo").absolutePath,
'jekyll' : true,
'stylesheet' : false,
'bannertitle' : 'FCLI: The Universal Fortify CLI',
'docversion' : "${project.version}"
]
options = [
'template_dirs': [new File("${project.rootDir}/doc-resources/asciidoc/templates").absolutePath]
]
}

tasks.register('distDocsHtml5', Zip) {
dependsOn 'asciidoctor'
dependsOn 'asciiDoctorHtml'
archiveFileName = "docs-html.zip"
destinationDirectory = layout.buildDirectory.dir('dist')
from layout.buildDirectory.dir("docs/html5")
from layout.buildDirectory.dir("generated-docs/html5")
}

tasks.register('distDocsManPage', Zip) {
dependsOn 'asciidoctor'
dependsOn 'asciiDoctorManPage'
archiveFileName = "docs-manpage.zip"
destinationDirectory = layout.buildDirectory.dir('dist')
from layout.buildDirectory.dir("docs/manpage")
from layout.buildDirectory.dir("generated-docs/manpage")
}

tasks.register('distDocsJekyll', Zip) {
dependsOn 'asciidoctorJekyll'
archiveFileName = "docs-jekyll.zip"
destinationDirectory = layout.buildDirectory.dir('dist')
from layout.buildDirectory.dir("generated-docs/jekyll")
}

task distDocs {
dependsOn 'distDocsHtml5', 'distDocsManPage'
dependsOn 'distDocsHtml5', 'distDocsManPage', 'distDocsJekyll'
}

task dist(type: Copy) {
Expand Down
Loading

0 comments on commit 628b3d5

Please sign in to comment.