How and when do you increment the version number on an internal web application? If you are not selling your software, not publishing the source but simply providing a service to bunch of users, there is really no such thing as a “release”. All you have is continuous and gradual trickle of patches and updates getting deployed to the production server.
Still, does patching currently used code on the prooduction server constitute a release? I don’t know, but where I work we kinda pretend that it does. So whenever we roll out some new code into production, we nudge the version number up.
Depending on the size of the patch, we either increment the major, minor or the build number. Typically, if we touch the database schema, it’s a major number. If we add new functionality, or fundamentally change how something works, it’s a minor increment. If it’s a minor bugfix or a cosmetic change we increment the build number.
This is of course independent of the internal revision numbers in subversion which are a whole different story. Since I was tired of editing the version and changelog files each time I would roll out a patch, I wrote this little script to help me out. For the record, our version file looks somewhat like this:
version 3.2.5
There is nothing else in the file, and it gets grabbed by scripts in few places for display and etc. The changelog looks like this:
version 1.1.2 – some stuff [Thu Dec 6 12:30:11 EST 2007]
version 1.1.3 – bla bla bla – [Thu Dec 6 12:32:05 EST 2007]
version 1.2.0 – some more stuff [Thu Dec 6 12:33:31 EST 2007]
It’s a plain text file that sits in the root directory, and is linked somewhere in the footer in case users want to see what was changed recently. The script itself is a mix of bahs, awk and zenity goodness. Directory names were changed to protect the guilty more than the innocent:
#!/bin/bash
function changelog
{
ver=`cat ~/project/version`
comment=$(zenity --entry --text "$ver comment:" --title "Changelog")
d=`date`
echo $ver - $comment [$d] >> ~/project/changelog.txt
}
ans=$(zenity --list --text "Increment What?" --radiolist --column "Pick" --column "Option" TRUE "Build Number (0.0.x)" FALSE "Minor Version (0.x.0)" FALSE "Major Version (x.0.0)");
case "$ans" in
'Build Number (0.0.x)')
awk 'BEGIN{FS="."} {print $1 "." $2 "." $3+1}' ~/project/version > /tmp/version && mv /tmp/version ~/project/version && changelog;
;;
'Minor Version (0.x.0)')
awk 'BEGIN{FS="."} {print $1 "." $2+1 ".0"}' ~/project/version > /tmp/version && mv /tmp/version ~/project/version && changelog;
;;
'Major Version (x.0.0)')
awk 'BEGIN{FS=" "} {print "version " int($2+1) ".0.0"}' ~/project/version > /tmp/version && mv /tmp/version ~/project/version && changelog;
;;
esac
When you run it, it should pop up a nice dialog asking you which version number do you want to increment:
Then once you choose, it will prompt you for a comment for the changelog:
There are probably better ways of doing this, and incrementing your version number but this is how I have been doing it lately. How do you do it?
[tags]version, versioning, programming, zenity, bash, development[/tags]
Pingback: My Version Increment Script [ Terminally Incoherent ]