Sha256: d47da78b9e3a37eab85d7889fb52b86fc84cfb140113b25c933c0ab62b04a541

Contents?: true

Size: 1.85 KB

Versions: 1

Compression:

Stored size: 1.85 KB

Contents

require "bundler/gem_tasks"
require "rack"
require "RedCloth"
require "redcloth-formatters-rdoc"
require "rdoc/task"
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) do |rspec|
  rspec.rspec_opts = "-f d", "--color"
end
task :default => :spec

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 Testserver"
task :server do
  load "spec/lib/test_web_server.rb"
  Rack::Handler::Thin.run Sinatra::Application, :Port => 3001
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bigbench-0.0.6 Rakefile