Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #3563 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] rake apidoc / appdoc will fail with rake-0.7.0

Reported by: Kazuhiko <kazuhiko@fdiary.net> Assigned to: David
Priority: normal Milestone:
Component: Railties Version: 1.0.0
Severity: normal Keywords:
Cc: adam.greenfield@site5.com

Description

Problem

From 'CHANGES' in rake-0.7.0 :

Made the RDoc task default to internal (in-process) RDoc formatting. The old behavior is still available by setting the external flag to true.

'rake apidoc' and 'rake appdoc' will fail because of this change.

$ rake appdoc
(in /home/kazuhiko/article/rails_book/test1)
rm -r doc/app

unrecognized option `--line-numbers --inline-source'

For help on options, try 'rdoc --help'

Solution 1

Modify railties as the following:

--- railties/lib/tasks/documentation.rake       (revision 3443)
+++ railties/lib/tasks/documentation.rake       (working copy)
@@ -2,7 +2,7 @@
 Rake::RDocTask.new("appdoc") { |rdoc|
   rdoc.rdoc_dir = 'doc/app'
   rdoc.title    = "Rails Application Documentation"
-  rdoc.options << '--line-numbers --inline-source'
+  rdoc.options << '--line-numbers' << '--inline-source'
   rdoc.rdoc_files.include('doc/README_FOR_APP')
   rdoc.rdoc_files.include('app/**/*.rb')
 }
@@ -45,7 +45,7 @@
   rdoc.rdoc_dir = 'doc/api'
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.title    = "Rails Framework Documentation"
-  rdoc.options << '--line-numbers --inline-source'
+  rdoc.options << '--line-numbers' << '--inline-source'
   rdoc.rdoc_files.include('README')
   rdoc.rdoc_files.include('vendor/rails/railties/CHANGELOG')
   rdoc.rdoc_files.include('vendor/rails/railties/MIT-LICENSE')

Solution 2

Modify rake as the following:

--- rake/lib/rake/rdoctask.rb        6 Oct 2005 22:49:11 -0000       1.15
+++ rake/lib/rake/rdoctask.rb        21 Jan 2006 04:11:25 -0000
@@ -117,7 +117,7 @@
     end
 
     def option_list
-      result = @options.dup
+      result = @options.collect{|i| i.split(/ /)}.flatten
       result << "-o" << @rdoc_dir
       result << "--main" << quote(main) if main
       result << "--title" << quote(title) if title

Attachments

update_appdoc_for_rake_0.7.0.patch (0.6 kB) - added by adam.greenfield@site5.com on 02/06/06 14:21:03.

Change History

01/21/06 11:01:48 changed by Kazuhiko <kazuhiko@fdiary.net>

Using 'external' flag will also fail...

Solution 3

Modify rails AND rake as the following:

--- railties/lib/tasks/documentation.rake
+++ railties/lib/tasks/documentation.rake
@@ -5,6 +5,7 @@
   rdoc.options << '--line-numbers --inline-source'
   rdoc.rdoc_files.include('doc/README_FOR_APP')
   rdoc.rdoc_files.include('app/**/*.rb')
+  rdoc.external = true
 }
 
 plugins = FileList['vendor/plugins/**'].map {|plugin| File.basename(plugin)}
@@ -74,4 +73,5 @@
   rdoc.rdoc_files.include('vendor/rails/activesupport/README')
   rdoc.rdoc_files.include('vendor/rails/activesupport/CHANGELOG')
   rdoc.rdoc_files.include('vendor/rails/activesupport/lib/active_support/**/*.rb')
+  rdoc.external = true
 }

AND

--- rake/lib/rake/rdoctask.rb        6 Oct 2005 22:49:11 -0000       1.15
+++ rake/lib/rake/rdoctask.rb        21 Jan 2006 10:43:20 -0000
@@ -107,7 +107,7 @@
        args = option_list + @rdoc_files
        if @external
          argstring = args.join(' ')
-         sh %{ruby -Ivendor vender/rd #{argstring}}
+         sh %{rdoc #{argstring}}
        else
          require 'rdoc/rdoc'
          RDoc::RDoc.new.document(args)

01/21/06 23:14:14 changed by david

  • status changed from new to closed.
  • resolution set to fixed.

(In [3451]) Fixed documentation tasks to work with Rake 0.7.0 (closes #3563) [kazuhiko@fdiary.net]

01/30/06 12:14:36 changed by Kazuhiko <kazuhiko@fdiary.net>

  • status changed from closed to reopened.
  • resolution deleted.

rdoc tasks in 'rails/*/Rakefile' also need to be fixed...

Index: actionmailer/Rakefile
===================================================================
--- actionmailer/Rakefile       (revision 3497)
+++ actionmailer/Rakefile       (working copy)
@@ -33,7 +33,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Action Mailer -- Easy email delivery and testing"
-  rdoc.options << '--line-numbers --inline-source --main README --accessor adv_
attr_accessor=M'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
 << '--accessor' << 'adv_attr_accessor=M'
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.rdoc_files.include('README', 'CHANGELOG')
   rdoc.rdoc_files.include('lib/action_mailer.rb')
Index: activesupport/Rakefile
===================================================================
--- activesupport/Rakefile      (revision 3497)
+++ activesupport/Rakefile      (working copy)
@@ -29,7 +29,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Active Support -- Utility classes and standard library exten
sions from Rails"
-  rdoc.options << '--line-numbers --inline-source --main README'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--main README'
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.rdoc_files.include('README', 'CHANGELOG')
   rdoc.rdoc_files.include('lib/active_support.rb')
Index: activerecord/Rakefile
===================================================================
--- activerecord/Rakefile       (revision 3497)
+++ activerecord/Rakefile       (working copy)
@@ -76,7 +76,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Active Record -- Object-relation mapping put on rails"
-  rdoc.options << '--line-numbers --inline-source --accessor cattr_accessor=obj
ect'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cat
tr_accessor=object'
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
   rdoc.rdoc_files.include('lib/**/*.rb')
Index: actionpack/Rakefile
===================================================================
--- actionpack/Rakefile (revision 3497)
+++ actionpack/Rakefile (working copy)
@@ -37,7 +37,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Action Pack -- On rails from request to response"
-  rdoc.options << '--line-numbers --inline-source --main README'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'

   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
   rdoc.rdoc_files.include('lib/**/*.rb')
Index: actionwebservice/Rakefile
===================================================================
--- actionwebservice/Rakefile   (revision 3497)
+++ actionwebservice/Rakefile   (working copy)
@@ -35,7 +35,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Action Web Service -- Web services for Action Pack"
-  rdoc.options << '--line-numbers --inline-source --main README --accessor clas
s_inheritable_option=RW'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
 << '--accessor' << 'class_inheritable_option=RW'
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.rdoc_files.include('README')
   rdoc.rdoc_files.include('CHANGELOG')
Index: railties/Rakefile
===================================================================
--- railties/Rakefile   (revision 3497)
+++ railties/Rakefile   (working copy)
@@ -233,7 +233,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Railties -- Gluing the Engine to the Rails"
-  rdoc.options << '--line-numbers --inline-source --accessor cattr_accessor=obj
ect'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cat
tr_accessor=object'
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.rdoc_files.include('README', 'CHANGELOG')
   rdoc.rdoc_files.include('lib/*.rb')

02/06/06 14:20:10 changed by adam.greenfield@site5.com

  • cc set to adam.greenfield@site5.com.

In the same vein as changes applied in [3451], the appdoc task also needs to be updated. Attaching patch

02/06/06 14:21:03 changed by adam.greenfield@site5.com

  • attachment update_appdoc_for_rake_0.7.0.patch added.

02/06/06 14:26:25 changed by Kazuhiko <kazuhiko@fdiary.net>

The patch to activesupport/Rakefile above is wrong, sorry. The following is a correct one:

--- activesupport/Rakefile      (revision 3545)
+++ activesupport/Rakefile      (working copy)
@@ -29,7 +29,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Active Support -- Utility classes and standard library exten
sions from Rails"
-  rdoc.options << '--line-numbers --inline-source --main README'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'

   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.rdoc_files.include('README', 'CHANGELOG')
   rdoc.rdoc_files.include('lib/active_support.rb')

02/26/06 00:59:29 changed by david

  • status changed from reopened to closed.
  • resolution set to fixed.

03/09/06 02:36:33 changed by Kazuhiko <kazuhiko@fdiary.net>

  • status changed from closed to reopened.
  • resolution deleted.

The following revise also seems to be needed for rdoc targets:

Index: actionmailer/Rakefile
===================================================================
--- actionmailer/Rakefile       (revision 3819)
+++ actionmailer/Rakefile       (working copy)
@@ -33,7 +33,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Action Mailer -- Easy email delivery and testing"
-  rdoc.options << '--line-numbers' << '--inline-source' << '--main README' << '--accessor adv_attr_accessor=M'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--accessor' << 'adv_attr_accessor=M'
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.rdoc_files.include('README', 'CHANGELOG')
   rdoc.rdoc_files.include('lib/action_mailer.rb')
Index: activesupport/Rakefile
===================================================================
--- activesupport/Rakefile      (revision 3819)
+++ activesupport/Rakefile      (working copy)
@@ -29,7 +29,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Active Support -- Utility classes and standard library extensions from Rails"
-  rdoc.options << '--line-numbers' << '--inline-source' << '--main README'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.rdoc_files.include('README', 'CHANGELOG')
   rdoc.rdoc_files.include('lib/active_support.rb')
Index: actionpack/Rakefile
===================================================================
--- actionpack/Rakefile (revision 3819)
+++ actionpack/Rakefile (working copy)
@@ -44,7 +44,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Action Pack -- On rails from request to response"
-  rdoc.options << '--line-numbers' << '--inline-source' << '--main README'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
   rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
   rdoc.rdoc_files.include('lib/**/*.rb')
Index: actionwebservice/Rakefile
===================================================================
--- actionwebservice/Rakefile   (revision 3819)
+++ actionwebservice/Rakefile   (working copy)
@@ -43,7 +43,7 @@
 Rake::RDocTask.new { |rdoc|
   rdoc.rdoc_dir = 'doc'
   rdoc.title    = "Action Web Service -- Web services for Action Pack"
-  rdoc.options << '--line-numbers' << '--inline-source' << '--main README' << '--accessor class_inheritable_option=RW'
+  rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--accessor' << 'class_inheritable_option=RW'
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']

03/18/06 16:51:47 changed by david

  • status changed from reopened to closed.
  • resolution set to fixed.