Ron Lusk on 10 May 2006 17:25:11 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PhillyOnRails] extend doc:app rake task to Include lib/*?

I needed to do this in order to document the configuration mods I'd made, so I hammered through the code and came up with this kludge:

require 'rake/rdoctask'

class Rake::RDocTask
  alias :orig_initialize :initialize
  def initialize(name)
    puts "initializing '#{name}'"
    if name == "app"
      orig_initialize(name) { |rdoc|
        yield rdoc # Init the way Rails expects
        rdoc.rdoc_files.exclude( # Exclude the standard files

      orig_initialize(name) { |rdoc| yield rdoc }

require 'tasks/rails'

Insert the boldface code into your Rakefile after the rake rdoctask is required and before Rails defines its documentation tasks.  In the new version of initialize, you want to customize only the "app" task (not the "rails" rdoc task), so in that case, add additional files to the rdoc_files after yielding to the original block passed in documentation.rake.  Here you can add files in lib/ or (in my case) add all the files in config/ (one level only) and then exclude the standard ones.

Ron Lusk
talk mailing list