aboutsummaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-08-07 15:18:22 +0200
committerXavier Noria <fxn@hashref.com>2010-08-07 15:18:22 +0200
commit0953c04cf57cfc281e6972df450ebe517cfe3a00 (patch)
treef9fd2f9e67483638f111ad07158469344febc0b0 /Rakefile
parentaed698a7c8bdafe3a7596a15d320fc5b1175600f (diff)
downloadrails-0953c04cf57cfc281e6972df450ebe517cfe3a00.tar.gz
rails-0953c04cf57cfc281e6972df450ebe517cfe3a00.tar.bz2
rails-0953c04cf57cfc281e6972df450ebe517cfe3a00.zip
quick hack: hijacks the predicate RDoc::Parser.binary? so that it does not consider a handful of ordinary Ruby files in the Rails tree as binary (and thus excluded from the API)
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile27
1 files changed, 27 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index 0e6acb5ac2..aab4f5f2f5 100644
--- a/Rakefile
+++ b/Rakefile
@@ -5,6 +5,31 @@ require 'rake'
require 'rdoc/task'
require 'rake/gempackagetask'
+# RDoc skips some files in the Rails tree due to its binary? predicate. This is a quick
+# hack for edge docs, until we decide which is the correct way to address this issue.
+# If not fixed in RDoc itself, via an option or something, we should probably move this
+# to railties and use it also in doc:rails.
+def hijack_rdoc!
+ require "rdoc/parser"
+ class << RDoc::Parser
+ def binary?(file)
+ s = File.read(file, 1024) or return false
+
+ if s[0, 2] == Marshal.dump('')[0, 2] then
+ true
+ elsif file =~ /\.erb\.rb$/ then # ORIGINAL is file =~ /erb\.rb$/
+ false
+ elsif s.index("\x00") then # ORIGINAL is s.scan(/<%|%>/).length >= 4 || s.index("\x00")
+ true
+ elsif 0.respond_to? :fdiv then
+ s.count("^ -~\t\r\n").fdiv(s.size) > 0.3
+ else # HACK 1.8.6
+ (s.count("^ -~\t\r\n").to_f / s.size) > 0.3
+ end
+ end
+ end
+end
+
PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
desc 'Run all tests by default'
@@ -63,6 +88,8 @@ end
desc "Generate documentation for the Rails framework"
RDoc::Task.new do |rdoc|
+ hijack_rdoc!
+
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.title = "Ruby on Rails Documentation"