# Set the application version from the VERSION file in the root folder
version_file = "#{RAILS_ROOT}/VERSION"
APP_VERSION = File.exists?(version_file) ? File.new(version_file).read : ""

Big thanks to Nick Tidey for sharing this with me.

- Mike

On Thu, Mar 25, 2010 at 12:35 PM, Brian Chiha <[email protected]> wrote:
> In our release process using Capistrano deploy, we've put a hook in to ask 
> for a version number.  This number is then used to add a git tag and we add 
> it to a text file in our rails root directory.
>
> In our code we have a config/initilizers file that reads this text file and 
> stores the value as a constant.  Then the constant is used in our views.
>
> I guess we put it in a file because getting it out of a git tag (at least 
> using rgit) was a bit of a struggle.
>
> Brian.
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] 
> On Behalf Of Joshua Partogi
> Sent: Thursday, 25 March 2010 12:00 PM
> To: [email protected]
> Subject: [rails-oceania] Where would be the best location to put the version 
> number in Rails apps?
>
> Hi all,
>
> This might be a trivial questions for all of you here. My question is,
> where would be the best location to put version number in Rails apps?
>
> The version number that I will be using will be retrieved from git
> tag. I also need to display this in the views template. I was thinking
> to write it in application_helper, but I was unsure if this would be
> the best practice. Can you please share your experience?
>
> Thank you in advance for all of your suggestions.
>
>
> Cheers.
>
> --
> http://twitter.com/scrum8
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby or Rails Oceania" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rails-oceania?hl=en.
>
>
>
> This email is intended for the use of the individual or entity it is 
> addressed to and may contain information that is confidential, legally 
> privileged, commercially sensitive, or protected by copyright. If it contains 
> financial product advice, the advice is of a general nature and you will need 
> to determine how appropriate it is for you.
>
> If you are not the intended recipient you must not disclose, disseminate, 
> distribute or copy information contained in it. If you have received this 
> e-mail in error, please notify the sender immediately and destroy the 
> original message. While this mail and any attachments have been scanned for 
> common computer viruses and found to be virus free, we recommend that you 
> perform your own virus checks before opening any attachments.
>
> ______________________________________________________________________________
>
> This email has been scrubbed for your protection by SMX.
> For more information visit http://smxemail.com
> ______________________________________________________________________________
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby or Rails Oceania" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rails-oceania?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to