Mercurial > hg > soundsoftware-site
comparison lib/redmine/version.rb @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 0579821a129a |
children | 753f1380d6bc 0c939c159af4 |
comparison
equal
deleted
inserted
replaced
245:051f544170fe | 441:cbce1fd3b1b7 |
---|---|
1 require 'rexml/document' | 1 require 'rexml/document' |
2 | 2 |
3 module Redmine | 3 module Redmine |
4 module VERSION #:nodoc: | 4 module VERSION #:nodoc: |
5 MAJOR = 1 | 5 MAJOR = 1 |
6 MINOR = 1 | 6 MINOR = 2 |
7 TINY = 1 | 7 TINY = 0 |
8 | 8 |
9 # Branch values: | 9 # Branch values: |
10 # * official release: nil | 10 # * official release: nil |
11 # * stable branch: stable | 11 # * stable branch: stable |
12 # * trunk: devel | 12 # * trunk: devel |
13 BRANCH = 'devel' | 13 BRANCH = 'stable' |
14 | 14 |
15 def self.revision | 15 def self.revision |
16 revision = nil | 16 revision = nil |
17 entries_path = "#{RAILS_ROOT}/.svn/entries" | 17 entries_path = "#{RAILS_ROOT}/.svn/entries" |
18 if File.readable?(entries_path) | 18 if File.readable?(entries_path) |
19 begin | 19 begin |
20 f = File.open(entries_path, 'r') | 20 f = File.open(entries_path, 'r') |
21 entries = f.read | 21 entries = f.read |
22 f.close | 22 f.close |
23 if entries.match(%r{^\d+}) | 23 if entries.match(%r{^\d+}) |
24 revision = $1.to_i if entries.match(%r{^\d+\s+dir\s+(\d+)\s}) | 24 revision = $1.to_i if entries.match(%r{^\d+\s+dir\s+(\d+)\s}) |
25 else | 25 else |
26 xml = REXML::Document.new(entries) | 26 xml = REXML::Document.new(entries) |
27 revision = xml.elements['wc-entries'].elements[1].attributes['revision'].to_i | 27 revision = |
28 end | 28 xml.elements['wc-entries'].elements[1].attributes['revision'].to_i |
29 rescue | 29 end |
30 # Could not find the current revision | 30 rescue |
31 end | 31 # Could not find the current revision |
32 end | 32 end |
33 revision | 33 end |
34 revision | |
34 end | 35 end |
35 | 36 |
36 REVISION = self.revision | 37 REVISION = self.revision |
37 ARRAY = [MAJOR, MINOR, TINY, BRANCH, REVISION].compact | 38 ARRAY = [MAJOR, MINOR, TINY, BRANCH, REVISION].compact |
38 STRING = ARRAY.join('.') | 39 STRING = ARRAY.join('.') |
39 | 40 |
40 def self.to_a; ARRAY end | 41 def self.to_a; ARRAY end |
41 def self.to_s; STRING end | 42 def self.to_s; STRING end |
42 end | 43 end |
43 end | 44 end |