Working on the new version of subdelay.com I came up with a couple of plugins for Rails that although functionality-wise are dirt simple turned out to be rather useful. Therefore I have decided to open source them on GitHub and also do a little writeup here on the blog. VersionMaster
First up is VersionMaster. I needed a simple way to manage a version number (eg. "v1.0.8" etc) for the site, in order to keep track of minor and major updates as I changed things around and added new features. More importantly, I wanted to have this happen automatically whenever I deployed a new release using Capistrano. I first took a look at toland's app_version but it didn't quite do what I needed so I came up with my own little implementation.
Install the plugin using
script/plugin install git://github.com/balvig/version_master.git
The file "version.yml" will be copied into the config directory:
You can edit this file to manually set the version number or use the rake tasks below:
You can also use the built-in Capistrano recipe to update versions when deploying (which is how I use it):
You can then use the constant APP_VERSION in your views or elsewhere to display the current version.