Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
49db709d
Commit
49db709d
authored
Oct 14, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify README generator
parent
46cf840e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
58 deletions
+15
-58
generate_readme.sh
docs/src/main/ruby/generate_readme.sh
+15
-4
readme.rb
docs/src/main/ruby/readme.rb
+0
-54
No files found.
docs/src/main/ruby/generate_readme.sh
View file @
49db709d
...
...
@@ -2,11 +2,11 @@
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
==
'-'
}
...
...
@@ -14,6 +14,17 @@ OptionParser.new do |o|
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
docs/src/main/ruby/readme.rb
deleted
100644 → 0
View file @
46cf840e
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment