2007-10-11 20:59:08 +04:00
|
|
|
require 'rexml/document'
|
|
|
|
|
2007-04-21 16:08:31 +04:00
|
|
|
module Redmine
|
|
|
|
module VERSION #:nodoc:
|
2012-04-25 21:17:49 +04:00
|
|
|
MAJOR = 2
|
2012-12-02 21:57:30 +04:00
|
|
|
MINOR = 2
|
2013-01-09 17:32:39 +04:00
|
|
|
TINY = 1
|
2011-04-26 03:21:06 +04:00
|
|
|
|
2008-11-16 14:49:37 +03:00
|
|
|
# Branch values:
|
|
|
|
# * official release: nil
|
|
|
|
# * stable branch: stable
|
|
|
|
# * trunk: devel
|
|
|
|
BRANCH = 'devel'
|
2007-04-21 16:08:31 +04:00
|
|
|
|
2012-10-12 18:09:58 +04:00
|
|
|
# Retrieves the revision from the working copy
|
2007-10-11 20:59:08 +04:00
|
|
|
def self.revision
|
2012-10-12 18:09:58 +04:00
|
|
|
if File.directory?(File.join(Rails.root, '.svn'))
|
2007-10-11 20:59:08 +04:00
|
|
|
begin
|
2012-10-12 18:09:58 +04:00
|
|
|
path = Redmine::Scm::Adapters::AbstractAdapter.shell_quote(Rails.root.to_s)
|
|
|
|
if `svn info --xml #{path}` =~ /revision="(\d+)"/
|
|
|
|
return $1.to_i
|
2011-04-26 03:21:06 +04:00
|
|
|
end
|
|
|
|
rescue
|
|
|
|
# Could not find the current revision
|
|
|
|
end
|
|
|
|
end
|
2012-10-12 18:09:58 +04:00
|
|
|
nil
|
2007-10-11 20:59:08 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
REVISION = self.revision
|
2011-04-26 03:21:06 +04:00
|
|
|
ARRAY = [MAJOR, MINOR, TINY, BRANCH, REVISION].compact
|
|
|
|
STRING = ARRAY.join('.')
|
2011-08-21 18:13:39 +04:00
|
|
|
|
2011-04-26 03:21:06 +04:00
|
|
|
def self.to_a; ARRAY end
|
2011-08-21 18:13:39 +04:00
|
|
|
def self.to_s; STRING end
|
2007-04-21 16:08:31 +04:00
|
|
|
end
|
|
|
|
end
|