Sha256: c76d932c729812d9a355c2a710fa7583b752ec8a5e13fa86c362f094517b17b0

Contents?: true

Size: 1.72 KB

Versions: 2

Compression:

Stored size: 1.72 KB

Contents

require "bundler/gem_tasks"
require "rack"
require "RedCloth"
require "redcloth-formatters-rdoc"
require "rdoc/task"


desc "Create and open documentation"
task :doc do
  
  # Compile the readme to the rdoc format
  readme_textile = File.open('README.textile', 'r+'){ |file| file.read }
  readme_rdoc = RedCloth.new(readme_textile).to_rdoc  
  File.open('README.rdoc', 'w+'){ |file| file.write(readme_rdoc) }
  
  # Create rdoc with the readme as main file
  `rdoc --main README.rdoc --include lib/bigbench/help/`
  
  RDoc::Task.new do |rdoc|
    rdoc.main = "README.rdoc"
    rdoc.rdoc_files.include("README.rdoc", "lib/bigbench/help/")
  end
  
  # Fix RDocs inability to handle tables
  index_html = File.open('doc/index.html', 'r+'){ |file| file.read }
  index_html.gsub! '&lt;', '<'
  index_html.gsub! '&gt;', '>'
  index_html.gsub! '<p><table></p>', '<table>'
  index_html.gsub! '<pre><tr>', '<tr>'
  index_html.gsub! '</tr></pre>', '</tr>'
  index_html.gsub! '<p></table></p>', '</table>'
  File.open('doc/index.html', 'w+'){ |file| file.write(index_html) }
  
  # Add table style
  rdoc_css = File.open('doc/rdoc.css', 'r+'){ |file| file.read }
  rdoc_css += "\n table{ border: 1px dashed #D3D3D3; line-height: 30px; margin-top: 10px; border-collapse: collapse; }"
  rdoc_css += "\n td{ padding-left:20px; padding-right:20px; border-top: 1px solid #E4E4E4; }"
  rdoc_css += "\n th{ padding-left:20px; padding-right:20px; text-align:left; }"
  File.open('doc/rdoc.css', 'w+'){ |file| file.write(rdoc_css) }
  
  # Clean up the rdoc file
  File.delete("README.rdoc")
  `open doc/index.html`
  
end

desc "Start Thin RDoc Testserver"
task :server do
  load "spec/lib/test_web_server.rb"
  Rack::Handler::Thin.run Sinatra::Application, :Port => 3001
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bigbench-0.0.5 Rakefile
bigbench-0.0.4 Rakefile