Skip to content

Commit 951dd83

Browse files
author
Dave Syer
committed
Add automation for README.md generation at top level
Fixes #35
1 parent 3025853 commit 951dd83

File tree

4 files changed

+80
-18
lines changed

4 files changed

+80
-18
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
102102
<jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version>
103103
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
104+
<maven-resources-plugin.version>3.0.2</maven-resources-plugin.version>
104105
<asciidoctor-maven-plugin.version>2.2.3</asciidoctor-maven-plugin.version>
105106
<maven-assembly-plugin.version>3.7.0</maven-assembly-plugin.version>
106107
<maven-dependency-plugin.version>3.5.0</maven-dependency-plugin.version>

spring-grpc-docs/Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'asciidoctor-reducer'

spring-grpc-docs/README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22

33
## README
44

5-
The top level README is generated from sources in this module.
6-
7-
```
8-
$ cd spring-grpc-docs
9-
$ asciidoctor-reducer src/main/antora/modules/ROOT/pages/README.adoc | downdoc - > ../README.md
10-
```
11-
12-
where [`asciidoctor-reducer`](https://github.com/asciidoctor/asciidoctor-reducer) is a gem (so probably in `~/.gem/ruby/<version>/bin/asciidoctor-reducer`) and [`downdoc`](https://github.com/opendevise/downdoc) is an `npm` module, so `./node_modules/.bin/downdoc`.
5+
The top level README is generated from sources in this module on `mvn package` using [`asciidoctor-reducer`](https://github.com/asciidoctor/asciidoctor-reducer) and [`downdoc`](https://github.com/opendevise/downdoc).
136

147
## Configuration Properties
158
The Spring gRPC configuration properties are automatically documented as follows:

spring-grpc-docs/pom.xml

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
<description>Spring gRPC documentation</description>
1414

1515
<properties>
16-
<exec-maven-plugin.version>3.4.1</exec-maven-plugin.version>
16+
<maven-exec-plugin.version>3.4.1</maven-exec-plugin.version>
17+
<maven-gem-plugin.version>3.0.3</maven-gem-plugin.version>
1718
<configprops.path>${project.basedir}/src/main/antora/modules/ROOT/partials/_configprops.adoc</configprops.path>
1819
<configprops.inclusionPattern>spring.grpc.*</configprops.inclusionPattern>
20+
<jruby.version>9.4.6.0</jruby.version>
1921
</properties>
2022
<!-- Dependencies used to build the config props doc generator -->
2123
<dependencies>
@@ -29,8 +31,21 @@
2931
<artifactId>jackson-databind</artifactId>
3032
<version>${jackson.version}</version>
3133
</dependency>
34+
<dependency>
35+
<groupId>rubygems</groupId>
36+
<artifactId>asciidoctor-reducer</artifactId>
37+
<version>1.0.6</version>
38+
<type>gem</type>
39+
</dependency>
3240
</dependencies>
3341
<build>
42+
<extensions>
43+
<extension>
44+
<groupId>org.jruby.maven</groupId>
45+
<artifactId>mavengem-wagon</artifactId>
46+
<version>2.0.2</version>
47+
</extension>
48+
</extensions>
3449
<plugins>
3550
<plugin>
3651
<groupId>io.spring.maven.antora</groupId>
@@ -55,6 +70,7 @@
5570
<version>${io.spring.maven.antora-version}</version>
5671
<executions>
5772
<execution>
73+
<?m2e ignore?>
5874
<goals>
5975
<goal>antora-component-version</goal>
6076
</goals>
@@ -84,27 +100,76 @@
84100
<plugin>
85101
<groupId>org.codehaus.mojo</groupId>
86102
<artifactId>exec-maven-plugin</artifactId>
87-
<version>${exec-maven-plugin.version}</version>
103+
<version>${maven-exec-plugin.version}</version>
88104
<executions>
89105
<execution>
90106
<id>generate-configprops</id>
91107
<phase>package</phase>
92108
<goals>
93109
<goal>java</goal>
94110
</goals>
111+
<configuration>
112+
<includeProjectDependencies>true</includeProjectDependencies>
113+
<includePluginDependencies>false</includePluginDependencies>
114+
<mainClass>
115+
org.springframework.grpc.internal.ConfigurationPropertiesAsciidocGenerator</mainClass>
116+
<arguments>
117+
<argument>${configprops.path}</argument>
118+
<argument>${configprops.inclusionPattern}</argument>
119+
</arguments>
120+
</configuration>
121+
</execution>
122+
<execution>
123+
<id>generate-readme</id>
124+
<phase>package</phase>
125+
<goals>
126+
<goal>exec</goal>
127+
</goals>
128+
<configuration>
129+
<executable>${basedir}/node_modules/.bin/downdoc</executable>
130+
<arguments>
131+
<argument>${project.build.directory}/README.adoc</argument>
132+
<argument>-o</argument>
133+
<argument>${project.parent.basedir}/README.md</argument>
134+
</arguments>
135+
</configuration>
95136
</execution>
96137
</executions>
138+
</plugin>
139+
<plugin>
140+
<groupId>org.jruby.maven</groupId>
141+
<artifactId>gem-maven-plugin</artifactId>
142+
<version>${maven-gem-plugin.version}</version>
97143
<configuration>
98-
<includeProjectDependencies>true</includeProjectDependencies>
99-
<includePluginDependencies>false</includePluginDependencies>
100-
<mainClass>org.springframework.grpc.internal.ConfigurationPropertiesAsciidocGenerator</mainClass>
101-
<arguments>
102-
<argument>${configprops.path}</argument>
103-
<argument>${configprops.inclusionPattern}</argument>
104-
</arguments>
144+
<jrubyVersion>${jruby.version}</jrubyVersion>
145+
<gemHome>${project.build.directory}/gems</gemHome>
146+
<gemPath>${project.build.directory}/gems</gemPath>
105147
</configuration>
148+
<executions>
149+
<execution>
150+
<?m2e ignore?>
151+
<id>install-gems</id>
152+
<goals>
153+
<goal>initialize</goal>
154+
<goal>exec</goal>
155+
</goals>
156+
<phase>compile</phase>
157+
<configuration>
158+
<execArgs>${project.build.directory}/gems/bin/asciidoctor-reducer -o
159+
${project.build.directory}/README.adoc
160+
${basedir}/src/main/antora/modules/ROOT/pages/README.adoc</execArgs>
161+
</configuration>
162+
</execution>
163+
</executions>
106164
</plugin>
107165
</plugins>
108166
</build>
109167

110-
</project>
168+
<repositories>
169+
<repository>
170+
<id>mavengems</id>
171+
<url>mavengem:https://rubygems.org</url>
172+
</repository>
173+
</repositories>
174+
175+
</project>

0 commit comments

Comments
 (0)