Operator docs structure
This commit is contained in:
parent
ae61d2785d
commit
fff992aa3b
8 changed files with 53 additions and 24 deletions
|
@ -65,7 +65,7 @@
|
|||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirectory>${basedir}/target/generated-guides/server</sourceDirectory>
|
||||
<sourceDirectory>${basedir}/target/generated-guides/*</sourceDirectory>
|
||||
<sourceDocumentName>index.adoc</sourceDocumentName>
|
||||
<backend>html5</backend>
|
||||
<sourceHighlighter>coderay</sourceHighlighter>
|
||||
|
|
10
docs/guides/src/main/operator/index.adoc
Normal file
10
docs/guides/src/main/operator/index.adoc
Normal file
|
@ -0,0 +1,10 @@
|
|||
<#list ctx.guides as guide>
|
||||
:links_server_${guide.id}_name: ${guide.title}
|
||||
:links_server_${guide.id}_url: #${guide.id}
|
||||
</#list>
|
||||
|
||||
= Keycloak Operator guide
|
||||
|
||||
<#list ctx.guides as guide>
|
||||
include::${guide.template}[leveloffset=+1]
|
||||
</#list>
|
18
docs/guides/src/main/operator/installation.adoc
Normal file
18
docs/guides/src/main/operator/installation.adoc
Normal file
|
@ -0,0 +1,18 @@
|
|||
<#import "/templates/guide.adoc" as tmpl>
|
||||
<#import "/templates/kc.adoc" as kc>
|
||||
<#import "/templates/options.adoc" as opts>
|
||||
<#import "/templates/links.adoc" as links>
|
||||
|
||||
<@tmpl.guide
|
||||
title="Keycloak Operator Installation"
|
||||
summary="How to install the Keycloak Operator on Kubernetes">
|
||||
|
||||
TODO: https://github.com/keycloak/keycloak/issues/10786
|
||||
|
||||
== Keycloak Operator Installation
|
||||
|
||||
=== OpenShift Installation
|
||||
|
||||
=== Vanilla Kubernetes Installation
|
||||
|
||||
</@tmpl.guide>
|
1
docs/guides/src/main/operator/pinned-guides
Normal file
1
docs/guides/src/main/operator/pinned-guides
Normal file
|
@ -0,0 +1 @@
|
|||
installation
|
|
@ -15,7 +15,7 @@ public class DocsBuildDebugUtil {
|
|||
File targetDir = usrDir.toPath().resolve("target/generated-guides-tests").toFile();
|
||||
targetDir.mkdirs();
|
||||
GuideBuilder builder = new GuideBuilder(srcDir, targetDir, null);
|
||||
builder.server();
|
||||
builder.build();
|
||||
System.out.println("Guides generated to: " + targetDir.getAbsolutePath().toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,11 +25,10 @@ public class Context {
|
|||
this.guides = new LinkedList<>();
|
||||
|
||||
GuideParser parser = new GuideParser();
|
||||
File serverDir = new File(srcDir, "server");
|
||||
|
||||
Map<String, Integer> guidePriorities = loadPinnedGuides(new File(serverDir, "pinned-guides"));
|
||||
Map<String, Integer> guidePriorities = loadPinnedGuides(new File(srcDir, "pinned-guides"));
|
||||
|
||||
for (File f : serverDir.listFiles((dir, f) -> f.endsWith(".adoc") && !f.equals("index.adoc"))) {
|
||||
for (File f : srcDir.listFiles((dir, f) -> f.endsWith(".adoc") && !f.equals("index.adoc"))) {
|
||||
Guide guide = parser.parse(f);
|
||||
|
||||
if (guidePriorities != null) {
|
||||
|
|
|
@ -23,19 +23,18 @@ public class GuideBuilder {
|
|||
Map<String, Object> globalAttributes = new HashMap<>();
|
||||
globalAttributes.put("ctx", new Context(srcDir));
|
||||
|
||||
this.freeMarker = new FreeMarker(srcDir, targetDir, globalAttributes);
|
||||
this.freeMarker = new FreeMarker(srcDir.getParentFile(), targetDir.getParentFile(), globalAttributes);
|
||||
}
|
||||
|
||||
public void server() throws TemplateException, IOException {
|
||||
File serverGuidesDir = new File(srcDir, "server");
|
||||
if (!serverGuidesDir.isDirectory()) {
|
||||
serverGuidesDir.mkdir();
|
||||
public void build() throws TemplateException, IOException {
|
||||
if (!srcDir.isDirectory()) {
|
||||
srcDir.mkdir();
|
||||
}
|
||||
|
||||
for (String t : serverGuidesDir.list((dir, name) -> name.endsWith(".adoc"))) {
|
||||
freeMarker.template("server/" + t);
|
||||
for (String t : srcDir.list((dir, name) -> name.endsWith(".adoc"))) {
|
||||
freeMarker.template(srcDir.getName() + "/" + t);
|
||||
if (log != null) {
|
||||
log.info("Templated: server/" + t);
|
||||
log.info("Templated: " + srcDir.getName() + "/" + t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.keycloak.guides.maven;
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugin.logging.Log;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
|
@ -23,17 +22,20 @@ public class GuideMojo extends AbstractMojo {
|
|||
public void execute() throws MojoFailureException {
|
||||
try {
|
||||
Log log = getLog();
|
||||
File srcDir = new File(sourceDir).getParentFile();
|
||||
File targetDir = new File(this.targetDir, "generated-guides");
|
||||
if (!targetDir.isDirectory()) {
|
||||
targetDir.mkdirs();
|
||||
File topDir = new File(sourceDir).getParentFile();
|
||||
|
||||
for (File srcDir: topDir.listFiles(d -> d.isDirectory() && !d.getName().equals("templates"))) {
|
||||
File targetDir = new File(new File(this.targetDir, "generated-guides"), srcDir.getName());
|
||||
if (!targetDir.isDirectory()) {
|
||||
targetDir.mkdirs();
|
||||
}
|
||||
|
||||
log.info("Guide dir: " + srcDir.getAbsolutePath());
|
||||
log.info("Target dir: " + targetDir.getAbsolutePath());
|
||||
|
||||
GuideBuilder g = new GuideBuilder(srcDir, targetDir, log);
|
||||
g.build();
|
||||
}
|
||||
|
||||
log.info("Guide dir: " + srcDir.getAbsolutePath());
|
||||
log.info("Target dir: " + targetDir.getAbsolutePath());
|
||||
|
||||
GuideBuilder g = new GuideBuilder(srcDir, targetDir, log);
|
||||
g.server();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new MojoFailureException("Failed to generated asciidoc files", e);
|
||||
|
|
Loading…
Reference in a new issue