sdoc 1.0.0.rc1 → 1.0.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/LICENSE +2 -1
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc/generator/template/merge/index.rhtml +3 -5
- data/lib/rdoc/generator/template/sdoc/resources/panel/index.html +2 -6
- data/lib/sdoc/generator.rb +49 -135
- data/lib/sdoc/version.rb +1 -1
- data/sdoc.gemspec +1 -1
- data/spec/rdoc_generator_spec.rb +0 -22
- data/spec/spec_helper.rb +0 -3
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd8f108539b22e091aee84678e782138bb18aa53
|
4
|
+
data.tar.gz: 6155efbb4da708d34160dd72c7b3d6cc961713fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f279d16a4661525a966e664a26572e787e53383c91dd050a8a24037b277fd005394c48cb0856d495a15b36928c035d50872c28909fce411440b540639c81572
|
7
|
+
data.tar.gz: 5ed8e231e52ac56ba9f959780cb2307637e35d85d02b193de0d369b67af50bd512d0235bc800d1037e1b7f0c84489168d5c99eb5fa24f1dfacd873affcd686da
|
data/.travis.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
2
3
|
before_install:
|
3
4
|
- gem install bundler
|
4
5
|
rvm:
|
@@ -7,12 +8,14 @@ rvm:
|
|
7
8
|
- 2.1.0
|
8
9
|
- 2.2.0
|
9
10
|
- 2.3.0
|
11
|
+
- 2.4.0
|
10
12
|
- ruby-head
|
11
13
|
- jruby-19mode
|
12
14
|
- jruby-head
|
13
15
|
matrix:
|
14
16
|
allow_failures:
|
15
17
|
- env: rdoc=master
|
18
|
+
- rvm: jruby-head
|
16
19
|
include:
|
17
20
|
- { rvm: 1.9.3, env: rdoc=master }
|
18
21
|
- { rvm: 2.0.0, env: rdoc=master }
|
data/LICENSE
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
Copyright (c) 2014
|
1
|
+
Copyright (c) 2014 Vladimir Kolesnikov, and Nathan Broadbent
|
2
|
+
Copyright (c) 2014-2017 Zachary Scott
|
2
3
|
|
3
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
5
|
a copy of this software and associated documentation files (the
|
data/lib/rdoc/discover.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
5
3
|
<head>
|
6
|
-
<meta
|
4
|
+
<meta charset="utf-8">
|
7
5
|
|
8
6
|
<title><%= @title %></title>
|
9
7
|
</head>
|
@@ -1,9 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
-
|
5
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
6
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
7
3
|
<head>
|
8
4
|
<title>search index</title>
|
9
5
|
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" charset="utf-8" />
|
data/lib/sdoc/generator.rb
CHANGED
@@ -122,7 +122,6 @@ class RDoc::Generator::SDoc
|
|
122
122
|
|
123
123
|
def self.setup_options(options)
|
124
124
|
@github = false
|
125
|
-
options.search_index = true
|
126
125
|
|
127
126
|
opt = options.option_parser
|
128
127
|
opt.separator nil
|
@@ -134,18 +133,6 @@ class RDoc::Generator::SDoc
|
|
134
133
|
end
|
135
134
|
opt.separator nil
|
136
135
|
|
137
|
-
opt.on("--without-search", "-s",
|
138
|
-
"Do not generate index file for search engines.",
|
139
|
-
"SDoc uses javascript to reference individual documentation pages.",
|
140
|
-
"Search engine crawlers are not smart enough to find all the",
|
141
|
-
"referenced pages.",
|
142
|
-
"To help them SDoc generates a static file with links to every",
|
143
|
-
"documentation page. This file is not shown to the user."
|
144
|
-
) do
|
145
|
-
options.search_index = false
|
146
|
-
end
|
147
|
-
opt.separator nil
|
148
|
-
|
149
136
|
end
|
150
137
|
|
151
138
|
def initialize(store, options)
|
@@ -170,12 +157,14 @@ class RDoc::Generator::SDoc
|
|
170
157
|
|
171
158
|
# Now actually write the output
|
172
159
|
copy_resources
|
173
|
-
generate_class_tree
|
174
160
|
@json_index.generate
|
161
|
+
@json_index.generate_gzipped
|
162
|
+
generate_search_index
|
163
|
+
generate_class_tree
|
164
|
+
|
165
|
+
generate_index_file
|
175
166
|
generate_file_files
|
176
167
|
generate_class_files
|
177
|
-
generate_index_file
|
178
|
-
generate_search_index if @options.search_index
|
179
168
|
end
|
180
169
|
|
181
170
|
def class_dir
|
@@ -193,108 +182,13 @@ class RDoc::Generator::SDoc
|
|
193
182
|
$stderr.puts( *msg )
|
194
183
|
end
|
195
184
|
|
196
|
-
### Create
|
197
|
-
def
|
198
|
-
debug_msg "Generating
|
199
|
-
|
200
|
-
|
201
|
-
debug_msg " writing class tree to %s" % TREE_FILE
|
202
|
-
File.open(TREE_FILE, "w", 0644) do |f|
|
203
|
-
f.write('var tree = '); f.write(tree.to_json(:max_nesting => 0))
|
204
|
-
end unless @options.dry_run
|
205
|
-
end
|
206
|
-
|
207
|
-
### Recursivly build class tree structure
|
208
|
-
def generate_class_tree_level(classes, visited = {})
|
209
|
-
tree = []
|
210
|
-
classes.select do |klass|
|
211
|
-
!visited[klass] && klass.with_documentation?
|
212
|
-
end.sort.each do |klass|
|
213
|
-
visited[klass] = true
|
214
|
-
item = [
|
215
|
-
klass.name,
|
216
|
-
klass.document_self_or_methods ? klass.path : '',
|
217
|
-
klass.module? ? '' : (klass.superclass ? " < #{String === klass.superclass ? klass.superclass : klass.superclass.full_name}" : ''),
|
218
|
-
generate_class_tree_level(klass.classes_and_modules, visited)
|
219
|
-
]
|
220
|
-
tree << item
|
221
|
-
end
|
222
|
-
tree
|
223
|
-
end
|
224
|
-
|
225
|
-
### Add files to search +index+ array
|
226
|
-
def add_file_search_index(index)
|
227
|
-
debug_msg " generating file search index"
|
228
|
-
|
229
|
-
@files.select { |file|
|
230
|
-
file.document_self
|
231
|
-
}.sort.each do |file|
|
232
|
-
debug_msg " #{file.path}"
|
233
|
-
index[:searchIndex].push( search_string(file.name) )
|
234
|
-
index[:longSearchIndex].push( search_string(file.path) )
|
235
|
-
index[:info].push([
|
236
|
-
file.name,
|
237
|
-
file.path,
|
238
|
-
file.path,
|
239
|
-
'',
|
240
|
-
snippet(file.comment),
|
241
|
-
TYPE_FILE
|
242
|
-
])
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
### Add classes to search +index+ array
|
247
|
-
def add_class_search_index(index)
|
248
|
-
debug_msg " generating class search index"
|
249
|
-
@classes.uniq.select { |klass|
|
250
|
-
klass.document_self_or_methods
|
251
|
-
}.sort.each do |klass|
|
252
|
-
modulename = klass.module? ? '' : (klass.superclass ? (String === klass.superclass ? klass.superclass : klass.superclass.full_name) : '')
|
253
|
-
debug_msg " #{klass.parent.full_name}::#{klass.name}"
|
254
|
-
index[:searchIndex].push( search_string(klass.name) )
|
255
|
-
index[:longSearchIndex].push( search_string(klass.parent.full_name) )
|
256
|
-
files = klass.in_files.map{ |file| file.absolute_name }
|
257
|
-
index[:info].push([
|
258
|
-
klass.name,
|
259
|
-
files.include?(klass.parent.full_name) ? files.first : klass.parent.full_name,
|
260
|
-
klass.path,
|
261
|
-
modulename ? " < #{modulename}" : '',
|
262
|
-
snippet(klass.comment),
|
263
|
-
TYPE_CLASS
|
264
|
-
])
|
265
|
-
end
|
266
|
-
end
|
267
|
-
|
268
|
-
### Add methods to search +index+ array
|
269
|
-
def add_method_search_index(index)
|
270
|
-
debug_msg " generating method search index"
|
271
|
-
|
272
|
-
list = @classes.uniq.map do |klass|
|
273
|
-
klass.method_list
|
274
|
-
end.flatten.sort do |a, b|
|
275
|
-
a.name == b.name ?
|
276
|
-
a.parent.full_name <=> b.parent.full_name :
|
277
|
-
a.name <=> b.name
|
278
|
-
end.select do |method|
|
279
|
-
method.document_self
|
280
|
-
end.find_all do |m|
|
281
|
-
m.visibility == :public || m.visibility == :protected ||
|
282
|
-
m.force_documentation
|
283
|
-
end
|
185
|
+
### Create index.html with frameset
|
186
|
+
def generate_index_file
|
187
|
+
debug_msg "Generating index file in #@outputdir"
|
188
|
+
templatefile = @template_dir + 'index.rhtml'
|
189
|
+
outfile = @outputdir + 'index.html'
|
284
190
|
|
285
|
-
|
286
|
-
debug_msg " #{method.full_name}"
|
287
|
-
index[:searchIndex].push( search_string(method.name) + '()' )
|
288
|
-
index[:longSearchIndex].push( search_string(method.parent.full_name) )
|
289
|
-
index[:info].push([
|
290
|
-
method.name,
|
291
|
-
method.parent.full_name,
|
292
|
-
method.path,
|
293
|
-
method.params,
|
294
|
-
snippet(method.comment),
|
295
|
-
TYPE_METHOD
|
296
|
-
])
|
297
|
-
end
|
191
|
+
self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
|
298
192
|
end
|
299
193
|
|
300
194
|
### Generate a documentation file for each class
|
@@ -327,6 +221,44 @@ class RDoc::Generator::SDoc
|
|
327
221
|
end
|
328
222
|
end
|
329
223
|
|
224
|
+
### Generate file with links for the search engine
|
225
|
+
def generate_search_index
|
226
|
+
debug_msg "Generating search engine index in #@outputdir"
|
227
|
+
templatefile = @template_dir + 'search_index.rhtml'
|
228
|
+
outfile = @outputdir + 'panel/links.html'
|
229
|
+
|
230
|
+
self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
|
231
|
+
end
|
232
|
+
|
233
|
+
### Create class tree structure and write it as json
|
234
|
+
def generate_class_tree
|
235
|
+
debug_msg "Generating class tree"
|
236
|
+
topclasses = @classes.select {|klass| !(RDoc::ClassModule === klass.parent) }
|
237
|
+
tree = generate_file_tree + generate_class_tree_level(topclasses)
|
238
|
+
debug_msg " writing class tree to %s" % TREE_FILE
|
239
|
+
File.open(TREE_FILE, "w", 0644) do |f|
|
240
|
+
f.write('var tree = '); f.write(tree.to_json(:max_nesting => 0))
|
241
|
+
end unless @options.dry_run
|
242
|
+
end
|
243
|
+
|
244
|
+
### Recursivly build class tree structure
|
245
|
+
def generate_class_tree_level(classes, visited = {})
|
246
|
+
tree = []
|
247
|
+
classes.select do |klass|
|
248
|
+
!visited[klass] && klass.with_documentation?
|
249
|
+
end.sort.each do |klass|
|
250
|
+
visited[klass] = true
|
251
|
+
item = [
|
252
|
+
klass.name,
|
253
|
+
klass.document_self_or_methods ? klass.path : '',
|
254
|
+
klass.module? ? '' : (klass.superclass ? " < #{String === klass.superclass ? klass.superclass : klass.superclass.full_name}" : ''),
|
255
|
+
generate_class_tree_level(klass.classes_and_modules, visited)
|
256
|
+
]
|
257
|
+
tree << item
|
258
|
+
end
|
259
|
+
tree
|
260
|
+
end
|
261
|
+
|
330
262
|
### Determines index path based on @options.main_page (or lack thereof)
|
331
263
|
def index_path
|
332
264
|
# Break early to avoid a big if block when no main page is specified
|
@@ -344,24 +276,6 @@ class RDoc::Generator::SDoc
|
|
344
276
|
end
|
345
277
|
end
|
346
278
|
|
347
|
-
### Create index.html with frameset
|
348
|
-
def generate_index_file
|
349
|
-
debug_msg "Generating index file in #@outputdir"
|
350
|
-
templatefile = @template_dir + 'index.rhtml'
|
351
|
-
outfile = @outputdir + 'index.html'
|
352
|
-
|
353
|
-
self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
|
354
|
-
end
|
355
|
-
|
356
|
-
### Generate file with links for the search engine
|
357
|
-
def generate_search_index
|
358
|
-
debug_msg "Generating search engine index in #@outputdir"
|
359
|
-
templatefile = @template_dir + 'search_index.rhtml'
|
360
|
-
outfile = @outputdir + 'panel/links.html'
|
361
|
-
|
362
|
-
self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
|
363
|
-
end
|
364
|
-
|
365
279
|
### Copy all the resource files to output dir
|
366
280
|
def copy_resources
|
367
281
|
resources_path = @template_dir + RESOURCES_DIR
|
data/lib/sdoc/version.rb
CHANGED
data/sdoc.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.rdoc_options = ["--charset=UTF-8"]
|
23
23
|
s.extra_rdoc_files = ["README.md"]
|
24
24
|
|
25
|
-
s.add_runtime_dependency("rdoc", "5.0
|
25
|
+
s.add_runtime_dependency("rdoc", "~> 5.0")
|
26
26
|
|
27
27
|
s.files = `git ls-files`.split("\n")
|
28
28
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
data/spec/rdoc_generator_spec.rb
CHANGED
@@ -37,26 +37,4 @@ describe RDoc::Generator::SDoc do
|
|
37
37
|
err.wont_match(/^invalid options/)
|
38
38
|
@options.github.must_equal true
|
39
39
|
end
|
40
|
-
|
41
|
-
it "should parse no search engine index option" do
|
42
|
-
@options.search_index.must_equal true
|
43
|
-
|
44
|
-
_, err = capture_io do
|
45
|
-
@parser.parse %w[--without-search]
|
46
|
-
end
|
47
|
-
|
48
|
-
err.wont_match(/^invalid options/)
|
49
|
-
@options.search_index.must_equal false
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should parse search-index shorthand option" do
|
53
|
-
@options.search_index.must_equal true
|
54
|
-
_, err = capture_io do
|
55
|
-
@parser.parse %w[-s]
|
56
|
-
end
|
57
|
-
|
58
|
-
err.wont_match(/^invalid options/)
|
59
|
-
@options.search_index.must_equal false
|
60
|
-
end
|
61
|
-
|
62
40
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Kolesnikov
|
@@ -11,22 +11,22 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2017-04-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rdoc
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 5.0
|
22
|
+
version: '5.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 5.0
|
29
|
+
version: '5.0'
|
30
30
|
description: rdoc generator html with javascript search index.
|
31
31
|
email: voloko@gmail.com mail@zzak.io
|
32
32
|
executables:
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: 1.3.6
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.6.11
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: rdoc html with javascript search index.
|