From 69293f6ced89c2bfd1f5ba16f1790b0688f63f8c Mon Sep 17 00:00:00 2001 From: Ryan Tomayko Date: Sun, 2 Nov 2008 04:51:09 -0800 Subject: [PATCH] doc/website cleanup --- .gitignore | 4 +- Rakefile | 80 +++++++++++++----------- doc/{website => }/favicon.ico | 0 doc/{website/master.css => sinatra.css} | 0 doc/template.haml | 29 ++++----- doc/website/index.tpl | 28 --------- doc/website/sinatra-logo.gif | Bin 5337 -> 0 bytes 7 files changed, 60 insertions(+), 81 deletions(-) rename doc/{website => }/favicon.ico (100%) rename doc/{website/master.css => sinatra.css} (100%) delete mode 100644 doc/website/index.tpl delete mode 100644 doc/website/sinatra-logo.gif diff --git a/.gitignore b/.gitignore index 995ea06f..52729409 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ *.log .DS_Store /dist -/doc/website -/doc/book +/book /doc/api +/doc/*.html diff --git a/Rakefile b/Rakefile index cbb4c548..4a585fc5 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,6 @@ require 'rubygems' require 'rake/clean' require 'fileutils' -require 'hpricot' task :default => :test @@ -70,6 +69,29 @@ task 'publish:gem' => [package('.gem'), package('.tar.gz')] do |t| end # 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) require 'rdoc/markup/to_html' rdoc = RDoc::Markup::ToHtml.new @@ -83,31 +105,39 @@ def haml(locals={}) haml.render(Object.new, locals) end -directory 'doc/website' +desc 'Build website HTML and stuff' +task 'doc:site' => ['doc/index.html', 'doc/book.html'] -desc 'Build website' -task :website => ['doc/website/book.html', 'doc/website/index.html', :doc] - -file 'doc/website/index.html' => 'doc/website' do |file| +file 'doc/index.html' => %w[README.rdoc doc/template.haml] do |file| File.open(file.name, 'w') do |file| file << haml(:title => 'Sinatra', :content => rdoc_to_html('README.rdoc')) 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| - 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) end end +CLEAN.include 'doc/book.html' -task :build_book do - unless File.directory?('doc/book') - sh 'git clone git://github.com/cschneid/sinatra-book.git doc/book' +file 'book/output/sinatra-book.html' => FileList['book/**'] do |f| + unless File.directory?('book') + sh 'git clone git://github.com/cschneid/sinatra-book.git book' end - sh 'cd doc/book && git fetch origin && git rebase origin/master' - sh 'cd doc/book && thor book:build' + sh((<<-SH).strip.gsub(/\s+/, ' ')) + cd book && + git fetch origin && + git rebase origin/master && + thor book:build + SH end +CLEAN.include 'book/output/sinatra-book.html' + +desc 'Build the Sinatra book' +task 'doc:book' => ['book/output/sinatra-book.html'] # 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) } puts "updated #{f.name}" 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' diff --git a/doc/website/favicon.ico b/doc/favicon.ico similarity index 100% rename from doc/website/favicon.ico rename to doc/favicon.ico diff --git a/doc/website/master.css b/doc/sinatra.css similarity index 100% rename from doc/website/master.css rename to doc/sinatra.css diff --git a/doc/template.haml b/doc/template.haml index c4ecf2ba..8c7ec66e 100644 --- a/doc/template.haml +++ b/doc/template.haml @@ -2,18 +2,19 @@ %html %head %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 - #page - %h1 - %a{ :href => '/'}= 'Sinatra' - %ul#navigation - %li - %a{ :href => '/' } The Hat - %li - %a{ :href => '/book' } The Book - %li - %a{ :href => '/api' } The API - %li - %a{ :href => 'http://github.com/bmizerany/sinatra' } The Source - #content= content + #content + %a{ :href => './'} + %img{ :src => "sinatra-logo.gif", :width => 156, :height => 108, :alt => 'Hat' } + %div#navigation + %ul + %li + %a{ :href => './' } The Hat + %li + %a{ :href => './book' } The Book + %li + %a{ :href => './api' } The API + %li + %a{ :href => 'http://github.com/bmizerany/sinatra' } The Source + %div.inner~ content diff --git a/doc/website/index.tpl b/doc/website/index.tpl deleted file mode 100644 index 7a29964c..00000000 --- a/doc/website/index.tpl +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - Sinatra.rb - - - - - -
- Sinatra Logo - -
-{{REPLACE}} -
-
- - diff --git a/doc/website/sinatra-logo.gif b/doc/website/sinatra-logo.gif deleted file mode 100644 index b213dfbe442b452279e30e5053a9858ef6505fca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5337 zcmeH}_czrK;QwEDbFb`qMU?DBDl)RlDus}dGP6s`UN3t`_PDs_wJz7@8eP|3Wo4(U z;tGi(N#4HS&tLKR<@5Xt9_Mk+Iwe|J&+qZQN4-bF*_@Qu3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