Skip to content

Commit

Permalink
Simplify README generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Syer committed Oct 14, 2014
1 parent 99eb160 commit f5d8c4b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 58 deletions.
19 changes: 15 additions & 4 deletions docs/src/main/ruby/generate_readme.sh
Expand Up @@ -2,18 +2,29 @@

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 'asciidoctor'
require 'optparse'

options = {}
input = "#{src_dir}/README.adoc"
file = "#{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
file = ARGV[0] if ARGV.length>0

SpringCloud::Build.render_file(input, options)
srcDir = File.dirname(file)
out = "// Do not edit this file (e.g. go instead to src/main/asciidoc)\n\n"
doc = Asciidoctor.load_file file, safe: :safe, parse: false
out << doc.reader.read

unless options[:to_file]
puts out
else
File.open(options[:to_file],'w+') do |file|
file.write(out)
end
end
54 changes: 0 additions & 54 deletions docs/src/main/ruby/readme.rb

This file was deleted.

0 comments on commit f5d8c4b

Please sign in to comment.