Remove Asciidoctor from the build in favor of Antora
This commit is contained in:
@@ -1,87 +0,0 @@
|
||||
package io.spring.gradle.convention;
|
||||
|
||||
import io.spring.gradle.TestKit;
|
||||
import org.codehaus.groovy.runtime.ResourceGroovyMethods;
|
||||
import org.gradle.testkit.runner.BuildResult;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.gradle.testkit.runner.TaskOutcome.FAILED;
|
||||
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS;
|
||||
|
||||
public class DocsPluginITest {
|
||||
private TestKit testKit;
|
||||
|
||||
@BeforeEach
|
||||
void setup(@TempDir Path tempDir) {
|
||||
this.testKit = new TestKit(tempDir.toFile());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void buildTriggersDocs() throws Exception {
|
||||
BuildResult result = testKit.withProjectResource("samples/docs/simple/")
|
||||
.withArguments("build")
|
||||
.build();
|
||||
assertThat(result.task(":build").getOutcome()).isEqualTo(SUCCESS);
|
||||
assertThat(result.task(":docs").getOutcome()).isEqualTo(SUCCESS);
|
||||
assertThat(result.task(":docsZip").getOutcome()).isEqualTo(SUCCESS);
|
||||
File zip = new File(testKit.getRootDir(), "build/distributions/simple-1.0.0.BUILD-SNAPSHOT-docs.zip");
|
||||
try (ZipFile file = new ZipFile(zip)) {
|
||||
List<? extends ZipEntry> entries = Collections.list(file.entries());
|
||||
assertThat(entries)
|
||||
.extracting(ZipEntry::getName)
|
||||
.contains("docs/reference/html5/index.html")
|
||||
.contains("docs/reference/pdf/simple-reference.pdf");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asciidocCopiesImages() throws Exception {
|
||||
BuildResult result = testKit.withProjectResource("samples/docs/simple/").withArguments("asciidoctor").build();
|
||||
assertThat(result.task(":asciidoctor").getOutcome()).isEqualTo(SUCCESS);
|
||||
assertThat(new File(testKit.getRootDir(), "build/docs/asciidoc/images")).exists();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asciidocDocInfoFromResourcesUsed() throws Exception {
|
||||
BuildResult result = this.testKit.withProjectResource("samples/docs/simple/")
|
||||
.withArguments("asciidoctor")
|
||||
.build();
|
||||
assertThat(result.task(":asciidoctor").getOutcome()).isEqualTo(SUCCESS);
|
||||
assertThat(ResourceGroovyMethods.getText(new File(testKit.getRootDir(), "build/docs/asciidoc/index.html")))
|
||||
.contains("<script type=\"text/javascript\" src=\"js/tocbot/tocbot.min.js\"></script>");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingAttributeFails() throws Exception {
|
||||
BuildResult result = this.testKit.withProjectResource("samples/docs/missing-attribute/")
|
||||
.withArguments(":asciidoctor")
|
||||
.buildAndFail();
|
||||
assertThat(result.task(":asciidoctor").getOutcome()).isEqualTo(FAILED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingInclude() throws Exception {
|
||||
BuildResult result = this.testKit.withProjectResource("samples/docs/missing-include/")
|
||||
.withArguments(":asciidoctor")
|
||||
.buildAndFail();
|
||||
assertThat(result.task(":asciidoctor").getOutcome()).isEqualTo(FAILED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingCrossReference() throws Exception {
|
||||
BuildResult result = this.testKit.withProjectResource("samples/docs/missing-cross-reference/")
|
||||
.withArguments(":asciidoctor")
|
||||
.buildAndFail();
|
||||
assertThat(result.task(":asciidoctor").getOutcome()).isEqualTo(FAILED);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
plugins {
|
||||
id 'io.spring.convention.docs'
|
||||
id 'java'
|
||||
}
|
||||
|
||||
version = '1.0.0.BUILD-SNAPSHOT'
|
||||
@@ -1 +0,0 @@
|
||||
rootProject.name = 'simple'
|
||||
@@ -1,3 +0,0 @@
|
||||
= Example Manual
|
||||
|
||||
This will fail due to {missing} attribute
|
||||
@@ -1,6 +0,0 @@
|
||||
plugins {
|
||||
id 'io.spring.convention.docs'
|
||||
id 'java'
|
||||
}
|
||||
|
||||
version = '1.0.0.BUILD-SNAPSHOT'
|
||||
@@ -1 +0,0 @@
|
||||
rootProject.name = 'missing-include'
|
||||
@@ -1,3 +0,0 @@
|
||||
= Example Manual
|
||||
|
||||
This will fail due to <<missing>> cross reference
|
||||
@@ -1,6 +0,0 @@
|
||||
plugins {
|
||||
id 'io.spring.convention.docs'
|
||||
id 'java'
|
||||
}
|
||||
|
||||
version = '1.0.0.BUILD-SNAPSHOT'
|
||||
@@ -1 +0,0 @@
|
||||
rootProject.name = 'missing-include'
|
||||
@@ -1,5 +0,0 @@
|
||||
= Example Manual
|
||||
|
||||
This will fail due to missing include
|
||||
|
||||
include::missing.adoc[]
|
||||
@@ -1,13 +0,0 @@
|
||||
plugins {
|
||||
id 'io.spring.convention.docs'
|
||||
id 'java'
|
||||
}
|
||||
|
||||
version = '1.0.0.BUILD-SNAPSHOT'
|
||||
|
||||
asciidoctorj {
|
||||
attributes \
|
||||
'build-gradle': project.buildFile,
|
||||
'sourcedir': project.sourceSets.main.java.srcDirs[0],
|
||||
'endpoint-url': 'https://example.org'
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
rootProject.name = 'simple'
|
||||
@@ -1 +0,0 @@
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.js"></script>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 120 KiB |
@@ -1,60 +0,0 @@
|
||||
= Example Manual
|
||||
Doc Writer <doc.writer@example.org>
|
||||
2014-09-09
|
||||
:example-caption!:
|
||||
ifndef::imagesdir[:imagesdir: images]
|
||||
ifndef::sourcedir[:sourcedir: ../java]
|
||||
|
||||
This is a user manual for an example project.
|
||||
|
||||
== Introduction
|
||||
|
||||
This project does something.
|
||||
We just haven't decided what that is yet.
|
||||
|
||||
== Source Code
|
||||
|
||||
[source,java]
|
||||
.Java code from project
|
||||
----
|
||||
include::{sourcedir}/example/StringUtils.java[tags=contains,indent=0]
|
||||
----
|
||||
|
||||
This page was built by the following command:
|
||||
|
||||
$ ./gradlew asciidoctor
|
||||
|
||||
== Images
|
||||
|
||||
[.thumb]
|
||||
image::sunset.jpg[scaledwidth=75%]
|
||||
|
||||
== Attributes
|
||||
|
||||
.Built-in
|
||||
asciidoctor-version:: {asciidoctor-version}
|
||||
safe-mode-name:: {safe-mode-name}
|
||||
docdir:: {docdir}
|
||||
docfile:: {docfile}
|
||||
imagesdir:: {imagesdir}
|
||||
revnumber:: {revnumber}
|
||||
|
||||
.Custom
|
||||
sourcedir:: {sourcedir}
|
||||
endpoint-url:: {endpoint-url}
|
||||
|
||||
== Includes
|
||||
|
||||
.include::subdir/_b.adoc[]
|
||||
====
|
||||
include::subdir/_b.adoc[]
|
||||
====
|
||||
|
||||
WARNING: Includes can be tricky!
|
||||
|
||||
== build.gradle
|
||||
|
||||
[source,groovy]
|
||||
----
|
||||
include::{build-gradle}[]
|
||||
----
|
||||
@@ -1,7 +0,0 @@
|
||||
content from _src/docs/asciidoc/subdir/_b.adoc_.
|
||||
|
||||
.include::_c.adoc[]
|
||||
[example]
|
||||
--
|
||||
include::_c.adoc[]
|
||||
--
|
||||
@@ -1 +0,0 @@
|
||||
content from _src/docs/asciidoc/subdir/c.adoc_.
|
||||
@@ -1,9 +0,0 @@
|
||||
package example;
|
||||
|
||||
public class StringUtils {
|
||||
// tag::contains[]
|
||||
public boolean contains(String haystack, String needle) {
|
||||
return haystack.contains(needle);
|
||||
}
|
||||
// end::contains[]
|
||||
}
|
||||
@@ -2,10 +2,3 @@ apply plugin: 'java'
|
||||
apply plugin: 'io.spring.convention.docs'
|
||||
|
||||
version = "1.0.0.BUILD-SNAPSHOT"
|
||||
|
||||
asciidoctorj {
|
||||
attributes \
|
||||
'build-gradle': project.buildFile,
|
||||
'sourcedir': project.sourceSets.main.java.srcDirs[0],
|
||||
'endpoint-url': 'https://example.org'
|
||||
}
|
||||
Reference in New Issue
Block a user