
I just need to do that, use a custom rdoc template to generate a documentation for a Rails project.
My main concern, regarding the different solutions I found on the web, was I didn’t want to have a template in the ruby installation directory but one that resides in a subdirectory of my rails application.
In fact it’s not a problem … when you find the good command. Here’s my rake task to generate the documentation (I put the Jamis Buck customized template in RAILS_ROOT/doc/rdoc_template/jamis.rb)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :doc do | |
desc "Generate documentation for the application" | |
Rake::RDocTask.new("app_jamis") { |rdoc| | |
rdoc.rdoc_dir = 'doc/app_jamis' | |
rdoc.title = "My Website Documentation" | |
rdoc.template = "doc/rdoc_template/jamis.rb" | |
rdoc.options << '--line-numbers' << '--inline-source' | |
rdoc.rdoc_files.include('doc/README_FOR_APP') | |
rdoc.rdoc_files.include('app/**/*.rb') | |
rdoc.rdoc_files.include('lib/**/*.rb') | |
} | |
end |
The important part is :
rdoc.template = "doc/rdoc_template/jamis.rb"
I tried to use the—template= and -T options in rdoc.options but it didn’t work… then I found that the RDocTask appends its template variable to the options passed to RDoc bypassing mine.
No comments:
Post a Comment