1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

rake task for generating rubyforge website; assets (logo, CSS)

This commit is contained in:
Karel Minarik 2008-11-02 12:37:48 +01:00 committed by Ryan Tomayko
parent 7c77c2291b
commit d8a02423e9
6 changed files with 148 additions and 2 deletions

4
.gitignore vendored
View file

@ -1,4 +1,6 @@
doc
doc/api
doc/website/index.html
doc/website/tmp/*
*.log
.DS_Store
/dist

View file

@ -1,4 +1,7 @@
require 'rubygems'
require 'rake/clean'
require 'fileutils'
require 'hpricot'
task :default => :test
@ -98,7 +101,7 @@ task :doc => ['doc/api/index.html']
file 'doc/api/index.html' => FileList['lib/**/*.rb','README.rdoc'] do |f|
rb_files = f.prerequisites
sh((<<-end).gsub(/\s+/, ' '))
hanna --charset utf8 \
rdoc --charset utf8 \
--fmt html \
--inline-source \
--line-numbers \
@ -109,3 +112,13 @@ file 'doc/api/index.html' => FileList['lib/**/*.rb','README.rdoc'] do |f|
end
end
CLEAN.include 'doc/api'
desc "Generate simple website"
task :website do
`rdoc --force-update -o doc/website/tmp README.rdoc`
readme = Hpricot( open("doc/website/tmp/files/README_rdoc.html") ).at('#bodyContent').inner_html
# Replace placeholder with Readme content
html = File.read("doc/website/index.tpl").sub(Regexp.new(Regexp.escape("{{REPLACE}}")), readme)
# TODO: Fix RDoc links
File.open( "doc/website/index.html", 'w+' ) { |f| f << html }
end

0
doc/website/favicon.ico Executable file
View file

28
doc/website/index.tpl Normal file
View file

@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Sinatra.rb</title>
<link rel="stylesheet" href="/master.css" type="text/css" media="screen" />
</head>
<body>
<div id="content">
<a href="/"><img src="/sinatra-logo.gif" width="156" height="108" alt="Sinatra Logo" title=""></a>
<div id="navigation">
<ul>
<li><a href="/">The Hat</a></li>
<li><a href="http://sinatra-book.gittr.com/">The Book</a></li>
<li><a href="/api">The API</a></li>
<li><a href="http://github.com/bmizerany/sinatra">The Source</a></li>
</ul>
</div><!-- /navigation -->
<div class="inner">
{{REPLACE}}
</div><!-- /inner -->
</div><!-- /content -->
</body>
</html>

103
doc/website/master.css Normal file
View file

@ -0,0 +1,103 @@
body {
font-size: 100%;
font-family: Helvetica, Arial, sans-serif;
margin: auto 10em; }
body
{ color: #222;
background: #fafafa;
font-family: Helvetica, Arial, sans-serif;
margin: auto 8em;
padding: 0; }
a {
color: #1177DD;
text-decoration: none; }
a:hover {
text-decoration: underline; }
a img
{ border: none; }
#navigation ul {
text-align: right;
list-style-type: none;
padding: 0;
margin: 0;
clear: both;
position: relative; }
#navigation ul li {
background: #e0e0e0;
padding: 0.4em;
margin-right: 0.5em;
display: inline; }
#content
{ background: #fff;
padding: 1em 2em;
margin: auto 2em;
border: 1px solid #ccc;
border-top: none; border-bottom: none; }
#content .inner {
position: relative;
border-top: 4px solid #222;
margin-top: 0.2em; }
#content h1, #content h2, #content h3, #content h4, #content h5, #content h6 {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
body #content h1:first-child {
color: #222;
background: #fff;
font: bold 300% Georgia, "Times New Roman", serif;
position: absolute;
left: 180px;
top: -2.7em; }
#content h1 a {
color: #222; }
#content p.first { /* TODO */
font-size: 200%; }
#content h2 {
color: #333;
font-size: 150%;
margin-top: 1.5em;
border-top: 4px solid #e0e0e0;
padding-top: .5em; }
#content h3 {
font-weight: bold;
font-size: 120%;
color: #4e4e4e;
margin: 1em 0 .2em; }
/* code */
#content code, #content pre, #content textarea {
font-family: "Deja Vu Sans Mono", "Bitstream Vera Sans Mono", "Inconsolata", "Consolas", monospace; }
#content pre {
margin: .5em 0;
padding: .5em; }
#content pre {
margin: 1em 0;
font-size: 90%;
background-color: #f8f8ff;
border: 1px solid #dedede;
padding: .5em;
line-height: 1.5em;
color: #444; }
#content pre code {
padding: 0;
font-size: 100%;
background-color: #f8f8ff;
border: none; }
#content code {
font-size: 90%;
background-color: #f8f8ff;
color: #444;
padding: 0 .2em;
border: 1px solid #dedede; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB