Created
November 16, 2009 21:48
-
-
Save plukevdh/236358 to your computer and use it in GitHub Desktop.
Easy way to track versions and even display the svn revision number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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