One of my biggest pet peeves in doing QA is when I spend half a day trying to track down why a bug I thought I’d fixed has cropped up again, only to discover that the reporter was looking at an old version of the application. Good revision tracking is vital to doing efficient QA. Here’s a little trick for removing any uncertainty about what version of the app you’re looking at.

Capistrano, after it exports an application from an SCM repository (such as a Subversion repository), writes an extra file to the application’s root directory. The file is named “REVISION”, and, as you might imagine, it contains the revision number that was exported. Displaying this information in your application’s UI is straightforward. Here’s the addition I made to a view partial that is displayed on the application’s home page:

  <p>Application revision < %= app_revision %></p>

And here’s the app_revision helper method:

module ApplicationHelper
  # ...
  def app_revision
    revision_file = File.join(RAILS_ROOT, "REVISION")
    if File.readable?(revision_file)
      IO.read(revision_file)
    else
      "unknown"
    end
  end
end

Of course, this isn’t very efficient – it will re-load the file every time a page is rendered. Optimization is left as an exercise to the reader. But it accomplishes its purpose: now whenever someone reports a bug in the app, I can ask them to go to the application home page and tell me what the revision number is. No more trying to remember whether I pushed out the latest changes to the beta server.

Published by Avdi Grimm

2 Comments

  1. Flash Website Builder…

    […] Fantastic post; thought I wish to back-link to this… […]…

    Reply
  2. Check this out…

    […] that is the end of this article. Here you’ll find some sites that we think you’ll appreciate, just click the links over[…]……

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *