To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / lib / redmine / version.rb @ 912:5e80956cc792
History | View | Annotate | Download (1.05 KB)
| 1 | 0:513646585e45 | Chris | require 'rexml/document'
|
|---|---|---|---|
| 2 | |||
| 3 | module Redmine |
||
| 4 | module VERSION #:nodoc: |
||
| 5 | MAJOR = 1 |
||
| 6 | 909:cbb26bc654de | Chris | MINOR = 3 |
| 7 | 507:0c939c159af4 | Chris | TINY = 1 |
| 8 | 441:cbce1fd3b1b7 | Chris | |
| 9 | 0:513646585e45 | Chris | # Branch values:
|
| 10 | # * official release: nil
|
||
| 11 | # * stable branch: stable
|
||
| 12 | # * trunk: devel
|
||
| 13 | 441:cbce1fd3b1b7 | Chris | BRANCH = 'stable' |
| 14 | 0:513646585e45 | Chris | |
| 15 | def self.revision |
||
| 16 | revision = nil
|
||
| 17 | 909:cbb26bc654de | Chris | entries_path = "#{Rails.root}/.svn/entries"
|
| 18 | 0:513646585e45 | Chris | if File.readable?(entries_path) |
| 19 | begin
|
||
| 20 | f = File.open(entries_path, 'r') |
||
| 21 | entries = f.read |
||
| 22 | f.close |
||
| 23 | 441:cbce1fd3b1b7 | Chris | if entries.match(%r{^\d+}) |
| 24 | revision = $1.to_i if entries.match(%r{^\d+\s+dir\s+(\d+)\s}) |
||
| 25 | else
|
||
| 26 | xml = REXML::Document.new(entries) |
||
| 27 | revision = |
||
| 28 | xml.elements['wc-entries'].elements[1].attributes['revision'].to_i |
||
| 29 | end
|
||
| 30 | rescue
|
||
| 31 | # Could not find the current revision
|
||
| 32 | end
|
||
| 33 | end
|
||
| 34 | revision |
||
| 35 | 0:513646585e45 | Chris | end
|
| 36 | |||
| 37 | REVISION = self.revision |
||
| 38 | 441:cbce1fd3b1b7 | Chris | ARRAY = [MAJOR, MINOR, TINY, BRANCH, REVISION].compact |
| 39 | STRING = ARRAY.join('.') |
||
| 40 | 909:cbb26bc654de | Chris | |
| 41 | 441:cbce1fd3b1b7 | Chris | def self.to_a; ARRAY end |
| 42 | 909:cbb26bc654de | Chris | def self.to_s; STRING end |
| 43 | 0:513646585e45 | Chris | end
|
| 44 | end |