Multi pages (#139)

* WIP

* single / multi and pdf added

* Added git info to docs

* docs urls, links set from props

* Fixed extensions

* Added readme

* index.html is a normal page

* Fixed invalid reference to spring-cloud raw github links

* Added project root attribute

* Changes following review
This commit is contained in:
Marcin Grzejszczak
2019-07-29 14:49:55 +02:00
committed by GitHub
7 changed files with 272 additions and 186 deletions

View File

@@ -57,30 +57,35 @@ approach of generating documentation just add these plugins to your `docs` modul
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId> <1>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId> <1>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <2>
<artifactId>maven-dependency-plugin</artifactId> <2>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <3>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId> <3>
<artifactId>asciidoctor-maven-plugin</artifactId> <4>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <4>
<artifactId>maven-antrun-plugin</artifactId> <5>
</plugin>
</plugins>
</build>
</profile>
</profiles>
----
<1> This plugin downloads the resources of the `spring-cloud-build-docs` module
<2> This plugin unpacks the resources of the `spring-cloud-build-docs` module
<3> This plugin is required to parse the Asciidoctor documentation
<4> This plugin is required to copy resources into proper final destinations and to generate main README.adoc and to assert that no files use unresolved links
<2> This plugin downloads sets up all the git information of the project
<2> This plugin downloads the resources of the `spring-cloud-build-docs` module
<3> This plugin unpacks the resources of the `spring-cloud-build-docs` module
<4> This plugin is required to parse the Asciidoctor documentation
<5> This plugin is required to copy resources into proper final destinations and to generate main README.adoc and to assert that no files use unresolved links
IMPORTANT: The order of plugin declaration is important!

View File

@@ -121,14 +121,6 @@ function retrieve_doc_properties() {
echo "Will not extract any properties for release train"
return
fi
echo "Extracting doc properties"
MAIN_ADOC_VALUE=$("${MAVEN_EXEC}" -q \
-Dexec.executable="echo" \
-Dexec.args='${docs.main}' \
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
-P docs \
-pl docs | tail -1 )
echo "Extracted 'main.adoc' from Maven build [${MAIN_ADOC_VALUE}]"
WHITELIST_PROPERTY=${WHITELIST_PROPERTY:-"docs.whitelisted.branches"}
@@ -226,15 +218,8 @@ function copy_docs_for_current_version() {
echo "The file [${file}] shouldn't be ignored"
# Not ignored...
# We want users to access 1.0.0.RELEASE/ instead of 1.0.0.RELEASE/spring-cloud.sleuth.html
if [[ "${file}" == "${MAIN_ADOC_VALUE}.html" ]] ; then
# We don't want to copy the spring-cloud-sleuth.html
# we want it to be converted to index.html
cp -rf "${f}" "${ROOT_FOLDER}/${CURRENT_BRANCH}/index.html"
"${GIT_BIN}" add -A "${ROOT_FOLDER}/${CURRENT_BRANCH}/index.html"
else
cp -rf "${f}" "${ROOT_FOLDER}/${CURRENT_BRANCH}"
cp -rf "${f}" "${ROOT_FOLDER}/${CURRENT_BRANCH}"
"${GIT_BIN}" add -A "${ROOT_FOLDER}/${CURRENT_BRANCH}/${file}" || echo "Failed to add the file [${file}]"
fi
fi
done
COMMIT_CHANGES="yes"
@@ -268,14 +253,7 @@ function copy_docs_for_branch() {
echo "Copying file [${file}] to destination [${destination}]"
if ! "${GIT_BIN}" ls-files -i -o --exclude-standard --directory | grep -q ^"${file}"$; then
# Not ignored...
# We want users to access 1.0.0.RELEASE/ instead of 1.0.0.RELEASE/spring-cloud.sleuth.html
if [[ ("${file}" == "${MAIN_ADOC_VALUE}.html") || ("${file}" == "${REPO_NAME}.html") ]] ; then
# We don't want to copy the spring-cloud-sleuth.html
# we want it to be converted to index.html
cp -rf "${f}" "${destination}"/index.html
else
cp -rf "${f}" "${destination}"
fi
cp -rf "${f}" "${destination}"
"${GIT_BIN}" add -A "${destination}"
fi
}