Automate docs build with shared parent pom

This commit is contained in:
Dave Syer
2014-10-06 11:22:21 +01:00
parent cee8e0e45e
commit fc2d5d8746
8 changed files with 159 additions and 17 deletions

13
.travis.yml Normal file
View File

@@ -0,0 +1,13 @@
language: java
before_install: git config user.name "$GIT_NAME" && git config user.email "$GIT_EMAIL"
&& git config credential.helper "store --file=.git/credentials" && echo "https://$GH_TOKEN:@github.com"
> .git/credentials
install:
- mvn install -P docs -q -U -DskipTests=true -Dmaven.test.redirectTestOutputToFile=true
- ./src/main/asciidoc/ghpages.sh
script: mvn --settings .settings.xml deploy -nsu -Dmaven.test.redirectTestOutputToFile=true
env:
global:
- GIT_NAME="Dave Syer"
- GIT_EMAIL=dsyer@pivotal.io
- secure: KKxSrW1qR2iFanuCb7QLaeMqEkb3+7hRpVUlGHOvCPTs3IShNKkYx8aHudiORqMxB+v7qtxxP/ca65hBlCK3fIilg7LholaDnGcTeQm0bhODP67mQ3Pby3XDQzKCwUdAn9U9OPK2Nw9xFVUMisLBAr3riegcN2w+FmkylW8+ffY=

15
README.adoc Normal file
View File

@@ -0,0 +1,15 @@
// Do not edit this file (e.g. go instead to src/main/asciidoc)
Spring Cloud Starters are curated sets of dependencies focused on a particular type of workload. Including a starter on your classpath is really just a shorthand for including its dependencies, but it makes it easier to organize your code and easier to remember what the depdnencies are for. (See also http://github.com/spring-projects/spring-boot/tree/master/spring-boot-starters[Spring Boot starter projects].) Starters provided include:
* spring-cloud-starter
* spring-cloud-starter-bus-amqp
* spring-cloud-starter-cloudfoundry
* spring-cloud-starter-eureka
* spring-cloud-starter-eureka-server
* spring-cloud-starter-hystrix
* spring-cloud-starter-hystrix-dashboard
* spring-cloud-starter-turbine
* spring-cloud-starter-zuul

56
pom.xml
View File

@@ -1,26 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-parent</artifactId>
<version>1.1.5.RELEASE</version>
<relativePath/>
</parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starters</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Spring Cloud Starters</name>
<description>Spring Cloud Starters</description>
<url>http://projects.spring.io/spring-boot/</url>
<organization>
<name>Pivotal Software, Inc.</name>
<url>http://www.spring.io</url>
</organization>
<properties>
<main.basedir>${basedir}/..</main.basedir>
</properties>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<relativePath/>
</parent>
<modules>
<module>spring-cloud-starter</module>
<module>spring-cloud-starter-bus-amqp</module>
@@ -29,10 +22,11 @@
<module>spring-cloud-starter-eureka-server</module>
<module>spring-cloud-starter-hystrix</module>
<module>spring-cloud-starter-hystrix-dashboard</module>
<module>spring-cloud-starter-security</module>
<module>spring-cloud-starter-turbine</module>
<module>spring-cloud-starter-zuul</module>
<module>spring-cloud-starter-security</module>
<module>spring-cloud-starter-turbine</module>
<module>spring-cloud-starter-zuul</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
@@ -121,6 +115,7 @@
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
@@ -142,6 +137,7 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -169,4 +165,30 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docs</id>
<build>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<inherited>false</inherited>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<inherited>false</inherited>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<inherited>false</inherited>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -0,0 +1,3 @@
include::intro.adoc[]

View File

@@ -0,0 +1,11 @@
Spring Cloud Starters are curated sets of dependencies focused on a particular type of workload. Including a starter on your classpath is really just a shorthand for including its dependencies, but it makes it easier to organize your code and easier to remember what the depdnencies are for. (See also http://github.com/spring-projects/spring-boot/tree/master/spring-boot-starters[Spring Boot starter projects].) Starters provided include:
* spring-cloud-starter
* spring-cloud-starter-bus-amqp
* spring-cloud-starter-cloudfoundry
* spring-cloud-starter-eureka
* spring-cloud-starter-eureka-server
* spring-cloud-starter-hystrix
* spring-cloud-starter-hystrix-dashboard
* spring-cloud-starter-turbine
* spring-cloud-starter-zuul

View File

@@ -0,0 +1,5 @@
== Spring Cloud Starters
include::intro.adoc[]

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env ruby
base_dir = File.join(File.dirname(__FILE__),'../../..')
src_dir = File.join(base_dir, "/src/main/asciidoc")
require File.join(File.dirname(__FILE__), 'readme.rb')
require 'optparse'
options = {}
input = "#{src_dir}/README.adoc"
OptionParser.new do |o|
o.on('-o OUTPUT_FILE', 'Output file (default is stdout)') { |file| options[:to_file] = file unless file=='-' }
o.on('-h', '--help') { puts o; exit }
o.parse!
end
input = ARGV[0] if ARGV.length>0
SpringCloud::Build.render_file(input, options)

54
src/main/ruby/readme.rb Normal file
View File

@@ -0,0 +1,54 @@
require 'open-uri'
module SpringCloud
module Build
IncludeDirectiveRx = /^\\?include::([^\[]+)\[(.*?)\]$/
class << self
def process_include out, src, target, attrs
unless target.include?(':') || target.start_with?('/')
target = File.join(src, target)
end
open(target) do |file|
file.each do |line|
self.process(out, File.dirname(target), line)
end
end
end
def process out, src, line
if ((escaped = line.start_with?('\\include::')) || line.start_with?('include::')) && (match = IncludeDirectiveRx.match(line))
if escaped
out << line[1..-1]
else
self.process_include out, src, match[1], match[2].strip
end
else
out << line
end
end
def render_file file, options = {}
srcDir = File.dirname(file)
out = ["// Do not edit this file (e.g. go instead to src/main/asciidoc)\n","\n"]
File.new(file).each do |line|
self.process(out, srcDir, line)
end
unless options[:to_file]
puts out
else
File.open(options[:to_file],'w+') do |file|
out.each { |line| file.write(line) }
end
end
end
end
end
end