Rails 2 Custom Source Annotations

Rails 2.0 has the new rake notes:... tasks built in. If you annotate your code with OPTIMIZE, FIXME, or TODO comments, then rake notes will show all of them, rake notes:fixme will show just the FIXME comments.

What if you want annotations of other comments? I’ve been using XXX for a few years now, so I wrote the following in lib/tasks/notes.rake:

require 'source_annotation_extractor'

namespace :notes do
  desc "Enumerate all XXX annotations"
  task :xxx do
    SourceAnnotationExtractor.enumerate "XXX"
  end
end

Now I can run rake notes:xxx and see all my XXX comments in the project. They don’t show up in the global rake notes task, but…


Related Posts

  1. SPF Records with Rails and ActionMailer
  2. iPhone/iPad UISearchBar and UISearchDisplayController Asynchronous Example
  3. Rails Fragment Caching With Multiple Accounts
  4. Authlogic, Passenger, and cookie_store Sessions Don't Mix
  5. Feedtools Database Cache
You should follow me on Twitter: @patrickxb