Move README to src/main/asciidoc

This commit is contained in:
Dave Syer
2014-09-29 14:12:56 +01:00
parent 5991cfcdff
commit 6c84806d5d
9 changed files with 112 additions and 2 deletions

6
README.adoc Normal file
View File

@@ -0,0 +1,6 @@
// Do not edit this file (go to /home/dsyer/dev/cloud/scripts/bus/src/main/ruby/../../../src/main/asciidoc/README.adoc instead)= Spring Platform Bus
Spring Cloud Bus links nodes of a distributed system with a lightweight message broker. This can then be used to broadcast state changes (e.g. configuration changes) or other management instructions.
== Quick Start

View File

@@ -1 +0,0 @@
### Spring Platform Bus

33
pom.xml
View File

@@ -112,4 +112,37 @@
<java.version>1.7</java.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>1.7.12</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>readme</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<inherited>false</inherited>
<configuration>
<tasks>
<java classname="org.jruby.Main" failonerror="yes">
<arg value="${basedir}/src/main/ruby/generate_readme.sh" />
<arg value="${basedir}/README.adoc" />
</java>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,7 @@
= Spring Platform Bus
include::intro.adoc[]
== Quick Start
include::quickstart.adoc[]

View File

@@ -0,0 +1 @@
Spring Cloud Bus links nodes of a distributed system with a lightweight message broker. This can then be used to broadcast state changes (e.g. configuration changes) or other management instructions.

View File

View File

@@ -1,5 +1,8 @@
= Spring Platform Bus
:toc:
Spring Cloud Bus links nodes of a distributed system with a lightweight message broker. This can then be used to broadcast state changes (e.g. configuration changes) or other management instructions.
include::intro.adoc[]
== Quick Start
include::quickstart.adoc[]

View File

@@ -0,0 +1,10 @@
#!/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')
options = {}
ARGV.length > 0 and options[:to_file] = ARGV[0]
SpringCloud::Build.render_file("#{src_dir}/README.adoc", options)

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

@@ -0,0 +1,51 @@
module SpringCloud
module Build
IncludeDirectiveRx = /^\\?include::([^\[]+)\[(.*?)\]$/
class << self
def process_include out, src, target, attrs
unless target.start_with?('/')
target = File.new(File.join(src, target))
else
target = File.new(target)
end
target.each do |line|
self.process(out, File.dirname(target), line)
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 (go to #{file} instead)",""]
File.new(file).each do |line|
self.process(out, srcDir, line)
end
unless options[:to_file]
puts out
else
writer = File.new(options[:to_file],'w+')
out.each { |line| writer.write(line) }
end
end
end
end
end