@@ -1,43 +1,43 | |||
|
1 | 1 | require 'rexml/document' |
|
2 | 2 | |
|
3 | 3 | module Redmine |
|
4 | 4 | module VERSION #:nodoc: |
|
5 |
MAJOR = |
|
|
6 |
MINOR = |
|
|
7 |
TINY = |
|
|
5 | MAJOR = 1 | |
|
6 | MINOR = 0 | |
|
7 | TINY = 0 | |
|
8 | 8 | |
|
9 | 9 | # Branch values: |
|
10 | 10 | # * official release: nil |
|
11 | 11 | # * stable branch: stable |
|
12 | 12 | # * trunk: devel |
|
13 | 13 | BRANCH = 'devel' |
|
14 | 14 | |
|
15 | 15 | def self.revision |
|
16 | 16 | revision = nil |
|
17 | 17 | entries_path = "#{RAILS_ROOT}/.svn/entries" |
|
18 | 18 | if File.readable?(entries_path) |
|
19 | 19 | begin |
|
20 | 20 | f = File.open(entries_path, 'r') |
|
21 | 21 | entries = f.read |
|
22 | 22 | f.close |
|
23 | 23 | if entries.match(%r{^\d+}) |
|
24 | 24 | revision = $1.to_i if entries.match(%r{^\d+\s+dir\s+(\d+)\s}) |
|
25 | 25 | else |
|
26 | 26 | xml = REXML::Document.new(entries) |
|
27 | 27 | revision = xml.elements['wc-entries'].elements[1].attributes['revision'].to_i |
|
28 | 28 | end |
|
29 | 29 | rescue |
|
30 | 30 | # Could not find the current revision |
|
31 | 31 | end |
|
32 | 32 | end |
|
33 | 33 | revision |
|
34 | 34 | end |
|
35 | 35 | |
|
36 | 36 | REVISION = self.revision |
|
37 | 37 | ARRAY = [MAJOR, MINOR, TINY, BRANCH, REVISION].compact |
|
38 | 38 | STRING = ARRAY.join('.') |
|
39 | 39 | |
|
40 | 40 | def self.to_a; ARRAY end |
|
41 | 41 | def self.to_s; STRING end |
|
42 | 42 | end |
|
43 | 43 | end |
General Comments 0
You need to be logged in to leave comments.
Login now