Move docs to submodule for multi-module projects

This commit is contained in:
Dave Syer
2014-10-06 14:58:44 +01:00
parent 68f7a00505
commit 41e47c9995
9 changed files with 50 additions and 30 deletions

View File

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

View File

@@ -0,0 +1,46 @@
#!/bin/bash -x
git remote set-url --push origin `git config remote.origin.url | sed -e 's/^git:/https:/'`
if ! (git remote set-branches --add origin gh-pages && git fetch -q); then
echo "No gh-pages, so not syncing"
exit 0
fi
if ! [ -d docs/target/generated-docs ]; then
echo "No gh-pages sources in docs/target/generated-docs, so not syncing"
exit 0
fi
# Stash any outstanding changes
###################################################################
git diff-index --quiet HEAD
dirty=$?
if [ "$dirty" != "0" ]; then git stash; fi
# Switch to gh-pages branch to sync it with master
###################################################################
git checkout gh-pages
for f in docs/target/generated-docs/*; do
file=${f#docs/target/generated-docs/*}
if ! git ls-files -i -o --exclude-standard --directory | grep -q ^$file$; then
# Not ignored...
cp -rf $f .
git add -A $file
fi
done
git commit -a -m "Sync docs from master to gh-pages"
# Uncomment the following push if you want to auto push to
# the gh-pages branch whenever you commit to master locally.
# This is a little extreme. Use with care!
###################################################################
git push origin gh-pages
# Finally, switch back to the master branch and exit block
git checkout master
if [ "$dirty" != "0" ]; then git stash pop; fi
exit 0

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)

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