Skip to content

Instantly share code, notes, and snippets.

@ariejan
Created August 28, 2009 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ariejan/176845 to your computer and use it in GitHub Desktop.
Save ariejan/176845 to your computer and use it in GitHub Desktop.
Easily report app version and revision numbers.
You must be using git and capistrano to deploy your app. Capistrano will place a file in your Rails.root named 'REVISION'. Tested with the following capistrano setting:
set :scm, :git
set :deploy_via, :remote_cache
# config/initializers/app_version.rb
begin
APP_VERSION = "0.8.1"
File.open(File.join(Rails.root, "REVISION")) do |f|
APP_REVISION = f.read.strip
APP_REVISION_SHORT = APP_REVISION[0..6]
end
rescue
APP_REVISION = "????"
APP_REVISION_SHORT = "??"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment