mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
doc/website cleanup
This commit is contained in:
parent
fe1ed270d0
commit
69293f6ced
7 changed files with 60 additions and 81 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
||||||
*.log
|
*.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/dist
|
/dist
|
||||||
/doc/website
|
/book
|
||||||
/doc/book
|
|
||||||
/doc/api
|
/doc/api
|
||||||
|
/doc/*.html
|
||||||
|
|
80
Rakefile
80
Rakefile
|
@ -1,7 +1,6 @@
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'rake/clean'
|
require 'rake/clean'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'hpricot'
|
|
||||||
|
|
||||||
task :default => :test
|
task :default => :test
|
||||||
|
|
||||||
|
@ -70,6 +69,29 @@ task 'publish:gem' => [package('.gem'), package('.tar.gz')] do |t|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Website ============================================================
|
# Website ============================================================
|
||||||
|
# Building docs requires HAML and the hanna gem:
|
||||||
|
# gem install mislav-hanna --source=http://gems.github.com
|
||||||
|
|
||||||
|
task 'doc' => ['doc:api','doc:site']
|
||||||
|
|
||||||
|
desc 'Generate Hanna RDoc under doc/api'
|
||||||
|
task 'doc:api' => ['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 \
|
||||||
|
--fmt html \
|
||||||
|
--inline-source \
|
||||||
|
--line-numbers \
|
||||||
|
--main README.rdoc \
|
||||||
|
--op doc/api \
|
||||||
|
--title 'Sinatra API Documentation' \
|
||||||
|
#{rb_files.join(' ')}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
CLEAN.include 'doc/api'
|
||||||
|
|
||||||
def rdoc_to_html(file_name)
|
def rdoc_to_html(file_name)
|
||||||
require 'rdoc/markup/to_html'
|
require 'rdoc/markup/to_html'
|
||||||
rdoc = RDoc::Markup::ToHtml.new
|
rdoc = RDoc::Markup::ToHtml.new
|
||||||
|
@ -83,31 +105,39 @@ def haml(locals={})
|
||||||
haml.render(Object.new, locals)
|
haml.render(Object.new, locals)
|
||||||
end
|
end
|
||||||
|
|
||||||
directory 'doc/website'
|
desc 'Build website HTML and stuff'
|
||||||
|
task 'doc:site' => ['doc/index.html', 'doc/book.html']
|
||||||
|
|
||||||
desc 'Build website'
|
file 'doc/index.html' => %w[README.rdoc doc/template.haml] do |file|
|
||||||
task :website => ['doc/website/book.html', 'doc/website/index.html', :doc]
|
|
||||||
|
|
||||||
file 'doc/website/index.html' => 'doc/website' do |file|
|
|
||||||
File.open(file.name, 'w') do |file|
|
File.open(file.name, 'w') do |file|
|
||||||
file << haml(:title => 'Sinatra', :content => rdoc_to_html('README.rdoc'))
|
file << haml(:title => 'Sinatra', :content => rdoc_to_html('README.rdoc'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
CLEAN.include 'doc/index.html'
|
||||||
|
|
||||||
file 'doc/website/book.html' => ['doc/website', :build_book] do |file|
|
file 'doc/book.html' => ['book/output/sinatra-book.html'] do |file|
|
||||||
File.open(file.name, 'w') do |file|
|
File.open(file.name, 'w') do |file|
|
||||||
book_content = File.read('doc/book/output/sinatra-book.html')
|
book_content = File.read('book/output/sinatra-book.html')
|
||||||
file << haml(:title => 'Sinatra Book', :content => book_content)
|
file << haml(:title => 'Sinatra Book', :content => book_content)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
CLEAN.include 'doc/book.html'
|
||||||
|
|
||||||
task :build_book do
|
file 'book/output/sinatra-book.html' => FileList['book/**'] do |f|
|
||||||
unless File.directory?('doc/book')
|
unless File.directory?('book')
|
||||||
sh 'git clone git://github.com/cschneid/sinatra-book.git doc/book'
|
sh 'git clone git://github.com/cschneid/sinatra-book.git book'
|
||||||
end
|
end
|
||||||
sh 'cd doc/book && git fetch origin && git rebase origin/master'
|
sh((<<-SH).strip.gsub(/\s+/, ' '))
|
||||||
sh 'cd doc/book && thor book:build'
|
cd book &&
|
||||||
|
git fetch origin &&
|
||||||
|
git rebase origin/master &&
|
||||||
|
thor book:build
|
||||||
|
SH
|
||||||
end
|
end
|
||||||
|
CLEAN.include 'book/output/sinatra-book.html'
|
||||||
|
|
||||||
|
desc 'Build the Sinatra book'
|
||||||
|
task 'doc:book' => ['book/output/sinatra-book.html']
|
||||||
|
|
||||||
# Gemspec Helpers ====================================================
|
# Gemspec Helpers ====================================================
|
||||||
|
|
||||||
|
@ -130,27 +160,3 @@ file 'sinatra.gemspec' => FileList['{lib,test,images}/**','Rakefile'] do |f|
|
||||||
File.open(f.name, 'w') { |io| io.write(spec) }
|
File.open(f.name, 'w') { |io| io.write(spec) }
|
||||||
puts "updated #{f.name}"
|
puts "updated #{f.name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Hanna RDoc =========================================================
|
|
||||||
#
|
|
||||||
# Building docs requires the hanna gem:
|
|
||||||
# gem install mislav-hanna --source=http://gems.github.com
|
|
||||||
|
|
||||||
desc 'Generate Hanna RDoc under doc/api'
|
|
||||||
task :doc => ['doc/website/api/index.html']
|
|
||||||
|
|
||||||
file 'doc/website/api/index.html' => FileList['lib/**/*.rb','README.rdoc'] do |f|
|
|
||||||
rb_files = f.prerequisites
|
|
||||||
sh((<<-end).gsub(/\s+/, ' '))
|
|
||||||
rdoc --charset utf8 \
|
|
||||||
--fmt html \
|
|
||||||
--inline-source \
|
|
||||||
--line-numbers \
|
|
||||||
--main README.rdoc \
|
|
||||||
--op doc/website/api \
|
|
||||||
--title 'Sinatra API Documentation' \
|
|
||||||
#{rb_files.join(' ')}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
CLEAN.include 'doc/website'
|
|
||||||
|
|
|
@ -2,18 +2,19 @@
|
||||||
%html
|
%html
|
||||||
%head
|
%head
|
||||||
%title= title
|
%title= title
|
||||||
%link{ :media => 'screen', :type => 'text/css', :href => '/sinatra.css', :rel => 'stylesheet' }
|
%link{ :media => 'screen', :type => 'text/css', :href => 'sinatra.css', :rel => 'stylesheet' }
|
||||||
%body
|
%body
|
||||||
#page
|
#content
|
||||||
%h1
|
%a{ :href => './'}
|
||||||
%a{ :href => '/'}= 'Sinatra'
|
%img{ :src => "sinatra-logo.gif", :width => 156, :height => 108, :alt => 'Hat' }
|
||||||
%ul#navigation
|
%div#navigation
|
||||||
%li
|
%ul
|
||||||
%a{ :href => '/' } The Hat
|
%li
|
||||||
%li
|
%a{ :href => './' } The Hat
|
||||||
%a{ :href => '/book' } The Book
|
%li
|
||||||
%li
|
%a{ :href => './book' } The Book
|
||||||
%a{ :href => '/api' } The API
|
%li
|
||||||
%li
|
%a{ :href => './api' } The API
|
||||||
%a{ :href => 'http://github.com/bmizerany/sinatra' } The Source
|
%li
|
||||||
#content= content
|
%a{ :href => 'http://github.com/bmizerany/sinatra' } The Source
|
||||||
|
%div.inner~ content
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
<!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>
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.2 KiB |
Loading…
Reference in a new issue