[LRUG] rake doc:app task changing + seek(Peter)

Steve Ganly steve at concept-shop.com
Tue Nov 18 03:46:59 PST 2008


Hi all,

Two things:

First, I was talking to Peter from Belarus after the last meeting but
didn't swap contact details. If Peter is reading please reply, or if
anyone has details or a surname please let me know. He's working for
the BBC I believe.


Second thing, when making documentation in a rails app with

  rake doc:app

the source files

  doc/README_FOR_APP
  app/**/*.rb
  lib/**/*.rb

are used to create the doc/app/... tree. The source for this is in
/usr/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/tasks/documentation.rake

namespace :doc do
  desc "Generate documentation for the application. Set custom template with
TEMPLATE=/path/to/rdoc/template.rb or title with TITLE=\"Custom Title\""
  Rake::RDocTask.new("app") { |rdoc|
    rdoc.rdoc_dir = 'doc/app'
    rdoc.template = ENV['template'] if ENV['template']
    rdoc.title    = ENV['title'] || "Rails Application Documentation"
    rdoc.options << '--line-numbers' << '--inline-source'
    rdoc.options << '--charset' << 'utf-8'
    rdoc.rdoc_files.include('doc/README_FOR_APP')
    rdoc.rdoc_files.include('app/**/*.rb')
    rdoc.rdoc_files.include('lib/**/*.rb')
  }


I'd like to get this task to do some other things too (rasterize some
SVG graphics for the docs and include doc/TODO.rdoc), but I'm having
trouble.

I'd like to maintain "The Rails Way" of having rake doc:app make the 
documentation, so I don't really want to introduce a new target.

If I try to override the rake task with a local version in say
lib/tasks/documentation.rake

  namespace :doc do

    desc "Generate documentation for the application including images."
    task :app do
      puts "hello from rake doc:app"
    end

  end

Then running rake doc:app still runs the orignal task then my additional
one. I.e. the task isn't overriden it's appended too.

Anyone know how I can stop the original from running so I can only
have my own code run?

Thanks in advance.


Steve Ganly.




More information about the Chat mailing list