Commit 577f34e7 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

rakefile with tasks to runs tests and generate preview for docs in github format

parent d6bb1b6e
<html>
<head>
<meta charset="utf-8">
<title><%= filename %> - Preview to GitHub</title>
<link type="text/css" rel="stylesheet" media="screen" href="http://github.com/stylesheets/bundle_common.css">
<link type="text/css" rel="stylesheet" media="screen" href="http://github.com/stylesheets/bundle_github.css">
<script type="text/javascript">
if (typeof console == "undefined" || typeof console.log == "undefined")
console = { log: function() {} }
var GitHub = {
assetHost: 'http://github.com'
}
var github_user = ''
</script>
<script type="text/javascript" src="http://github.com/javascripts/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://github.com/javascripts/bundle_common.js"></script>
<script type="text/javascript" src="http://github.com/javascripts/bundle_github.js"></script>
</head>
<body class="logged_in page-blob usingMouse">
<div id="main" class="subnavd">
<div class="site">
<br/><br/><br/><br/><br/><br/>
<div id="slider">
<div class="frames">
<div data-path="HISTORY.md/" class="frame frame-center">
<div id="files">
<div class="file">
<div class="blob instapaper_body" id="readme">
<div class="wikistyle">
<%= content %>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="display: none;" class="frame frame-loading">
<img width="32" height="32" src="http://github.com/images/modules/ajax/big_spinner_336699.gif">
</div>
</div>
</div>
</body>
</html>
require 'bundler'
base_dir = File.expand_path('..', File.dirname(__FILE__))
namespace :docs do
desc "Generates docs files to preview."
task :generate do
Bundler.require(:docs)
require 'erb'
require 'github/markup'
template = ERB.new File.read("#{base_dir}/misc/github_template.html.erb")
Dir.glob("#{base_dir}/*.textile").each do |file|
filename = File.basename(file)
content = GitHub::Markup.render(file, File.read(file))
rendered = template.result(binding)
output = "#{base_dir}/misc/#{filename}"
File.open(output, 'w') {|f| f.write(rendered) }
puts "Preview rendered to #{output}"
end
end
end
desc "Run all tests."
task :tests do
Bundler.setup(:test)
require 'test/unit'
Dir.glob('test_*.rb').each do|f|
test_case = "#{base_dir}/#{f}".gsub('.rb', '')
require test_case
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment