Skip to content

Instantly share code, notes, and snippets.

@plukevdh
Created November 16, 2009 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plukevdh/236358 to your computer and use it in GitHub Desktop.
Save plukevdh/236358 to your computer and use it in GitHub Desktop.
Easy way to track versions and even display the svn revision number
module VersionInfo
#Version number file
MAJOR_VERSION = 1
ENHANCE_VERSION = 3
FIX_VERSION = 2
BETA_FLAG = true
RC_FLAG = false
def self.get_svn_revision
`svn info`.split("\n")[4][/\d+/].to_i
end
def is_beta?
BETA_FLAG
end
def self.get_version_number
BETA_FLAG == true ? beta = " beta " : ""
RC_FLAG == true ? rc = " release candidate " : ""
version = "(r.#{get_svn_revision})" unless RAILS_ENV == "production"
"#{MAJOR_VERSION}.#{ENHANCE_VERSION}.#{FIX_VERSION}#{rc}#{beta}#{version}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment