Method: RDoc::Generator::Shomen#generate_scripts

Defined in:
lib/shomen/rdoc.rb

#generate_scriptsObject (protected)

Generate script entries.



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/shomen/rdoc.rb', line 399

def generate_scripts
  #debug_msg "Generating file documentation in #{path_output_relative}:"
  #templatefile = self.path_template + 'file.rhtml'

  files.each do |rdoc_file|
    debug_msg "%s" % [rdoc_file.full_name]

    absolute_path = File.join(path_base, rdoc_file.full_name)
    #rel_prefix  = self.path_output.relative_path_from(outfile.dirname)

    model = Shomen::Model::Script.new

    model.path      = rdoc_file.full_name
    model.name      = File.basename(rdoc_file.full_name)
    model.mtime     = File.mtime(absolute_path)

    if Shomen.source?
      model.source    = File.read(absolute_path) #file.comment
      model.language  = mime_type(absolute_path)
    end

    #model.header   =
    #model.footer   =
    model.requires  = rdoc_file.requires.map{ |r| r.name }
    model.constants = rdoc_file.constants.map{ |c| c.full_name }

    # note that this utilizes the table we are building
    # so it needs to be the last thing done.
    @table.each do |k, h|
      case h['!']
      when 'module'
        model.modules ||= []
        model.modules << k if h['files'].include?(rdoc_file.full_name)
      when 'class'
        model.classes ||= []
        model.classes << k if h['files'].include?(rdoc_file.full_name)
      when 'method'
        model.methods ||= []
        model.methods << k if h['file'] == rdoc_file.full_name
      when 'class-method'
        model.class_methods ||= []
        model.class_methods << k if h['file'] == rdoc_file.full_name
      end
    end

    @table['/'+model.path] = model.to_h
  end
end