Search code examples
ruby-on-railsrdoc

creating Rdoc for a rails app


I would like to generate a documentation to my rails (2.3.8) project. When I tried

rake doc:rails
rake doc:rerails

It creates documentation for all the classes including standard ruby classes and all the ruby files in vendor directory (plugins etc..)

How can I create rdoc documentation only for ruby classes, files in following directories

  1. app folder (all the models, controllers and views)
  2. config folder
  3. lib folder

Solution

  • I added this to my Rakefile;

    RDoc::Task.new :rdoc do |rdoc|
      rdoc.main = "README.rdoc"
    
      rdoc.rdoc_files.include("README.rdoc", "doc/*.rdoc", "app/**/*.rb", "lib/*.rb", "config/**/*.rb")
      #change above to fit needs
    
      rdoc.title = "App Documentation"
      rdoc.options << "--all" 
    end
    

    Then run;

    rake rdoc
    

    Check out the RDoc::Task docs for more http://rdoc.rubyforge.org/RDoc/Task.html

    Admittedly I am on a rails 3 app, but I think this works the same.