What would be the best way to version a rails application? We want to start to get into more structured testing cycles and having a set version per build is a part of that. We use subversion but I would like to avoid using revision numbers for versions. Is there an easy way to do this automatically? Or should I just define a app_version method in the application helper?
(We are using subversion for source control)
You can use subversion keywords:
Essentially, you could have a helper method…
$Id$is a keyword which svn will expand (the link above has others you could use). Now, we set the keywords property on that file to let svn know that it should be replacing keywords (let’s assume application_helper.rb):Now if you look at application_helper.rb it’ll read (something like this, with the version, date, user name changed)
Obviously, you could assign this to a variable and parse it to the required format, included it in your view templates etc. Or do the same thing but instead of application_helper.rb, just use a file called
VERSIONin your root dir.