From a02d672cd7aead8a24e3b10a6b8e12dd91ee0a49 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 22 Jun 2008 10:38:25 -0700 Subject: [PATCH] Horo rdoc template --- .gitignore | 2 +- Rakefile | 14 +- actionmailer/Rakefile | 3 +- actionpack/Rakefile | 2 +- activemodel/Rakefile | 4 +- activerecord/Rakefile | 2 +- activeresource/Rakefile | 2 +- activesupport/Rakefile | 2 +- doc/template/horo.rb | 613 ++++++++++++++++++++++++++++++++++++++++ railties/Rakefile | 2 +- 10 files changed, 630 insertions(+), 16 deletions(-) create mode 100644 doc/template/horo.rb diff --git a/.gitignore b/.gitignore index 96a1c2117a..bba7d5dce8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ debug.log -doc +doc/rdoc activeresource/doc activerecord/doc actionpack/doc diff --git a/Rakefile b/Rakefile index 368f36e56c..352fd632d9 100644 --- a/Rakefile +++ b/Rakefile @@ -13,7 +13,7 @@ end desc 'Run all tests by default' task :default => :test -%w(test rdoc package release).each do |task_name| +%w(test rdoc pgem package release).each do |task_name| desc "Run #{task_name} task for all projects" task task_name do PROJECTS.each do |project| @@ -25,14 +25,14 @@ end desc "Generate documentation for the Rails framework" Rake::RDocTask.new do |rdoc| - rdoc.rdoc_dir = 'doc' - rdoc.title = "Rails Framework Documentation" + rdoc.rdoc_dir = 'doc/rdoc' + rdoc.title = "Ruby on Rails Documentation" rdoc.options << '--line-numbers' << '--inline-source' rdoc.options << '-A cattr_accessor=object' rdoc.options << '--charset' << 'utf-8' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : './doc/template/horo' rdoc.rdoc_files.include('railties/CHANGELOG') rdoc.rdoc_files.include('railties/MIT-LICENSE') @@ -68,13 +68,13 @@ end # Enhance rdoc task to copy referenced images also task :rdoc do - FileUtils.mkdir_p "doc/files/examples/" - FileUtils.copy "activerecord/examples/associations.png", "doc/files/examples/associations.png" + FileUtils.mkdir_p "doc/rdoc/files/examples/" + FileUtils.copy "activerecord/examples/associations.png", "doc/rdoc/files/examples/associations.png" end desc "Publish API docs for Rails as a whole and for each component" task :pdoc => :rdoc do - Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/api", "doc").upload + Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/api", "doc/rdoc").upload PROJECTS.each do |project| system %(cd #{project} && #{env} #{$0} pdoc) end diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile index b003f4d559..612bd27774 100755 --- a/actionmailer/Rakefile +++ b/actionmailer/Rakefile @@ -35,7 +35,7 @@ Rake::RDocTask.new { |rdoc| rdoc.title = "Action Mailer -- Easy email delivery and testing" rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object' rdoc.options << '--charset' << 'utf-8' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo' rdoc.rdoc_files.include('README', 'CHANGELOG') rdoc.rdoc_files.include('lib/action_mailer.rb') rdoc.rdoc_files.include('lib/action_mailer/*.rb') @@ -77,6 +77,7 @@ end desc "Publish the API documentation" task :pgem => [:package] do Rake::SshFilePublisher.new("wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload + `ssh wrath.rubyonrails.org './gemupdate.sh'` end desc "Publish the API documentation" diff --git a/actionpack/Rakefile b/actionpack/Rakefile index 86a2f3af14..1880f21f67 100644 --- a/actionpack/Rakefile +++ b/actionpack/Rakefile @@ -49,7 +49,7 @@ Rake::RDocTask.new { |rdoc| rdoc.title = "Action Pack -- On rails from request to response" rdoc.options << '--line-numbers' << '--inline-source' rdoc.options << '--charset' << 'utf-8' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo' if ENV['DOC_FILES'] rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/)) else diff --git a/activemodel/Rakefile b/activemodel/Rakefile index 87e9b547f3..99c9fc3bd1 100644 --- a/activemodel/Rakefile +++ b/activemodel/Rakefile @@ -10,7 +10,7 @@ Rake::RDocTask.new { |rdoc| rdoc.title = "Active Model" rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object' rdoc.options << '--charset' << 'utf-8' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo' rdoc.rdoc_files.include('README', 'CHANGES') rdoc.rdoc_files.include('lib/**/*.rb') -} \ No newline at end of file +} diff --git a/activerecord/Rakefile b/activerecord/Rakefile index 7a5296c458..60b17e02b9 100755 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -141,7 +141,7 @@ Rake::RDocTask.new { |rdoc| rdoc.title = "Active Record -- Object-relation mapping put on rails" rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object' rdoc.options << '--charset' << 'utf-8' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo' rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG') rdoc.rdoc_files.include('lib/**/*.rb') rdoc.rdoc_files.exclude('lib/active_record/vendor/*') diff --git a/activeresource/Rakefile b/activeresource/Rakefile index 89901292a5..8c3ad36a02 100644 --- a/activeresource/Rakefile +++ b/activeresource/Rakefile @@ -42,7 +42,7 @@ Rake::RDocTask.new { |rdoc| rdoc.title = "Active Resource -- Object-oriented REST services" rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object' rdoc.options << '--charset' << 'utf-8' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo' rdoc.rdoc_files.include('README', 'CHANGELOG') rdoc.rdoc_files.include('lib/**/*.rb') rdoc.rdoc_files.exclude('lib/activeresource.rb') diff --git a/activesupport/Rakefile b/activesupport/Rakefile index 74d2750011..f2885c69a4 100644 --- a/activesupport/Rakefile +++ b/activesupport/Rakefile @@ -33,7 +33,7 @@ Rake::RDocTask.new { |rdoc| rdoc.title = "Active Support -- Utility classes and standard library extensions from Rails" rdoc.options << '--line-numbers' << '--inline-source' rdoc.options << '--charset' << 'utf-8' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo' rdoc.rdoc_files.include('README', 'CHANGELOG') rdoc.rdoc_files.include('lib/active_support.rb') rdoc.rdoc_files.include('lib/active_support/**/*.rb') diff --git a/doc/template/horo.rb b/doc/template/horo.rb new file mode 100644 index 0000000000..e028422a2e --- /dev/null +++ b/doc/template/horo.rb @@ -0,0 +1,613 @@ +# Horo RDoc template +# Author: Hongli Lai - http://izumi.plan99.net/blog/ +# +# Based on the Jamis template: +# http://weblog.jamisbuck.org/2005/4/8/rdoc-template + +if defined?(RDoc::Diagram) + RDoc::Diagram.class_eval do + remove_const(:FONT) + const_set(:FONT, "\"Bitstream Vera Sans\"") + end +end + +module RDoc +module Page + +FONTS = "\"Bitstream Vera Sans\", Verdana, Arial, Helvetica, sans-serif" + +STYLE = < pre { + padding: 0.5em; + border: 1px dotted black; + background: #FFE; +} + +dt { + font-weight: bold +} + +dd { + margin-bottom: 0.7em; +} +CSS + +XHTML_PREAMBLE = %{ + +} + +XHTML_FRAMESET_PREAMBLE = %{ + +} + +HEADER = XHTML_PREAMBLE + < + + %title% + + + + + + + +ENDHEADER + +FILE_PAGE = < + + + + +
File
%short_name%
+ + + + + + + + + +
Path:%full_path% +IF:cvsurl +  (CVS) +ENDIF:cvsurl +
Modified:%dtm_modified%
+
+ +
+HTML + +################################################################### + +CLASS_PAGE = < + %classmod%
%full_name% + + + + + + +IF:parent + + + + +ENDIF:parent +
In: +START:infiles +HREF:full_path_url:full_path: +IF:cvsurl + (CVS) +ENDIF:cvsurl +END:infiles +
Parent: +IF:par_url + +ENDIF:par_url +%parent% +IF:par_url + +ENDIF:par_url +
+ + + +HTML + +################################################################### + +METHOD_LIST = < +IF:diagram +
+ %diagram% +
+ENDIF:diagram + +IF:description +
%description%
+ENDIF:description + +IF:requires +
Required Files
+
    +START:requires +
  • HREF:aref:name:
  • +END:requires +
+ENDIF:requires + +IF:toc +
Contents
+ +ENDIF:toc + +IF:methods +
Methods
+
    +START:methods +
  • HREF:aref:name:
  • +END:methods +
+ENDIF:methods + +IF:includes +
Included Modules
+
    +START:includes +
  • HREF:aref:name:
  • +END:includes +
+ENDIF:includes + +START:sections +IF:sectitle + +IF:seccomment +
+%seccomment% +
+ENDIF:seccomment +ENDIF:sectitle + +IF:classlist +
Classes and Modules
+ %classlist% +ENDIF:classlist + +IF:constants +
Constants
+ +START:constants + + + + + +IF:desc + + + + +ENDIF:desc +END:constants +
%name%=%value%
 %desc%
+ENDIF:constants + +IF:attributes +
Attributes
+ +START:attributes + + + + + +END:attributes +
+IF:rw +[%rw%] +ENDIF:rw + %name%%a_desc%
+ENDIF:attributes + +IF:method_list +START:method_list +IF:methods +
%type% %category% methods
+START:methods +
+
+IF:callseq + %callseq% +ENDIF:callseq +IFNOT:callseq + %name%%params% +ENDIF:callseq +IF:codeurl +[ source ] +ENDIF:codeurl +
+IF:m_desc +
+ %m_desc% +
+ENDIF:m_desc +IF:aka +
+ This method is also aliased as +START:aka + %name% +END:aka +
+ENDIF:aka +IF:sourcecode +
+ +
+
+%sourcecode%
+
+
+
+ENDIF:sourcecode +
+END:methods +ENDIF:methods +END:method_list +ENDIF:method_list +END:sections + +HTML + +FOOTER = < + +ENDFOOTER + +BODY = HEADER + < + +
+ #{METHOD_LIST} +
+ + #{FOOTER} +ENDBODY + +########################## Source code ########################## + +SRC_PAGE = XHTML_PREAMBLE + < +%title% + + + + +
%code%
+ + +HTML + +########################## Index ################################ + +FR_INDEX_BODY = < + + +Index + + + + + +
+START:entries +%name%
+END:entries +
+ +HTML + +CLASS_INDEX = FILE_INDEX +METHOD_INDEX = FILE_INDEX + +INDEX = XHTML_FRAMESET_PREAMBLE + < + + %title% + + + + + + + + + + + + <body bgcolor="white"> + Click <a href="html/index.html">here</a> for a non-frames + version of this page. + </body> + + + + +HTML + +end +end + diff --git a/railties/Rakefile b/railties/Rakefile index 78fe8e6662..f64b60b0dd 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -264,7 +264,7 @@ Rake::RDocTask.new { |rdoc| rdoc.title = "Railties -- Gluing the Engine to the Rails" rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cattr_accessor=object' rdoc.options << '--charset' << 'utf-8' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo' rdoc.rdoc_files.include('README', 'CHANGELOG') rdoc.rdoc_files.include('lib/*.rb') rdoc.rdoc_files.include('lib/rails/*.rb')