Move docs to submodule for multi-module projects
This commit is contained in:
5
docs/src/main/asciidoc/README.adoc
Normal file
5
docs/src/main/asciidoc/README.adoc
Normal file
@@ -0,0 +1,5 @@
|
||||
include::intro.adoc[]
|
||||
|
||||
== Installation
|
||||
|
||||
include::install.adoc[]
|
||||
46
docs/src/main/asciidoc/ghpages.sh
Executable file
46
docs/src/main/asciidoc/ghpages.sh
Executable 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
|
||||
33
docs/src/main/asciidoc/install.adoc
Normal file
33
docs/src/main/asciidoc/install.adoc
Normal file
@@ -0,0 +1,33 @@
|
||||
To install, make
|
||||
sure you have
|
||||
https://github.com/spring-projects/spring-boot[Spring Boot CLI]
|
||||
(1.1.x with x>=5):
|
||||
|
||||
$ spring version
|
||||
Spring CLI v1.1.5.RELEASE
|
||||
|
||||
E.g. for GVM users
|
||||
|
||||
```
|
||||
$ gvm install springboot 1.1.5.RELEASE
|
||||
$ gvm use springboot 1.1.5.RELEASE
|
||||
```
|
||||
|
||||
then get the install command plugin (backported from Boot 1.2.0):
|
||||
|
||||
```
|
||||
$ wget http://dl.bintray.com/dsyer/generic/install-0.0.1.jar
|
||||
```
|
||||
|
||||
install it in the Spring Boot CLI, e.g. with GVM (MacOS users that rely on brew might have to find the `/lib` directory by scanning `brew info springboot`):
|
||||
|
||||
```
|
||||
$ cp install-0.0.1.jar ~/.gvm/springboot/1.1.5.RELEASE/lib
|
||||
```
|
||||
|
||||
and finally install the Spring Cloud plugin:
|
||||
|
||||
```
|
||||
$ mvn install
|
||||
$ spring install org.springframework.cloud:spring-cloud-cli:1.0.0.BUILD-SNAPSHOT
|
||||
```
|
||||
3
docs/src/main/asciidoc/intro.adoc
Normal file
3
docs/src/main/asciidoc/intro.adoc
Normal file
@@ -0,0 +1,3 @@
|
||||
Spring Boot command line features for
|
||||
https://github.com/spring-cloud[Spring Cloud].
|
||||
|
||||
7
docs/src/main/asciidoc/spring-cloud-cli.adoc
Normal file
7
docs/src/main/asciidoc/spring-cloud-cli.adoc
Normal file
@@ -0,0 +1,7 @@
|
||||
= Spring Boot CLoud CLI
|
||||
|
||||
include::intro.adoc[]
|
||||
|
||||
== Installation
|
||||
|
||||
include::install.adoc[]
|
||||
19
docs/src/main/ruby/generate_readme.sh
Executable file
19
docs/src/main/ruby/generate_readme.sh
Executable 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
docs/src/main/ruby/readme.rb
Normal file
54
docs/src/main/ruby/readme.rb
Normal 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
|
||||
Reference in New Issue
Block a user