I'm current developing a Rails application. I deploy this application to a demonstration server using <ahref="http://manuals.rubyonrails.com/read/book/17">capistrano</a>.
To streamline feedback and bug reporting I want to show the current revision number of the code that's published on the demo server to show in the footer of every page.
First I looked into Subversion keyword expansion, but this is marked as 'evil' and it doesn't meet my requirements. I want to show the latest revision number of the entire repository and not just that of the current file.
Luckily for me, I use capistrano. Here's how I fixed the problem.
<!--more-->
First of all, I created a partial that contains the revision number and render this in my layout.
That's it. When I deploy the application, the current code is checked out and and the layouts/_revision.rhtml file is overwritten with the current revision information.
<h3>Bonus</h3>
You could also leave the layouts/_revision.rhtml files empty and update it for your demonstration server, but not for your production box. This way there won't be a revision added.
Of course, you could also create a deploy_demonstration method in deploy.rb and call publish_revision manually from there.