Add Reference Documentation infrastructure

This commit is contained in:
Eric Bottard
2017-08-06 12:14:28 +02:00
parent ff3153c419
commit 3fb368476f
8 changed files with 318 additions and 0 deletions

View File

@@ -28,6 +28,7 @@
<module>spring-shell-jcommander-adapter</module>
<module>spring-shell-shell1-adapter</module>
<module>spring-shell-starter</module>
<module>spring-shell-docs</module>
</modules>
<dependencyManagement>

135
spring-shell-docs/pom.xml Normal file
View File

@@ -0,0 +1,135 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-shell-docs</artifactId>
<name>Spring Shell Documentation</name>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
</parent>
<description>Spring Shell reference documentation</description>
<properties>
<asciidoctor.maven.plugin.version>1.5.5</asciidoctor.maven.plugin.version>
<asciidoctorj.pdf.version>1.5.0-alpha.16</asciidoctorj.pdf.version>
<asciidoctorj.version>1.5.6</asciidoctorj.version>
<jruby.version>1.7.26</jruby.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${asciidoctor.maven.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
<version>${asciidoctorj.pdf.version}</version>
</dependency>
<!-- Comment this section to use the default jruby artifact provided by the plugin -->
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>${jruby.version}</version>
</dependency>
<!-- Comment this section to use the default AsciidoctorJ artifact provided by the plugin -->
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>${asciidoctorj.version}</version>
</dependency>
</dependencies>
<configuration>
<sourceDocumentName>index.adoc</sourceDocumentName>
<doctype>book</doctype>
<attributes>
<allow-uri-read>true</allow-uri-read>
<attribute-missing>warn</attribute-missing>
<project-version>${project.version}</project-version>
<project-artifactId>${project.artifactId}</project-artifactId>
</attributes>
</configuration>
<executions>
<execution>
<id>generate-html5</id>
<phase>prepare-package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>html5</backend>
<attributes>
<toc2 />
<docinfo>shared-head</docinfo>
<source-highlighter>prettify</source-highlighter>
</attributes>
</configuration>
</execution>
<execution>
<id>generate-pdf</id>
<phase>prepare-package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>pdf</backend>
<sourceHighlighter>rouge</sourceHighlighter>
<attributes>
<toc/>
<pagenums/>
</attributes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>zip-docs</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/docs-zip.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>attach-zip</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${project.version}.zip</file>
<type>zip;zip.type=docs;zip.deployed=false</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,24 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>docs</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}/generated-docs</directory>
<outputDirectory>reference/htmlsingle</outputDirectory>
<includes>
<include>index.html</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/generated-docs</directory>
<outputDirectory>reference/pdf</outputDirectory>
<includes>
<include>index.pdf</include>
</includes>
</fileSet>
</fileSets>
</assembly>

View File

@@ -0,0 +1,74 @@
<!-- Generate a nice TOC -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tocify/1.9.0/javascripts/jquery.tocify.min.js"></script>
<!-- We do not need the tocify CSS because the asciidoc CSS already provides most of what we neeed -->
<style>
.tocify-header {
font-style: italic;
}
.tocify-subheader {
font-style: normal;
}
.tocify ul {
margin: 0;
}
.tocify-focus {
color: #7a2518;
background-color: rgba(0, 0, 0, 0.1);
}
.tocify-focus > a {
color: #7a2518;
}
</style>
<script type="text/javascript">
$(function () {
// Add a new container for the tocify toc into the existing toc so we can re-use its
// styling
$("#toc").append("<div id='generated-toc'></div>");
$("#generated-toc").tocify({
extendPage: false,
context: "#content",
highlightOnScroll: false,
hideEffect: "slideUp",
// Use the IDs that asciidoc already provides so that TOC links and intra-document
// links are the same. Anything else might confuse users when they create bookmarks.
hashGenerator: function(text, element) {
return $(element).attr("id");
},
// Smooth scrolling doesn't work properly if we use the asciidoc IDs
smoothScroll: false,
// Set to 'none' to use the tocify classes
theme: "none",
// Handle book (may contain h1) and article (only h2 deeper)
selectors: $( "#content" ).has( "h1" ).size() > 0 ? "h1,h2,h3,h4,h5" : "h2,h3,h4,h5",
ignoreSelector: ".discrete"
});
// Switch between static asciidoc toc and dynamic tocify toc based on browser size
// This is set to match the media selectors in the asciidoc CSS
// Without this, we keep the dynamic toc even if it is moved from the side to preamble
// position which will cause odd scrolling behavior
var handleTocOnResize = function() {
if ($(document).width() < 768) {
$("#generated-toc").hide();
$(".sectlevel0").show();
$(".sectlevel1").show();
}
else {
$("#generated-toc").show();
$(".sectlevel0").hide();
$(".sectlevel1").hide();
}
}
$(window).resize(handleTocOnResize);
handleTocOnResize();
});
</script>

View File

@@ -0,0 +1,12 @@
== Extending Spring Shell
=== Support for Spring Shell 1 and JCommander
=== Discovering Methods that Can Act as Commands
=== Resolving Parameter Values
==== Supporting kbd:[TAB] Completion

View File

@@ -0,0 +1,23 @@
= Spring Shell Reference Documentation
Eric Bottard;
:doctype: book
:hide-uri-scheme:
:icons: font
:experimental: // For kbd: macro
Version {project-version}
(C) 2017 Pivotal Software, Inc.
_Copies of this document may be made for your own use and for distribution to
others, provided that you do not charge any fee for such copies and further
provided that each copy contains this Copyright Notice, whether distributed in
print or electronically._
// ======================================================================================
include::what-is-spring-shell.adoc[]
include::using-spring-shell.adoc[]
include::extending-spring-shell.adoc[]

View File

@@ -0,0 +1,47 @@
== Using Spring Shell
=== Getting started
==== Let's Write a Simple Boot App
==== Adding a Dependency on Spring Shell
==== Your first command
==== Let's Give It a Ride!
=== Writing your own Commands
`@ShellComponent`, `@ShellMethod`, etc.
=== Invoking your commands
==== By Name _vs._ Positional Parameters
==== Quotes Handling
==== Interacting with the Shell
Line Continuation, TAB Completion, Search, etc.
=== Built-In Commands
* clear
* help
* exit
* stacktrace
* script
=== Customizing the Shell
==== Overriding or Disabling Built-In Commands
==== ResultHandlers
==== PromptProvider
==== Customizing Command Line Options Behavior
//==== Overriding the JLine Parser
//=== Using Without Spring Boot

View File

@@ -0,0 +1,2 @@
== What is Spring Shell?