Move README to src/main/asciidoc
This commit is contained in:
6
README.adoc
Normal file
6
README.adoc
Normal 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
|
||||
|
||||
33
pom.xml
33
pom.xml
@@ -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>
|
||||
|
||||
7
src/main/asciidoc/README.adoc
Normal file
7
src/main/asciidoc/README.adoc
Normal file
@@ -0,0 +1,7 @@
|
||||
= Spring Platform Bus
|
||||
|
||||
include::intro.adoc[]
|
||||
|
||||
== Quick Start
|
||||
|
||||
include::quickstart.adoc[]
|
||||
1
src/main/asciidoc/intro.adoc
Normal file
1
src/main/asciidoc/intro.adoc
Normal 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.
|
||||
0
src/main/asciidoc/quickstart.adoc
Normal file
0
src/main/asciidoc/quickstart.adoc
Normal 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[]
|
||||
|
||||
10
src/main/ruby/generate_readme.sh
Executable file
10
src/main/ruby/generate_readme.sh
Executable 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
51
src/main/ruby/readme.rb
Normal 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
|
||||
Reference in New Issue
Block a user