diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..5305d14 --- /dev/null +++ b/README.adoc @@ -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 + diff --git a/README.md b/README.md deleted file mode 100644 index 55e6f49..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -### Spring Platform Bus diff --git a/pom.xml b/pom.xml index 5461266..8d16a4a 100644 --- a/pom.xml +++ b/pom.xml @@ -112,4 +112,37 @@ 1.7 + + + + maven-antrun-plugin + + + org.jruby + jruby-complete + 1.7.12 + + + + + readme + process-resources + + run + + false + + + + + + + + + + + + + + diff --git a/src/main/asciidoc/README.adoc b/src/main/asciidoc/README.adoc new file mode 100644 index 0000000..72b2f70 --- /dev/null +++ b/src/main/asciidoc/README.adoc @@ -0,0 +1,7 @@ += Spring Platform Bus + +include::intro.adoc[] + +== Quick Start + +include::quickstart.adoc[] diff --git a/src/main/asciidoc/intro.adoc b/src/main/asciidoc/intro.adoc new file mode 100644 index 0000000..d2131c8 --- /dev/null +++ b/src/main/asciidoc/intro.adoc @@ -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. diff --git a/src/main/asciidoc/quickstart.adoc b/src/main/asciidoc/quickstart.adoc new file mode 100644 index 0000000..e69de29 diff --git a/src/main/asciidoc/spring-cloud-bus.adoc b/src/main/asciidoc/spring-cloud-bus.adoc index 0614e14..d96b1c3 100644 --- a/src/main/asciidoc/spring-cloud-bus.adoc +++ b/src/main/asciidoc/spring-cloud-bus.adoc @@ -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[] diff --git a/src/main/ruby/generate_readme.sh b/src/main/ruby/generate_readme.sh new file mode 100755 index 0000000..a6b3611 --- /dev/null +++ b/src/main/ruby/generate_readme.sh @@ -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) diff --git a/src/main/ruby/readme.rb b/src/main/ruby/readme.rb new file mode 100644 index 0000000..348507c --- /dev/null +++ b/src/main/ruby/readme.rb @@ -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