rdoc-shomen 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.ruby ADDED
@@ -0,0 +1,62 @@
1
+ ---
2
+ source:
3
+ - meta
4
+ authors:
5
+ - name: trans
6
+ email: transfire@gmail.com
7
+ copyrights:
8
+ - holder: Rubyworks
9
+ year: '2011'
10
+ license: BSD-2-Clause
11
+ requirements:
12
+ - name: shomen-model
13
+ - name: citron
14
+ groups:
15
+ - test
16
+ development: true
17
+ - name: detroit
18
+ groups:
19
+ - build
20
+ development: true
21
+ dependencies: []
22
+ alternatives: []
23
+ conflicts: []
24
+ repositories:
25
+ - uri: git://github.com/rubyworks/rdoc-shomen.git
26
+ scm: git
27
+ name: upstream
28
+ resources:
29
+ - uri: http://rubyworks.github.com/rdoc-shomen
30
+ name: home
31
+ type: home
32
+ - uri: http://rubydoc.info/gems/rdoc-shoment
33
+ name: docs
34
+ type: doc
35
+ - uri: http://github.com/rubyworks/rdoc-shomen
36
+ name: code
37
+ type: code
38
+ - uri: http://github.com/rubyworks/rdoc-shomen/issues
39
+ name: bugs
40
+ type: bugs
41
+ - uri: http://groups.google.com/groups/rubyworks-mailinglist
42
+ name: mail
43
+ type: mail
44
+ extra: {}
45
+ load_path:
46
+ - lib
47
+ revision: 0
48
+ created: '2010-07-01'
49
+ summary: RDoc Generator for Shomen Documentation Format
50
+ title: RDoc Shomen
51
+ version: 0.1.1
52
+ name: rdoc-shomen
53
+ description: ! 'RDoc-Shomen is an RDoc generator plugin that can be used to generate
54
+ Shomen
55
+
56
+ documentation. This is an alternative to the shomen command line tool which
57
+
58
+ use the `.rdoc` cache to generate a shomen document. In contrast the rdoc-shomen
59
+
60
+ generator operates as a traditional rdoc plugin.'
61
+ organization: rubyworks
62
+ date: '2012-04-16'
@@ -0,0 +1,5 @@
1
+
2
+ config :rubytest do |run|
3
+ run.files < 'test/case_*.rb'
4
+ end
5
+
@@ -0,0 +1,20 @@
1
+ = RELEASE HISTORY
2
+
3
+ == 0.1.1 | 2012-04-20
4
+
5
+ This release simple uses the new shomen-model gem,
6
+ instead of the previous shomen gem.
7
+
8
+ Changes:
9
+
10
+ * Use shomen-model instead of shomen.
11
+
12
+
13
+ == 0.1.0 | 2012-04-18
14
+
15
+ This is the first release of rdoc-shomen.
16
+
17
+ Changes:
18
+
19
+ * Happy first release day!
20
+
@@ -0,0 +1,30 @@
1
+ RDoc Shomen - Shomen Generator for RDoc
2
+
3
+ Copyright (c) 2011 Rubyworks. All rights reserved.
4
+
5
+ Licensed (spdx) BSD-2-Clause
6
+
7
+ Redistribution and use in source and binary forms,
8
+ with or without modification, are permitted provided that the following
9
+ conditions are met:
10
+
11
+ 1. Redistributions of source code must retain the above copyright notice,
12
+ this list of conditions and the following disclaimer.
13
+
14
+ 2. Redistributions in binary form must reproduce the above copyright
15
+ notice, this list of conditions and the following disclaimer in the
16
+ documentation and/or other materials provided with the distribution.
17
+
18
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
+ COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ (http://github.com/rubyworks/rdoc-shomen)
30
+
@@ -0,0 +1,42 @@
1
+ = Shomen RDoc Generator
2
+
3
+ {Homepage}[http://rubyworks.github.com/rdoc-shomen] /
4
+ {Report Issue}[http://github.com/rubyworks/rdoc-shomen/issues] /
5
+ {Source Code}[http://github.com/rubyworks/rdoc-shomen] /
6
+ {Mailing List}[http://google.groups.com/groups/rubyworks-mailinglist]
7
+
8
+ {<img src="https://secure.travis-ci.org/rubyworks/rdoc-shomen.png" />}[http://travis-ci.org/rubyworks/rdoc-shomen]
9
+
10
+
11
+ == Description
12
+
13
+ This is the old-school Shomen generator for RDoc.
14
+
15
+
16
+ == Instruction
17
+
18
+ Use the shomen generator like any other RDoc generator.
19
+
20
+ $ rdoc -f shomen -m README.rdoc lib [A-Z]*.*
21
+
22
+ The shomen document will be saved to the output directory (default `doc`)
23
+ as wither `doc.json` or as `<name>-<version>.json` if project metadata is
24
+ discoverable.
25
+
26
+ The generator supports a couple of special options:
27
+
28
+ * `--yaml` option will save the file to YAML format instead of JSON.
29
+ * `--source` will include full source code in script entries.
30
+
31
+ The `--source` option is not recommended for documentation that will
32
+ be served online as it will make the documation file rather large.
33
+
34
+
35
+ == Copyrights
36
+
37
+ Copyright (c) 2011 Rubyworks. All rights reserved.
38
+
39
+ RDoc Shomen is distributable in accordance with the *BSD-2-Clause* license.
40
+
41
+ See LICENSE.txt file for details.
42
+
@@ -0,0 +1,35 @@
1
+ begin
2
+ require "rubygems"
3
+ rescue LoadError
4
+ end
5
+
6
+ begin
7
+ gem 'rdoc', '~> 3'
8
+ #gem 'shomen'
9
+ require_relative 'generator/shomen'
10
+ rescue Gem::LoadError => error
11
+ puts error
12
+ rescue LoadError => error
13
+ puts error
14
+ end
15
+
16
+
17
+
18
+
19
+
20
+ #puts "RDoc discovered Shomen!" if $DEBUG
21
+
22
+ # If using Gems put her on the $LOAD_PATH
23
+ #begin
24
+ # require "rubygems"
25
+ # gem "rdoc", ">= 2.5"
26
+ # gem "shomen"
27
+ #end
28
+
29
+ #require 'shomen/rdoc/option_fix'
30
+
31
+ #RDoc.generator_option('shomen') do
32
+ # require 'shomen/rdoc/generator'
33
+ # RDoc::Generator::Shomen
34
+ #end
35
+
@@ -0,0 +1,667 @@
1
+ require 'fileutils'
2
+ require 'pathname'
3
+ require 'yaml'
4
+ require 'json'
5
+
6
+ require 'shomen-model'
7
+
8
+ require 'rdoc/rdoc'
9
+ require 'rdoc/generator'
10
+ require 'rdoc/generator/markup'
11
+ require 'rdoc/generator/shomen_extensions'
12
+
13
+ # Shomen Adaptor for RDoc utilizes the rdoc tool to parse ruby source code
14
+ # to build a Shomen documenation file.
15
+ #
16
+ # RDoc is almost entirely a free-form documentation system, so it is not
17
+ # possible for Shomen to fully harness all the details it can support from
18
+ # the RDoc documentation, such as method argument descriptions.
19
+ #
20
+ class RDoc::Generator::Shomen
21
+
22
+ #
23
+ DESCRIPTION = 'Shomen documentation format'
24
+
25
+ # Register shomen generator with RDoc.
26
+ RDoc::RDoc.add_generator(self)
27
+
28
+ #include RDocShomen::Metadata
29
+
30
+ # Standard generator factory method.
31
+ #
32
+ # options - Generator options.
33
+ #
34
+ # Returns new RDoc::Generator::Shomen instance.
35
+ def self.for(options)
36
+ new(options)
37
+ end
38
+
39
+ # User options from the command line.
40
+ attr :options
41
+
42
+ #
43
+ def self.setup_options(options)
44
+ options.source = false
45
+ options.yaml = false
46
+
47
+ opt = options.option_parser
48
+
49
+ opt.separator nil
50
+ opt.separator "Shomen generator options:"
51
+ opt.separator nil
52
+ opt.on("--yaml", "Generate YAML document instead of JSON.") do |value|
53
+ options.yaml = true
54
+ end
55
+ opt.separator nil
56
+ opt.on("--source", "Include full source code for scripts.") do |value|
57
+ options.github = true
58
+ end
59
+ end
60
+
61
+ # List of all classes and modules.
62
+ #def all_classes_and_modules
63
+ # @all_classes_and_modules ||= RDoc::TopLevel.all_classes_and_modules
64
+ #end
65
+
66
+ # In the world of the RDoc Generators #classes is the same
67
+ # as #all_classes_and_modules. Well, except that its sorted
68
+ # too. For classes sans modules, see #types.
69
+ #
70
+ def classes
71
+ @classes ||= RDoc::TopLevel.all_classes_and_modules.sort
72
+ end
73
+
74
+ # Only toplevel classes and modules.
75
+ def classes_toplevel
76
+ @classes_toplevel ||= classes.select {|klass| !(RDoc::ClassModule === klass.parent) }
77
+ end
78
+
79
+ #
80
+ def files
81
+ @files ||= (
82
+ @files_rdoc.select{ |f| f.parser != RDoc::Parser::Simple }
83
+ )
84
+ end
85
+
86
+ # List of toplevel files. RDoc supplies this via the #generate method.
87
+ def files_toplevel
88
+ @files_toplevel ||= (
89
+ @files_rdoc.select{ |f| f.parser == RDoc::Parser::Simple }
90
+ )
91
+ end
92
+
93
+ #
94
+ def files_hash
95
+ @files ||= RDoc::TopLevel.files_hash
96
+ end
97
+
98
+ # List of all methods in all classes and modules.
99
+ def methods_all
100
+ @methods_all ||= classes.map{ |m| m.method_list }.flatten.sort
101
+ end
102
+
103
+ # List of all attributes in all classes and modules.
104
+ def attributes_all
105
+ @attributes_all ||= classes.map{ |m| m.attributes }.flatten.sort
106
+ end
107
+
108
+ #
109
+ def constants_all
110
+ @constants_all ||= classes.map{ |c| c.constants }.flatten
111
+ end
112
+
113
+ ## TODO: What's this then?
114
+ ##def json_creatable?
115
+ ## RDoc::TopLevel.json_creatable?
116
+ ##end
117
+
118
+ # RDoc needs this to function.
119
+ def class_dir ; nil ; end
120
+
121
+ # RDoc needs this to function.
122
+ def file_dir ; nil ; end
123
+
124
+ # TODO: Rename ?
125
+ def shomen
126
+ @table || {}
127
+ end
128
+
129
+ # Build the initial indices and output objects based on an array of
130
+ # top level objects containing the extracted information.
131
+ #
132
+ # files - Files to document.
133
+ #
134
+ # Returns nothing.
135
+ def generate(files)
136
+ @files_rdoc = files.sort
137
+
138
+ @table = {}
139
+
140
+ generate_metadata
141
+ generate_constants
142
+ generate_classes
143
+ #generate_attributes
144
+ generate_methods
145
+ generate_documents
146
+ generate_scripts # must be last b/c it depends on the others
147
+
148
+ # TODO: method accessor fields need to be handled
149
+
150
+ # THINK: Internal referencing model, YAML and JSYNC ?
151
+ #ref_table = reference_table(@table)
152
+
153
+ if options.yaml
154
+ out = @table.to_yaml
155
+ else
156
+ out = JSON.generate(@table)
157
+ end
158
+
159
+ if options.op_dir == '-'
160
+ puts out
161
+ else
162
+ File.open(output_file, 'w') do |f|
163
+ f << out
164
+ end unless $dryrun
165
+ end
166
+
167
+ #rescue StandardError => err
168
+ # debug_msg "%s: %s\n %s" % [ err.class.name, err.message, err.backtrace.join("\n ") ]
169
+ # raise err
170
+ end
171
+
172
+ #
173
+ def output_file
174
+ name = project_metadata['name']
175
+ vers = project_metadata['version']
176
+
177
+ if name && vers
178
+ "#{name}-#{vers}.json"
179
+ else
180
+ 'doc.json'
181
+ end
182
+ end
183
+
184
+ protected
185
+
186
+ # Initialize new generator.
187
+ #
188
+ # options - Generator options.
189
+ #
190
+ # Returns new RDoc::Generator::Shomen instance.
191
+ def initialize(options)
192
+ @options = options
193
+ #@options.diagram = false # why?
194
+
195
+ @path_base = Pathname.pwd.expand_path
196
+
197
+ # TODO: This is probably not needed any more.
198
+ @path_output = Pathname.new(@options.op_dir).expand_path(@path_base)
199
+ end
200
+
201
+ # Current pathname.
202
+ attr :path_base
203
+
204
+ # The output path.
205
+ attr :path_output
206
+
207
+ #
208
+ def path_output_relative(path=nil)
209
+ if path
210
+ path.to_s.sub(path_base.to_s+'/', '')
211
+ else
212
+ @path_output_relative ||= path_output.to_s.sub(path_base.to_s+'/', '')
213
+ end
214
+ end
215
+
216
+ #
217
+ def project_metadata
218
+ @project_metadata ||= Shomen::Metadata.new
219
+ end
220
+
221
+ #
222
+ def generate_metadata
223
+ @table['(metadata)'] = project_metadata.to_h
224
+ end
225
+
226
+ # Add constants to table.
227
+ def generate_constants
228
+ debug_msg "Generating constant documentation:"
229
+ constants_all.each do |rdoc|
230
+ model = Shomen::Model::Constant.new
231
+
232
+ model.path = rdoc.parent.full_name + '::' + rdoc.name
233
+ model.name = rdoc.name
234
+ model.namespace = rdoc.parent.full_name
235
+ model.comment = comment(rdoc.comment)
236
+ model.format = 'rdoc'
237
+ model.value = rdoc.value
238
+ model.files = ["/#{rdoc.file.full_name}"]
239
+
240
+ @table[model.path] = model.to_h
241
+ end
242
+ end
243
+
244
+ # Add classes (and modules) to table.
245
+ def generate_classes
246
+ debug_msg "Generating class/module documentation:"
247
+
248
+ classes.each do |rdoc_class|
249
+ debug_msg "%s (%s)" % [ rdoc_class.full_name, rdoc_class.path ]
250
+
251
+ if rdoc_class.type=='class'
252
+ model = Shomen::Model::Class.new
253
+ else
254
+ model = Shomen::Model::Module.new
255
+ end
256
+
257
+ model.path = rdoc_class.full_name
258
+ model.name = rdoc_class.name
259
+ model.namespace = rdoc_class.full_name.split('::')[0...-1].join('::')
260
+ model.includes = rdoc_class.includes.map{ |x| x.name } # FIXME: How to "lookup" full name?
261
+ model.extensions = [] # TODO: How to get extensions?
262
+ model.comment = comment(rdoc_class.comment)
263
+ model.format = 'rdoc'
264
+ model.constants = rdoc_class.constants.map{ |x| complete_name(x.name, rdoc_class.full_name) }
265
+ model.modules = rdoc_class.modules.map{ |x| complete_name(x.name, rdoc_class.full_name) }
266
+ model.classes = rdoc_class.classes.map{ |x| complete_name(x.name, rdoc_class.full_name) }
267
+ model.methods = rdoc_class.method_list.map{ |m| method_name(m) }.uniq
268
+ model.accessors = rdoc_class.attributes.map{ |a| method_name(a) }.uniq #+ ":#{a.rw}" }.uniq
269
+ model.files = rdoc_class.in_files.map{ |x| "/#{x.full_name}" }
270
+
271
+ if rdoc_class.type == 'class'
272
+ # HACK: No idea why RDoc is returning some weird superclass:
273
+ # <RDoc::NormalClass:0xd924d4 class Object < BasicObject includes: []
274
+ # attributes: [] methods: [#<RDoc::AnyMethod:0xd92b8c Object#fileutils
275
+ # (public)>] aliases: []>
276
+ # Maybe it has something to do with #fileutils?
277
+ model.superclass = (
278
+ case rdoc_class.superclass
279
+ when nil
280
+ when String
281
+ rdoc_class.superclass
282
+ else
283
+ rdoc_class.superclass.full_name
284
+ end
285
+ )
286
+ end
287
+
288
+ @table[model.path] = model.to_h
289
+ end
290
+ end
291
+
292
+ # TODO: How to get literal interface separate from call-sequnces?
293
+
294
+ # Transform RDoc methods to Shomen model and add to table.
295
+ def generate_methods
296
+ debug_msg "Generating method documentation:"
297
+
298
+ list = methods_all + attributes_all
299
+
300
+ list.each do |rdoc_method|
301
+ #debug_msg "%s" % [rdoc_method.full_name]
302
+
303
+ #full_name = method_name(m)
304
+ #'prettyname' => m.pretty_name,
305
+ #'type' => m.type, # class or instance
306
+
307
+ model = Shomen::Model::Method.new
308
+
309
+ model.path = method_name(rdoc_method)
310
+ model.name = rdoc_method.name
311
+ model.namespace = rdoc_method.parent_name
312
+ model.comment = comment(rdoc_method.comment)
313
+ model.format = 'rdoc'
314
+ model.aliases = rdoc_method.aliases.map{ |a| method_name(a) }
315
+ model.alias_for = method_name(rdoc_method.is_alias_for)
316
+ model.singleton = rdoc_method.singleton
317
+
318
+ model.declarations << rdoc_method.type.to_s #singleton ? 'class' : 'instance'
319
+ model.declarations << rdoc_method.visibility.to_s
320
+
321
+ model.interfaces = []
322
+ if rdoc_method.call_seq
323
+ rdoc_method.call_seq.split("\n").each do |cs|
324
+ cs = cs.to_s.strip
325
+ model.interfaces << parse_interface(cs) unless cs == ''
326
+ end
327
+ end
328
+ model.interfaces << parse_interface("#{rdoc_method.name}#{rdoc_method.params}")
329
+
330
+ model.returns = [] # RDoc doesn't support specifying return values
331
+ model.file = '/'+rdoc_method.source_code_location.first
332
+ model.line = rdoc_method.source_code_location.last.to_i
333
+ model.source = rdoc_method.source_code_raw
334
+
335
+ if rdoc_method.respond_to?(:c_function)
336
+ model.language = rdoc_method.c_function ? 'c' : 'ruby'
337
+ else
338
+ model.language = 'ruby'
339
+ end
340
+
341
+ @table[model.path] = model.to_h
342
+ end
343
+ end
344
+
345
+ #--
346
+ =begin
347
+ #
348
+ def generate_attributes
349
+ #$stderr.puts "HERE!"
350
+ #$stderr.puts attributes_all.inspect
351
+ #exit
352
+ debug_msg "Generating attributes documentation:"
353
+ attributes_all.each do |rdoc_attribute|
354
+ debug_msg "%s" % [rdoc_attribute.full_name]
355
+
356
+ adapter = Shomen::RDoc::MethodAdapter.new(rdoc_attribute)
357
+ data = Shomen::Model::Method.new(adapter).to_h
358
+
359
+ @table[data['path']] = data
360
+
361
+ #code = m.source_code_raw
362
+ #file, line = m.source_code_location
363
+
364
+ #full_name = method_name(m)
365
+
366
+ #'prettyname' => m.pretty_name,
367
+ #'type' => m.type, # class or instance
368
+
369
+ #model_class = m.singleton ? Shomen::Model::Function : Shomen::Model::Method
370
+ #model_class = Shomen::Model::Attribute
371
+
372
+ #@table[full_name] = model_class.new(
373
+ # 'path' => full_name,
374
+ # 'name' => m.name,
375
+ # 'namespace' => m.parent_name,
376
+ # 'comment' => comment(m.comment),
377
+ # 'access' => m.visibility.to_s,
378
+ # 'rw' => m.rw, # TODO: better name ?
379
+ # 'singleton' => m.singleton,
380
+ # 'aliases' => m.aliases.map{ |a| method_name(a) },
381
+ # 'alias_for' => method_name(m.is_alias_for),
382
+ # 'image' => m.params,
383
+ # 'arguments' => [],
384
+ # 'parameters' => [],
385
+ # 'block' => m.block_params, # TODO: what is block?
386
+ # 'interface' => m.arglists,
387
+ # 'returns' => [],
388
+ # 'file' => file,
389
+ # 'line' => line,
390
+ # 'source' => code
391
+ #).to_h
392
+ end
393
+ end
394
+ =end
395
+ #++
396
+
397
+ # Parse method interface.
398
+ #
399
+ # TODO: remove any trailing comment too
400
+ def parse_interface(interface)
401
+ args, block = [], {}
402
+
403
+ interface, returns = interface.split(/[=-]\>/)
404
+ interface = interface.strip
405
+ if i = interface.index(/\)\s*\{/)
406
+ block['image'] = interface[i+1..-1].strip
407
+ interface = interface[0..i].strip
408
+ end
409
+
410
+ arguments = interface.strip.sub(/^.*?\(/,'').chomp(')')
411
+ arguments = arguments.split(/\s*\,\s*/)
412
+ arguments.each do |a|
413
+ if a.start_with?('&')
414
+ block['name'] = a
415
+ else
416
+ n,v = a.split('=')
417
+ args << (v ? {'name'=>n,'default'=>v} : {'name'=>n})
418
+ end
419
+ end
420
+
421
+ result = {}
422
+ result['signature'] = interface
423
+ result['arguments'] = args
424
+ result['block'] = block unless block.empty?
425
+ result['returns'] = returns.strip if returns
426
+ return result
427
+ end
428
+ private :parse_interface
429
+
430
+ # Generate entries for information files, e.g. `README.rdoc`.
431
+ def generate_documents
432
+ files_toplevel.each do |rdoc_document|
433
+ absolute_path = File.join(path_base, rdoc_document.full_name)
434
+
435
+ model = Shomen::Model::Document.new
436
+
437
+ model.path = rdoc_document.full_name
438
+ model.name = File.basename(absolute_path)
439
+ model.created = File.mtime(absolute_path)
440
+ model.modified = File.mtime(absolute_path)
441
+ model.text = File.read(absolute_path) #comment(file.comment)
442
+ model.format = mime_type(absolute_path)
443
+
444
+ @table['/'+model.path] = model.to_h
445
+ end
446
+ end
447
+
448
+ # TODO: Add loadpath and make file path relative to it?
449
+
450
+ # Generate script entries.
451
+ def generate_scripts
452
+ #debug_msg "Generating file documentation in #{path_output_relative}:"
453
+ #templatefile = self.path_template + 'file.rhtml'
454
+
455
+ files.each do |rdoc_file|
456
+ debug_msg "%s" % [rdoc_file.full_name]
457
+
458
+ absolute_path = File.join(path_base, rdoc_file.full_name)
459
+ #rel_prefix = self.path_output.relative_path_from(outfile.dirname)
460
+
461
+ model = Shomen::Model::Script.new
462
+
463
+ model.path = rdoc_file.full_name
464
+ model.name = File.basename(rdoc_file.full_name)
465
+ model.created = File.ctime(absolute_path)
466
+ model.modified = File.mtime(absolute_path)
467
+
468
+ if options.source
469
+ model.source = File.read(absolute_path) #comment(file.comment)
470
+ model.language = mime_type(absolute_path)
471
+ end
472
+
473
+ webcvs = options.webcvs || project_metadata['webcvs']
474
+ if webcvs
475
+ model.uri = File.join(webcvs, model.path) # TODO: use open-uri ?
476
+ model.language = mime_type(absolute_path)
477
+ end
478
+
479
+ #model.header =
480
+ #model.footer =
481
+ model.requires = rdoc_file.requires.map{ |r| r.name }
482
+ model.constants = rdoc_file.constants.map{ |c| c.full_name }
483
+
484
+ # note that this utilizes the table we are building
485
+ # so it needs to be the last thing done.
486
+ @table.each do |k, h|
487
+ case h['!']
488
+ when 'module'
489
+ model.modules ||= []
490
+ model.modules << k if h['files'].include?(rdoc_file.full_name)
491
+ when 'class'
492
+ model.classes ||= []
493
+ model.classes << k if h['files'].include?(rdoc_file.full_name)
494
+ when 'method'
495
+ model.methods ||= []
496
+ model.methods << k if h['file'] == rdoc_file.full_name
497
+ when 'class-method'
498
+ model.class_methods ||= []
499
+ model.class_methods << k if h['file'] == rdoc_file.full_name
500
+ end
501
+ end
502
+
503
+ @table['/'+model.path] = model.to_h
504
+ end
505
+ end
506
+
507
+ # Returns String of fully qualified name.
508
+ def complete_name(name, namespace)
509
+ if name !~ /^#{namespace}/
510
+ "#{namespace}::#{name}"
511
+ else
512
+ name
513
+ end
514
+ end
515
+
516
+ #
517
+ def collect_methods(class_module, singleton=false)
518
+ list = []
519
+ class_module.method_list.each do |m|
520
+ next if singleton ^ m.singleton
521
+ list << method_name(m)
522
+ end
523
+ list.uniq
524
+ end
525
+
526
+ #
527
+ def collect_attributes(class_module, singleton=false)
528
+ list = []
529
+ class_module.attributes.each do |a|
530
+ next if singleton ^ a.singleton
531
+ #p a.rw
532
+ #case a.rw
533
+ #when :write, 'W'
534
+ # list << "#{method_name(a)}="
535
+ #else
536
+ list << method_name(a)
537
+ #end
538
+ end
539
+ list.uniq
540
+ end
541
+
542
+ #
543
+ def method_name(method)
544
+ return nil if method.nil?
545
+ if method.singleton
546
+ i = method.full_name.rindex('::')
547
+ method.full_name[0...i] + '.' + method.full_name[i+2..-1]
548
+ else
549
+ method.full_name
550
+ end
551
+ end
552
+
553
+ #
554
+ def mime_type(path)
555
+ case File.extname(path)
556
+ when '.rb', '.rbx' then 'text/ruby'
557
+ when '.c' then 'text/c-source'
558
+ when '.rdoc' then 'text/rdoc'
559
+ when '.md', '.markdown' then 'text/markdown'
560
+ else 'text/plain'
561
+ end
562
+ end
563
+
564
+ # Output progress information if rdoc debugging is enabled
565
+
566
+ def debug_msg(msg)
567
+ return unless $DEBUG_RDOC
568
+ case msg[-1,1]
569
+ when '.' then tab = "= "
570
+ when ':' then tab = "== "
571
+ else tab = "* "
572
+ end
573
+ $stderr.puts(tab + msg)
574
+ end
575
+
576
+ #
577
+ def comment(rdoc_comment)
578
+ case rdoc_comment
579
+ when String
580
+ "" # something is wrong if this is a string
581
+ else
582
+ rdoc_comment.text
583
+ end
584
+ end
585
+
586
+ end
587
+
588
+
589
+
590
+ #--
591
+ =begin
592
+ #
593
+ # N O T U S E D
594
+ #
595
+
596
+ # Sort based on how often the top level namespace occurs, and then on the
597
+ # name of the module -- this works for projects that put their stuff into
598
+ # a namespace, of course, but doesn't hurt if they don't.
599
+ def sort_salient(classes)
600
+ nscounts = classes.inject({}) do |counthash, klass|
601
+ top_level = klass.full_name.gsub( /::.*/, '' )
602
+ counthash[top_level] ||= 0
603
+ counthash[top_level] += 1
604
+ counthash
605
+ endfiles_toplevel
606
+ classes.sort_by{ |klass|
607
+ top_level = klass.full_name.gsub( /::.*/, '' )
608
+ [nscounts[top_level] * -1, klass.full_name]
609
+ }.select{ |klass|
610
+ klass.document_self
611
+ }
612
+ end
613
+ =end
614
+
615
+ =begin
616
+ # Loop through table and convert all named references into bonofied object
617
+ # references.
618
+ def reference_table(table)
619
+ debug_msg "== Generating Reference Table"
620
+ new_table = {}
621
+ table.each do |key, entry|
622
+ debug_msg "%s" % [key]
623
+ data = entry.dup
624
+ new_table[key] = data
625
+ case data['!']
626
+ when 'script'
627
+ data["constants"] = ref_list(data["constants"])
628
+ data["modules"] = ref_list(data["modules"])
629
+ data["classes"] = ref_list(data["classes"])
630
+ data["functions"] = ref_list(data["functions"])
631
+ data["methods"] = ref_list(data["methods"])
632
+ when 'file'
633
+ when 'constant'
634
+ data["namespace"] = ref_item(data["namespace"])
635
+ when 'module', 'class'
636
+ data["namespace"] = ref_item(data["namespace"])
637
+ data["includes"] = ref_list(data["includes"])
638
+ #data["extended"] = ref_list(data["extended"])
639
+ data["constants"] = ref_list(data["constants"])
640
+ data["modules"] = ref_list(data["modules"])
641
+ data["classes"] = ref_list(data["classes"])
642
+ data["functions"] = ref_list(data["functions"])
643
+ data["methods"] = ref_list(data["methods"])
644
+ data["files"] = ref_list(data["files"])
645
+ data["superclass"] = ref_item(data["superclass"]) if data.key?("superclass")
646
+ when 'method', 'function'
647
+ data["namespace"] = ref_item(data["namespace"])
648
+ data["file"] = ref_item(data["file"])
649
+ end
650
+ end
651
+ new_table
652
+ end
653
+
654
+ # Given a key, return the matching table item. If not found return the key.
655
+ def ref_item(key)
656
+ @table[key] || key
657
+ end
658
+
659
+ # Given a list of keys, return the matching table items.
660
+ def ref_list(keys)
661
+ #keys.map{ |k| @table[k] || k }
662
+ keys.map{ |k| @table[k] || nil }.compact
663
+ end
664
+
665
+ =end
666
+ #++
667
+
@@ -0,0 +1,154 @@
1
+ class RDoc::Options
2
+ # true/false to include full source
3
+ attr_accessor :source
4
+ # true/false to use YAML instead of JSON
5
+ attr_accessor :yaml
6
+ end
7
+
8
+ class RDoc::TopLevel
9
+ #
10
+ def to_h
11
+ {
12
+ :path => path,
13
+ :name => base_name,
14
+ :fullname => full_name,
15
+ :rootname => absolute_name,
16
+ :modified => last_modified,
17
+ :diagram => diagram
18
+ }
19
+ end
20
+
21
+ #
22
+ #def to_json
23
+ # to_h.to_json
24
+ #end
25
+ end
26
+
27
+
28
+ class RDoc::ClassModule
29
+ #
30
+ def with_documentation?
31
+ document_self_or_methods || classes_and_modules.any?{ |c| c.with_documentation? }
32
+ end
33
+
34
+ #
35
+ def document_self_or_methods
36
+ document_self || method_list.any?{ |m| m.document_self }
37
+ end
38
+
39
+ # #
40
+ # def to_h
41
+ # {
42
+ # :name => name,
43
+ # :fullname => full_name,
44
+ # :type => type,
45
+ # :path => path,
46
+ # :superclass => module? ? nil : superclass
47
+ # }
48
+ # end
49
+ #
50
+ # def to_json
51
+ # to_h.to_json
52
+ # end
53
+ end
54
+
55
+
56
+ module RDoc::SourceCodeAccess
57
+
58
+ #
59
+ def source_code_raw
60
+ return '' unless @token_stream
61
+ src = ""
62
+ @token_stream.each do |t|
63
+ next unless t
64
+ src << t.text
65
+ end
66
+ #add_line_numbers(src)
67
+ src
68
+ end
69
+
70
+ #
71
+ def source_code_location
72
+ src = source_code_raw
73
+ if md = /File (.*?), line (\d+)/.match(src)
74
+ file = md[1]
75
+ line = md[2]
76
+ else
77
+ file = "(unknown)"
78
+ line = 0
79
+ end
80
+ return file, line
81
+ end
82
+
83
+ end
84
+
85
+
86
+ class RDoc::AnyMethod
87
+ include RDoc::SourceCodeAccess
88
+
89
+ # # NOTE: dont_rename_initialize isn't used
90
+ # def to_h
91
+ # {
92
+ # :name => name,
93
+ # :fullname => full_name,
94
+ # :prettyname => pretty_name,
95
+ # :path => path,
96
+ # :type => type,
97
+ # :visibility => visibility,
98
+ # :blockparams => block_params,
99
+ # :singleton => singleton,
100
+ # :text => text,
101
+ # :aliases => aliases,
102
+ # :aliasfor => is_alias_for,
103
+ # :aref => aref,
104
+ # :parms => params,
105
+ # :callseq => call_seq
106
+ # #:paramseq => param_seq,
107
+ # }
108
+ # end
109
+
110
+ # #
111
+ # def to_json
112
+ # to_h.to_json
113
+ # end
114
+ end
115
+
116
+ class RDoc::Attr
117
+ include RDoc::SourceCodeAccess
118
+ end
119
+
120
+ =begin
121
+
122
+ # DEPRECATE ASAP
123
+ require "rdoc/parser/c"
124
+ # New RDoc somehow misses class comemnts.
125
+ # copyied this function from "2.2.2"
126
+ if ['2.4.2', '2.4.3'].include? RDoc::VERSION
127
+ class RDoc::Parser::C
128
+ def find_class_comment(class_name, class_meth)
129
+ comment = nil
130
+ if @content =~ %r{((?>/\*.*?\*/\s+))
131
+ (static\s+)?void\s+Init_#{class_name}\s*(?:_\(\s*)?\(\s*(?:void\s*)\)}xmi then
132
+ comment = $1
133
+ elsif @content =~ %r{Document-(?:class|module):\s#{class_name}\s*?(?:<\s+[:,\w]+)?\n((?>.*?\*/))}m
134
+ comment = $1
135
+ else
136
+ if @content =~ /rb_define_(class|module)/m then
137
+ class_name = class_name.split("::").last
138
+ comments = []
139
+ @content.split(/(\/\*.*?\*\/)\s*?\n/m).each_with_index do |chunk, index|
140
+ comments[index] = chunk
141
+ if chunk =~ /rb_define_(class|module).*?"(#{class_name})"/m then
142
+ comment = comments[index-1]
143
+ break
144
+ end
145
+ end
146
+ end
147
+ end
148
+ class_meth.comment = mangle_comment(comment) if comment
149
+ end
150
+ end
151
+ end
152
+
153
+ =end
154
+
@@ -0,0 +1,20 @@
1
+ require 'citron'
2
+ require 'brass'
3
+ require 'json'
4
+
5
+ testcase "Document conforms to specificaiton" do
6
+
7
+ # IMPORTANT! For now we need to hand create this document.
8
+ FIXTURE_DOCUMENT = 'test/fixture/doc/doc.json'
9
+
10
+ def initialize(*a,&b)
11
+ super(*a,&b)
12
+
13
+ @doc = JSON.load(File.new(FIXTURE_DOCUMENT))
14
+ end
15
+
16
+ test "(metadata)" do
17
+ assert @doc['(metadata)']
18
+ end
19
+
20
+ end
@@ -0,0 +1 @@
1
+ {"(metadata)":{"source":["meta"],"authors":[{"name":"trans","email":"transfire@gmail.com"}],"copyrights":[],"requirements":[{"name":"rdoc","version":"3+"},{"name":"qed","groups":["test"],"development":true},{"name":"ae","groups":["test"],"development":true},{"name":"detroit","groups":["build"],"development":true},{"name":"reap","groups":["build"],"development":true}],"dependencies":[],"alternatives":[],"conflicts":[],"repositories":[{"uri":"git://github.com/rubyworks/rdoc-shomen.git","scm":"git","name":"upstream"}],"resources":{"home":"http://rubyworks.github.com/rdoc-shomen","docs":"http://rubydoc.info/gems/rdoc-shoment","code":"http://github.com/rubyworks/rdoc-shomen","bugs":"http://github.com/rubyworks/rdoc-shomen/issues","mail":"http://groups.google.com/groups/rubyworks-mailinglist"},"extra":{},"load_path":["lib"],"revision":0,"created":"2010-07-01","summary":"RDoc Generator for Shomen Documentation Format","title":"RDoc Shomen","version":"0.1.0","name":"rdoc-shomen","description":"RDoc-Shomen is an RDoc generator plugin that can be used to generate Shomen\ndocumentation. This is an alternative to the shomen command line tool which\nuse the `.rdoc` cache to generate a shomen document. In contrast the rdoc-shomen\ngenerator operates as a traditional rdoc plugin.","organization":"rubyworks","date":"2012-03-31","path":"(metadata)","markup":"rdoc"},"RDoc::Generator::Shomen::DESCRIPTION":{"!":"constant","path":"RDoc::Generator::Shomen::DESCRIPTION","name":"DESCRIPTION","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","value":"'Shomen documentation format'","files":["/lib/rdoc/generator/shomen.rb"]},"RDoc":{"!":"module","path":"RDoc","name":"RDoc","namespace":"","includes":[],"extensions":[],"comment":"","format":"rdoc","constants":[],"modules":["RDoc::SourceCodeAccess","RDoc::Generator"],"classes":["RDoc::Options","RDoc::TopLevel","RDoc::ClassModule","RDoc::AnyMethod","RDoc::Attr"],"methods":[],"accessors":[],"files":[]},"RDoc::AnyMethod":{"!":"class","path":"RDoc::AnyMethod","name":"AnyMethod","namespace":"RDoc","includes":["RDoc::SourceCodeAccess"],"extensions":[],"comment":"#<RDoc::Comment:0x00000002e56120>","format":"rdoc","constants":[],"modules":[],"classes":[],"methods":[],"accessors":[],"files":["/lib/rdoc/generator/shomen_extensions.rb"],"superclass":"Object"},"RDoc::Attr":{"!":"class","path":"RDoc::Attr","name":"Attr","namespace":"RDoc","includes":["RDoc::SourceCodeAccess"],"extensions":[],"comment":"#<RDoc::Comment:0x00000002dd7898>","format":"rdoc","constants":[],"modules":[],"classes":[],"methods":[],"accessors":[],"files":["/lib/rdoc/generator/shomen_extensions.rb"],"superclass":"Object"},"RDoc::ClassModule":{"!":"class","path":"RDoc::ClassModule","name":"ClassModule","namespace":"RDoc","includes":[],"extensions":[],"comment":"#<RDoc::Comment:0x00000002fb7168>","format":"rdoc","constants":[],"modules":[],"classes":[],"methods":["RDoc::ClassModule#with_documentation?","RDoc::ClassModule#document_self_or_methods"],"accessors":[],"files":["/lib/rdoc/generator/shomen_extensions.rb"],"superclass":"Object"},"RDoc::Generator":{"!":"module","path":"RDoc::Generator","name":"Generator","namespace":"RDoc","includes":[],"extensions":[],"comment":"","format":"rdoc","constants":[],"modules":[],"classes":["RDoc::Generator::Shomen"],"methods":[],"accessors":[],"files":[]},"RDoc::Generator::Shomen":{"!":"class","path":"RDoc::Generator::Shomen","name":"Shomen","namespace":"RDoc::Generator","includes":[],"extensions":[],"comment":"#<RDoc::Comment:0x00000002a01d40>","format":"rdoc","constants":["RDoc::Generator::Shomen::DESCRIPTION"],"modules":[],"classes":[],"methods":["RDoc::Generator::Shomen.for","RDoc::Generator::Shomen.setup_options","RDoc::Generator::Shomen#classes","RDoc::Generator::Shomen#classes_toplevel","RDoc::Generator::Shomen#files","RDoc::Generator::Shomen#files_toplevel","RDoc::Generator::Shomen#files_hash","RDoc::Generator::Shomen#methods_all","RDoc::Generator::Shomen#attributes_all","RDoc::Generator::Shomen#constants_all","RDoc::Generator::Shomen#class_dir","RDoc::Generator::Shomen#file_dir","RDoc::Generator::Shomen#shomen","RDoc::Generator::Shomen#generate","RDoc::Generator::Shomen#output_file","RDoc::Generator::Shomen.new","RDoc::Generator::Shomen#path_output_relative","RDoc::Generator::Shomen#project_metadata","RDoc::Generator::Shomen#generate_metadata","RDoc::Generator::Shomen#generate_constants","RDoc::Generator::Shomen#generate_classes","RDoc::Generator::Shomen#generate_methods","RDoc::Generator::Shomen#generate_documents","RDoc::Generator::Shomen#generate_scripts","RDoc::Generator::Shomen#complete_name","RDoc::Generator::Shomen#collect_methods","RDoc::Generator::Shomen#collect_attributes","RDoc::Generator::Shomen#method_name","RDoc::Generator::Shomen#mime_type","RDoc::Generator::Shomen#debug_msg"],"accessors":["RDoc::Generator::Shomen#options","RDoc::Generator::Shomen#path_base","RDoc::Generator::Shomen#path_output"],"files":["/lib/rdoc/generator/shomen.rb"],"superclass":"Object"},"RDoc::Options":{"!":"class","path":"RDoc::Options","name":"Options","namespace":"RDoc","includes":[],"extensions":[],"comment":"#<RDoc::Comment:0x000000030d3600>","format":"rdoc","constants":[],"modules":[],"classes":[],"methods":[],"accessors":["RDoc::Options#source","RDoc::Options#yaml"],"files":["/lib/rdoc/generator/shomen_extensions.rb"],"superclass":"Object"},"RDoc::SourceCodeAccess":{"!":"module","path":"RDoc::SourceCodeAccess","name":"SourceCodeAccess","namespace":"RDoc","includes":[],"extensions":[],"comment":"#<RDoc::Comment:0x00000002f26a78>","format":"rdoc","constants":[],"modules":[],"classes":[],"methods":["RDoc::SourceCodeAccess#source_code_raw","RDoc::SourceCodeAccess#source_code_location"],"accessors":[],"files":["/lib/rdoc/generator/shomen_extensions.rb"]},"RDoc::TopLevel":{"!":"class","path":"RDoc::TopLevel","name":"TopLevel","namespace":"RDoc","includes":[],"extensions":[],"comment":"#<RDoc::Comment:0x00000003066c30>","format":"rdoc","constants":[],"modules":[],"classes":[],"methods":["RDoc::TopLevel#to_h"],"accessors":[],"files":["/lib/rdoc/generator/shomen_extensions.rb"],"superclass":"Object"},"RDoc::Generator::Shomen.for":{"!":"method","declarations":["class","public"],"path":"RDoc::Generator::Shomen.for","name":"for","namespace":"RDoc::Generator::Shomen","comment":"Standard generator factory method.\n\noptions - Generator options.\n\nReturns new RDoc::Generator::Shomen instance.","format":"rdoc","aliases":[],"alias_for":null,"singleton":true,"interfaces":[{"signature":"for(options)","arguments":[{"name":"options"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":36,"source":"# File lib/rdoc/generator/shomen.rb, line 36\n def self.for(options)\n new(options)\n end","language":"ruby"},"RDoc::Generator::Shomen.new":{"!":"method","declarations":["class","public"],"path":"RDoc::Generator::Shomen.new","name":"new","namespace":"RDoc::Generator::Shomen","comment":"Initialize new generator.\n\noptions - Generator options.\n\nReturns new RDoc::Generator::Shomen instance.","format":"rdoc","aliases":[],"alias_for":null,"singleton":true,"interfaces":[{"signature":"new(options)","arguments":[{"name":"options"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":192,"source":"# File lib/rdoc/generator/shomen.rb, line 192\n def initialize(options)\n @options = options\n #@options.diagram = false # why?\n\n @path_base = Pathname.pwd.expand_path\n\n # TODO: This is probably not needed any more.\n @path_output = Pathname.new(@options.op_dir).expand_path(@path_base)\n end","language":"ruby"},"RDoc::Generator::Shomen.setup_options":{"!":"method","declarations":["class","public"],"path":"RDoc::Generator::Shomen.setup_options","name":"setup_options","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":true,"interfaces":[{"signature":"setup_options(options)","arguments":[{"name":"options"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":44,"source":"# File lib/rdoc/generator/shomen.rb, line 44\n def self.setup_options(options)\n options.source = false\n options.yaml = false\n\n opt = options.option_parser\n\n opt.separator nil\n opt.separator \"Shomen generator options:\"\n opt.separator nil\n opt.on(\"--yaml\", \"Generate YAML document instead of JSON.\") do |value|\n options.yaml = true\n end\n opt.separator nil\n opt.on(\"--source\", \"Include full source code for scripts.\") do |value|\n options.github = true\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#attributes_all":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#attributes_all","name":"attributes_all","namespace":"RDoc::Generator::Shomen","comment":"List of all attributes in all classes and modules.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"attributes_all()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":105,"source":"# File lib/rdoc/generator/shomen.rb, line 105\n def attributes_all\n @attributes_all ||= classes.map{ |m| m.attributes }.flatten.sort\n end","language":"ruby"},"RDoc::Generator::Shomen#class_dir":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#class_dir","name":"class_dir","namespace":"RDoc::Generator::Shomen","comment":"RDoc needs this to function.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"class_dir()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":120,"source":"# File lib/rdoc/generator/shomen.rb, line 120\n def class_dir ; nil ; end","language":"ruby"},"RDoc::Generator::Shomen#classes":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#classes","name":"classes","namespace":"RDoc::Generator::Shomen","comment":"In the world of the RDoc Generators #classes is the same\nas #all_classes_and_modules. Well, except that its sorted \ntoo. For classes sans modules, see #types.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"classes()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":71,"source":"# File lib/rdoc/generator/shomen.rb, line 71\n def classes\n @classes ||= RDoc::TopLevel.all_classes_and_modules.sort\n end","language":"ruby"},"RDoc::Generator::Shomen#classes_toplevel":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#classes_toplevel","name":"classes_toplevel","namespace":"RDoc::Generator::Shomen","comment":"Only toplevel classes and modules.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"classes_toplevel()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":76,"source":"# File lib/rdoc/generator/shomen.rb, line 76\n def classes_toplevel\n @classes_toplevel ||= classes.select {|klass| !(RDoc::ClassModule === klass.parent) }\n end","language":"ruby"},"RDoc::Generator::Shomen#collect_attributes":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#collect_attributes","name":"collect_attributes","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"collect_attributes(class_module, singleton=false)","arguments":[{"name":"class_module"},{"name":"singleton","default":"false"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":532,"source":"# File lib/rdoc/generator/shomen.rb, line 532\n def collect_attributes(class_module, singleton=false)\n list = []\n class_module.attributes.each do |a|\n next if singleton ^ a.singleton\n #p a.rw\n #case a.rw\n #when :write, 'W'\n # list << \"#{method_name(a)}=\"\n #else\n list << method_name(a)\n #end\n end\n list.uniq\n end","language":"ruby"},"RDoc::Generator::Shomen#collect_methods":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#collect_methods","name":"collect_methods","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"collect_methods(class_module, singleton=false)","arguments":[{"name":"class_module"},{"name":"singleton","default":"false"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":522,"source":"# File lib/rdoc/generator/shomen.rb, line 522\n def collect_methods(class_module, singleton=false)\n list = []\n class_module.method_list.each do |m|\n next if singleton ^ m.singleton\n list << method_name(m)\n end\n list.uniq\n end","language":"ruby"},"RDoc::Generator::Shomen#complete_name":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#complete_name","name":"complete_name","namespace":"RDoc::Generator::Shomen","comment":"Returns String of fully qualified name.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"complete_name(name, namespace)","arguments":[{"name":"name"},{"name":"namespace"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":513,"source":"# File lib/rdoc/generator/shomen.rb, line 513\n def complete_name(name, namespace)\n if name !~ %r^#{namespace}/\n \"#{namespace}::#{name}\"\n else\n name\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#constants_all":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#constants_all","name":"constants_all","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"constants_all()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":110,"source":"# File lib/rdoc/generator/shomen.rb, line 110\n def constants_all\n @constants_all ||= classes.map{ |c| c.constants }.flatten\n end","language":"ruby"},"RDoc::Generator::Shomen#debug_msg":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#debug_msg","name":"debug_msg","namespace":"RDoc::Generator::Shomen","comment":"Output progress information if rdoc debugging is enabled","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"debug_msg(msg)","arguments":[{"name":"msg"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":571,"source":"# File lib/rdoc/generator/shomen.rb, line 571\n def debug_msg(msg)\n return unless $DEBUG_RDOC\n case msg[-1,1]\n when '.' then tab = \"= \"\n when ':' then tab = \"== \"\n else tab = \"* \"\n end\n $stderr.puts(tab + msg)\n end","language":"ruby"},"RDoc::ClassModule#document_self_or_methods":{"!":"method","declarations":["instance","public"],"path":"RDoc::ClassModule#document_self_or_methods","name":"document_self_or_methods","namespace":"RDoc::ClassModule","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"document_self_or_methods()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen_extensions.rb","line":35,"source":"# File lib/rdoc/generator/shomen_extensions.rb, line 35\n def document_self_or_methods\n document_self || method_list.any?{ |m| m.document_self }\n end","language":"ruby"},"RDoc::Generator::Shomen#file_dir":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#file_dir","name":"file_dir","namespace":"RDoc::Generator::Shomen","comment":"RDoc needs this to function.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"file_dir()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":123,"source":"# File lib/rdoc/generator/shomen.rb, line 123\n def file_dir ; nil ; end","language":"ruby"},"RDoc::Generator::Shomen#files":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#files","name":"files","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"files()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":81,"source":"# File lib/rdoc/generator/shomen.rb, line 81\n def files\n @files ||= (\n @files_rdoc.select{ |f| f.parser != RDoc::Parser::Simple }\n )\n end","language":"ruby"},"RDoc::Generator::Shomen#files_hash":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#files_hash","name":"files_hash","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"files_hash()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":95,"source":"# File lib/rdoc/generator/shomen.rb, line 95\n def files_hash\n @files ||= RDoc::TopLevel.files_hash\n end","language":"ruby"},"RDoc::Generator::Shomen#files_toplevel":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#files_toplevel","name":"files_toplevel","namespace":"RDoc::Generator::Shomen","comment":"List of toplevel files. RDoc supplies this via the #generate method.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"files_toplevel()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":88,"source":"# File lib/rdoc/generator/shomen.rb, line 88\n def files_toplevel\n @files_toplevel ||= (\n @files_rdoc.select{ |f| f.parser == RDoc::Parser::Simple }\n )\n end","language":"ruby"},"RDoc::Generator::Shomen#generate":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#generate","name":"generate","namespace":"RDoc::Generator::Shomen","comment":"Build the initial indices and output objects based on an array of\ntop level objects containing the extracted information.\n\nfiles - Files to document.\n\nReturns nothing.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"generate(files)","arguments":[{"name":"files"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":136,"source":"# File lib/rdoc/generator/shomen.rb, line 136\n def generate(files)\n @files_rdoc = files.sort\n\n @table = {}\n\n generate_metadata\n generate_constants\n generate_classes\n #generate_attributes\n generate_methods\n generate_documents\n generate_scripts # must be last b/c it depends on the others\n\n # TODO: method accessor fields need to be handled\n\n # THINK: Internal referencing model, YAML and JSYNC ?\n #ref_table = reference_table(@table)\n\n if options.yaml\n out = @table.to_yaml\n else\n out = JSON.generate(@table)\n end\n\n if options.op_dir == '-'\n puts out\n else\n File.open(output_file, 'w') do |f|\n f << out\n end unless $dryrun\n end\n\n #rescue StandardError => err\n # debug_msg \"%s: %s\\n %s\" % [ err.class.name, err.message, err.backtrace.join(\"\\n \") ]\n # raise err\n end","language":"ruby"},"RDoc::Generator::Shomen#generate_classes":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#generate_classes","name":"generate_classes","namespace":"RDoc::Generator::Shomen","comment":"Add classes (and modules) to table.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"generate_classes()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":246,"source":"# File lib/rdoc/generator/shomen.rb, line 246\n def generate_classes\n debug_msg \"Generating class/module documentation:\"\n\n classes.each do |rdoc_class|\n debug_msg \"%s (%s)\" % [ rdoc_class.full_name, rdoc_class.path ]\n\n if rdoc_class.type=='class'\n model = Shomen::Model::Class.new\n else\n model = Shomen::Model::Module.new\n end\n\n model.path = rdoc_class.full_name\n model.name = rdoc_class.name\n model.namespace = rdoc_class.full_name.split('::')[0...-1].join('::')\n model.includes = rdoc_class.includes.map{ |x| x.name } # FIXME: How to \"lookup\" full name?\n model.extensions = [] # TODO: How to get extensions?\n model.comment = rdoc_class.comment.to_s #text\n model.format = 'rdoc'\n model.constants = rdoc_class.constants.map{ |x| complete_name(x.name, rdoc_class.full_name) }\n model.modules = rdoc_class.modules.map{ |x| complete_name(x.name, rdoc_class.full_name) }\n model.classes = rdoc_class.classes.map{ |x| complete_name(x.name, rdoc_class.full_name) }\n model.methods = rdoc_class.method_list.map{ |m| method_name(m) }.uniq\n model.accessors = rdoc_class.attributes.map{ |a| method_name(a) }.uniq #+ \":#{a.rw}\" }.uniq\n model.files = rdoc_class.in_files.map{ |x| \"/#{x.full_name}\" }\n\n if rdoc_class.type == 'class'\n # HACK: No idea why RDoc is returning some weird superclass:\n # <RDoc::NormalClass:0xd924d4 class Object < BasicObject includes: []\n # attributes: [] methods: [#<RDoc::AnyMethod:0xd92b8c Object#fileutils\n # (public)>] aliases: []>\n # Maybe it has something to do with #fileutils?\n model.superclass = (\n case rdoc_class.superclass\n when nil\n when String\n rdoc_class.superclass\n else\n rdoc_class.superclass.full_name\n end\n )\n end\n\n @table[model.path] = model.to_h\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#generate_constants":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#generate_constants","name":"generate_constants","namespace":"RDoc::Generator::Shomen","comment":"Add constants to table.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"generate_constants()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":228,"source":"# File lib/rdoc/generator/shomen.rb, line 228\n def generate_constants\n debug_msg \"Generating constant documentation:\"\n constants_all.each do |rdoc|\n model = Shomen::Model::Constant.new\n\n model.path = rdoc.parent.full_name + '::' + rdoc.name\n model.name = rdoc.name\n model.namespace = rdoc.parent.full_name\n model.comment = rdoc.comment.text\n model.format = 'rdoc'\n model.value = rdoc.value\n model.files = [\"/#{rdoc.file.full_name}\"]\n\n @table[model.path] = model.to_h\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#generate_documents":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#generate_documents","name":"generate_documents","namespace":"RDoc::Generator::Shomen","comment":"Generate entries for information files, e.g. `README.rdoc`.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"generate_documents()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":432,"source":"# File lib/rdoc/generator/shomen.rb, line 432\n def generate_documents\n files_toplevel.each do |rdoc_document|\n absolute_path = File.join(path_base, rdoc_document.full_name)\n\n model = Shomen::Model::Document.new\n\n model.path = rdoc_document.full_name\n model.name = File.basename(absolute_path)\n model.created = File.mtime(absolute_path)\n model.modified = File.mtime(absolute_path)\n model.text = File.read(absolute_path) #file.comment\n model.format = mime_type(absolute_path)\n\n @table['/'+model.path] = model.to_h\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#generate_metadata":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#generate_metadata","name":"generate_metadata","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"generate_metadata()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":223,"source":"# File lib/rdoc/generator/shomen.rb, line 223\n def generate_metadata\n @table['(metadata)'] = project_metadata.to_h\n end","language":"ruby"},"RDoc::Generator::Shomen#generate_methods":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#generate_methods","name":"generate_methods","namespace":"RDoc::Generator::Shomen","comment":"Transform RDoc methods to Shomen model and add to table.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"generate_methods()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":296,"source":"# File lib/rdoc/generator/shomen.rb, line 296\n def generate_methods\n debug_msg \"Generating method documentation:\"\n\n list = methods_all + attributes_all\n\n list.each do |rdoc_method|\n #debug_msg \"%s\" % [rdoc_method.full_name]\n\n #full_name = method_name(m)\n #'prettyname' => m.pretty_name,\n #'type' => m.type, # class or instance\n\n model = Shomen::Model::Method.new\n\n model.path = method_name(rdoc_method)\n model.name = rdoc_method.name\n model.namespace = rdoc_method.parent_name\n model.comment = rdoc_method.comment.text\n model.format = 'rdoc'\n model.aliases = rdoc_method.aliases.map{ |a| method_name(a) }\n model.alias_for = method_name(rdoc_method.is_alias_for)\n model.singleton = rdoc_method.singleton\n\n model.declarations << rdoc_method.type.to_s #singleton ? 'class' : 'instance'\n model.declarations << rdoc_method.visibility.to_s\n\n model.interfaces = []\n if rdoc_method.call_seq\n rdoc_method.call_seq.split(\"\\n\").each do |cs|\n cs = cs.to_s.strip\n model.interfaces << parse_interface(cs) unless cs == ''\n end\n end\n model.interfaces << parse_interface(\"#{rdoc_method.name}#{rdoc_method.params}\")\n\n model.returns = [] # RDoc doesn't support specifying return values\n model.file = '/'+rdoc_method.source_code_location.first\n model.line = rdoc_method.source_code_location.last.to_i\n model.source = rdoc_method.source_code_raw\n\n if rdoc_method.respond_to?(:c_function)\n model.language = rdoc_method.c_function ? 'c' : 'ruby'\n else\n model.language = 'ruby'\n end\n\n @table[model.path] = model.to_h\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#generate_scripts":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#generate_scripts","name":"generate_scripts","namespace":"RDoc::Generator::Shomen","comment":"Generate script entries.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"generate_scripts()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":452,"source":"# File lib/rdoc/generator/shomen.rb, line 452\n def generate_scripts\n #debug_msg \"Generating file documentation in #{path_output_relative}:\"\n #templatefile = self.path_template + 'file.rhtml'\n\n files.each do |rdoc_file|\n debug_msg \"%s\" % [rdoc_file.full_name]\n\n absolute_path = File.join(path_base, rdoc_file.full_name)\n #rel_prefix = self.path_output.relative_path_from(outfile.dirname)\n\n model = Shomen::Model::Script.new\n\n model.path = rdoc_file.full_name\n model.name = File.basename(rdoc_file.full_name)\n model.created = File.ctime(absolute_path)\n model.modified = File.mtime(absolute_path)\n\n # http://github.com/rubyworks/qed/blob/master/ lib/qed.rb\n\n # TODO: Add option to rdoc command line tool instead of using ENV.\n\n if ENV['source']\n model.source = File.read(absolute_path) #file.comment\n model.language = mime_type(absolute_path)\n end\n\n webcvs = options.webcvs || project_metadata['webcvs']\n if webcvs\n model.uri = File.join(webcvs, model.path) # TODO: use open-uri ?\n model.language = mime_type(absolute_path)\n end\n\n #model.header =\n #model.footer =\n model.requires = rdoc_file.requires.map{ |r| r.name }\n model.constants = rdoc_file.constants.map{ |c| c.full_name }\n\n # note that this utilizes the table we are building\n # so it needs to be the last thing done.\n @table.each do |k, h|\n case h['!']\n when 'module'\n model.modules ||= []\n model.modules << k if h['files'].include?(rdoc_file.full_name)\n when 'class'\n model.classes ||= []\n model.classes << k if h['files'].include?(rdoc_file.full_name)\n when 'method'\n model.methods ||= []\n model.methods << k if h['file'] == rdoc_file.full_name\n when 'class-method'\n model.class_methods ||= []\n model.class_methods << k if h['file'] == rdoc_file.full_name\n end\n end\n\n @table['/'+model.path] = model.to_h\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#method_name":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#method_name","name":"method_name","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"method_name(method)","arguments":[{"name":"method"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":548,"source":"# File lib/rdoc/generator/shomen.rb, line 548\n def method_name(method)\n return nil if method.nil?\n if method.singleton\n i = method.full_name.rindex('::') \n method.full_name[0...i] + '.' + method.full_name[i+2..-1]\n else\n method.full_name\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#methods_all":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#methods_all","name":"methods_all","namespace":"RDoc::Generator::Shomen","comment":"List of all methods in all classes and modules.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"methods_all()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":100,"source":"# File lib/rdoc/generator/shomen.rb, line 100\n def methods_all\n @methods_all ||= classes.map{ |m| m.method_list }.flatten.sort\n end","language":"ruby"},"RDoc::Generator::Shomen#mime_type":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#mime_type","name":"mime_type","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"mime_type(path)","arguments":[{"name":"path"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":559,"source":"# File lib/rdoc/generator/shomen.rb, line 559\n def mime_type(path)\n case File.extname(path)\n when '.rb', '.rbx' then 'text/ruby'\n when '.c' then 'text/c-source'\n when '.rdoc' then 'text/rdoc'\n when '.md', '.markdown' then 'text/markdown'\n else 'text/plain'\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#output_file":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#output_file","name":"output_file","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"output_file()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":174,"source":"# File lib/rdoc/generator/shomen.rb, line 174\n def output_file\n name = project_metadata['name']\n vers = project_metadata['version']\n\n if name && vers\n \"#{name}-#{vers}.json\"\n else\n 'doc.json'\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#path_output_relative":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#path_output_relative","name":"path_output_relative","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"path_output_relative(path=nil)","arguments":[{"name":"path","default":"nil"}]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":209,"source":"# File lib/rdoc/generator/shomen.rb, line 209\n def path_output_relative(path=nil)\n if path\n path.to_s.sub(path_base.to_s+'/', '')\n else\n @path_output_relative ||= path_output.to_s.sub(path_base.to_s+'/', '')\n end\n end","language":"ruby"},"RDoc::Generator::Shomen#project_metadata":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#project_metadata","name":"project_metadata","namespace":"RDoc::Generator::Shomen","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"project_metadata()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":218,"source":"# File lib/rdoc/generator/shomen.rb, line 218\n def project_metadata\n @project_metadata ||= Shomen::Metadata.new\n end","language":"ruby"},"RDoc::Generator::Shomen#shomen":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#shomen","name":"shomen","namespace":"RDoc::Generator::Shomen","comment":"TODO: Rename ?","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"shomen()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen.rb","line":126,"source":"# File lib/rdoc/generator/shomen.rb, line 126\n def shomen\n @table || {}\n end","language":"ruby"},"RDoc::SourceCodeAccess#source_code_location":{"!":"method","declarations":["instance","public"],"path":"RDoc::SourceCodeAccess#source_code_location","name":"source_code_location","namespace":"RDoc::SourceCodeAccess","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"source_code_location()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen_extensions.rb","line":71,"source":"# File lib/rdoc/generator/shomen_extensions.rb, line 71\n def source_code_location\n src = source_code_raw\n if md = %rFile (.*?), line (\\d+)/.match(src)\n file = md[1]\n line = md[2]\n else\n file = \"(unknown)\"\n line = 0\n end\n return file, line\n end","language":"ruby"},"RDoc::SourceCodeAccess#source_code_raw":{"!":"method","declarations":["instance","public"],"path":"RDoc::SourceCodeAccess#source_code_raw","name":"source_code_raw","namespace":"RDoc::SourceCodeAccess","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"source_code_raw()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen_extensions.rb","line":59,"source":"# File lib/rdoc/generator/shomen_extensions.rb, line 59\n def source_code_raw\n return '' unless @token_stream\n src = \"\"\n @token_stream.each do |t|\n next unless t\n src << t.text\n end\n #add_line_numbers(src)\n src\n end","language":"ruby"},"RDoc::TopLevel#to_h":{"!":"method","declarations":["instance","public"],"path":"RDoc::TopLevel#to_h","name":"to_h","namespace":"RDoc::TopLevel","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"to_h()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen_extensions.rb","line":10,"source":"# File lib/rdoc/generator/shomen_extensions.rb, line 10\n def to_h\n {\n :path => path,\n :name => base_name,\n :fullname => full_name,\n :rootname => absolute_name,\n :modified => last_modified,\n :diagram => diagram\n }\n end","language":"ruby"},"RDoc::ClassModule#with_documentation?":{"!":"method","declarations":["instance","public"],"path":"RDoc::ClassModule#with_documentation?","name":"with_documentation?","namespace":"RDoc::ClassModule","comment":"","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"with_documentation?()","arguments":[]}],"returns":[],"file":"/lib/rdoc/generator/shomen_extensions.rb","line":30,"source":"# File lib/rdoc/generator/shomen_extensions.rb, line 30\n def with_documentation?\n document_self_or_methods || classes_and_modules.any?{ |c| c.with_documentation? }\n end","language":"ruby"},"RDoc::Generator::Shomen#options":{"!":"method","declarations":["instance","public"],"path":"RDoc::Generator::Shomen#options","name":"options","namespace":"RDoc::Generator::Shomen","comment":"User options from the command line.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"options","arguments":[{"name":"options"}]}],"returns":[],"file":"/(unknown)","line":0,"source":"","language":"ruby"},"RDoc::Generator::Shomen#path_base":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#path_base","name":"path_base","namespace":"RDoc::Generator::Shomen","comment":"Current pathname.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"path_base","arguments":[{"name":"path_base"}]}],"returns":[],"file":"/(unknown)","line":0,"source":"","language":"ruby"},"RDoc::Generator::Shomen#path_output":{"!":"method","declarations":["instance","protected"],"path":"RDoc::Generator::Shomen#path_output","name":"path_output","namespace":"RDoc::Generator::Shomen","comment":"The output path.","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"path_output","arguments":[{"name":"path_output"}]}],"returns":[],"file":"/(unknown)","line":0,"source":"","language":"ruby"},"RDoc::Options#source":{"!":"method","declarations":["instance","public"],"path":"RDoc::Options#source","name":"source","namespace":"RDoc::Options","comment":"true/false to include full source","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"source","arguments":[{"name":"source"}]}],"returns":[],"file":"/(unknown)","line":0,"source":"","language":"ruby"},"RDoc::Options#yaml":{"!":"method","declarations":["instance","public"],"path":"RDoc::Options#yaml","name":"yaml","namespace":"RDoc::Options","comment":"true/false to use YAML instead of JSON","format":"rdoc","aliases":[],"alias_for":null,"singleton":false,"interfaces":[{"signature":"yaml","arguments":[{"name":"yaml"}]}],"returns":[],"file":"/(unknown)","line":0,"source":"","language":"ruby"},"/lib/rdoc/discover.rb":{"!":"script","path":"lib/rdoc/discover.rb","name":"discover.rb","created":"2012-03-31 09:43:25 -0400","modified":"2012-03-31 09:43:25 -0400","requires":["rubygems"],"constants":[],"modules":[],"classes":[],"methods":[]},"/lib/rdoc/generator/shomen.rb":{"!":"script","path":"lib/rdoc/generator/shomen.rb","name":"shomen.rb","created":"2012-03-31 11:17:02 -0400","modified":"2012-03-31 11:17:02 -0400","requires":["fileutils","pathname","yaml","json","rdoc/rdoc","rdoc/generator","rdoc/generator/markup","shomen/metadata","shomen/model","rdoc/generator/shomen_extensions"],"constants":[],"modules":[],"classes":[],"methods":[]},"/lib/rdoc/generator/shomen_extensions.rb":{"!":"script","path":"lib/rdoc/generator/shomen_extensions.rb","name":"shomen_extensions.rb","created":"2012-03-31 10:50:09 -0400","modified":"2012-03-31 10:50:09 -0400","requires":[],"constants":[],"modules":[],"classes":[],"methods":[]}}
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rdoc-shomen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - trans
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: shomen-model
16
+ requirement: &22833980 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *22833980
25
+ - !ruby/object:Gem::Dependency
26
+ name: citron
27
+ requirement: &22833060 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *22833060
36
+ - !ruby/object:Gem::Dependency
37
+ name: detroit
38
+ requirement: &22831420 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *22831420
47
+ description: ! 'RDoc-Shomen is an RDoc generator plugin that can be used to generate
48
+ Shomen
49
+
50
+ documentation. This is an alternative to the shomen command line tool which
51
+
52
+ use the `.rdoc` cache to generate a shomen document. In contrast the rdoc-shomen
53
+
54
+ generator operates as a traditional rdoc plugin.'
55
+ email:
56
+ - transfire@gmail.com
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files:
60
+ - LICENSE.txt
61
+ - HISTORY.rdoc
62
+ - README.rdoc
63
+ files:
64
+ - .ruby
65
+ - lib/rdoc/discover.rb
66
+ - lib/rdoc/generator/shomen.rb
67
+ - lib/rdoc/generator/shomen_extensions.rb
68
+ - test/case_specification.rb
69
+ - test/fixture/doc/doc.json
70
+ - HISTORY.rdoc
71
+ - LICENSE.txt
72
+ - README.rdoc
73
+ - Confile.rb
74
+ homepage: http://rubyworks.github.com/rdoc-shomen
75
+ licenses:
76
+ - BSD-2-Clause
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 1.8.11
96
+ signing_key:
97
+ specification_version: 3
98
+ summary: RDoc Generator for Shomen Documentation Format
99
+ test_files: []