Sha256: 5480716ec73a2460983b475180870a8045cd45d17241d87b112f6a5d06349570

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

=begin
  Copyright 2006 Suraj N. Kurapati

  This file is part of Ruby-VPI.

  Ruby-VPI is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  Ruby-VPI is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with Ruby-VPI; if not, write to the Free Software Foundation,
  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
=end

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

require 'rake/clean'
require 'doc_proxy'

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

  desc "Process file #{src.inspect}."
  file dst => [src, 'common.tpl'] do |t|
    content = DocProxy.new.instance_eval do
      # default output configuration
      table_of_contents = 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)
        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
    end

    puts "wrote #{dst.inspect}"
  end

  task :default => dst
end

CLOBBER.include '*.html'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-vpi-12.0.0 doc/Rakefile
ruby-vpi-11.1.1 doc/Rakefile