Sha256: 9770e77b822e6e1c4bf13f1fec3fff7b5a315af8fbda67be93f36510786ed5c9

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

# Generates the documentation in HTML format.
#--
# Copyright 2006 Suraj N. Kurapati
# See the file named LICENSE for details.

require 'rake/clean'


$: << File.join(File.dirname(__FILE__), '..', 'lib')
require 'ruby-vpi'
include RubyVpi::Config
HISTORY_URL = WEBSITE_URL + "/history.html"
RSS_URL = WEBSITE_URL + '/rss.xml'
RSS_INFO = "RSS feed for this project."

require 'ruby-vpi/erb'


$: << File.join(File.dirname(__FILE__), 'lib')
require 'doc_proxy'


FileList['*.doc'].each do |src|
  prefix = File.basename(src, File.extname(src))
  helper = prefix + '.rb'
  dst = prefix + '.html'
  deps = FileList[prefix + '*'].exclude(src, dst)

  desc "Process file #{src.inspect}."
  file dst => [src, 'common.tpl', *deps] do |t|
    String.reset_anchors

    content = DocProxy.new.instance_eval do
      # default output configuration
      insert_toc = true
      page_title = nil

      # load the documentation's helper
        if File.exist? helper
          instance_eval File.read(helper)
        end

      # evaluate the documentation file
        template = ERB.new(File.read(src))
        content = template.result(binding)
        toc, content = post_process(content)

      # fit result into common HTML format
        template = ERB.new(File.read(t.prerequisites[1]))
        template.result(binding)
    end

    File.open(dst, 'w') do |f|
      f << content
      puts f.path
    end
  end

  task :default => dst
  CLOBBER.include dst
end


desc "Generate RSS feed."
file 'rss.xml' => FileList['rss.erb', 'history*'] do |t|
  template = ERB.new(File.read(t.prerequisites[0]))
  content = template.result

  File.open(t.name, 'w') do |f|
    f << content
    puts f.path
  end
end

task :default => 'rss.xml'
CLOBBER.include 'rss.xml'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-vpi-16.0.0 doc/Rakefile
ruby-vpi-16.0.1 doc/Rakefile