annotate lib/redmine/version.rb @ 599:251b380117ce feature_227

Introduce a new latest_downloads plugin to manage active and shortcut for attachments. Add a table for attachment active/shortcut data. Move existing active-handler code into the new plugin (but still using the "old" active column in the attachments table). Note the files_controller stuff doesn't actually work here.
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Tue, 16 Aug 2011 17:01:19 +0100
parents 851510f1b535
children 5e80956cc792
rev   line source
Chris@0 1 require 'rexml/document'
Chris@0 2
Chris@0 3 module Redmine
Chris@0 4 module VERSION #:nodoc:
Chris@0 5 MAJOR = 1
Chris@441 6 MINOR = 2
Chris@507 7 TINY = 1
Chris@441 8
Chris@0 9 # Branch values:
Chris@0 10 # * official release: nil
Chris@0 11 # * stable branch: stable
Chris@0 12 # * trunk: devel
Chris@441 13 BRANCH = 'stable'
Chris@0 14
Chris@0 15 def self.revision
Chris@0 16 revision = nil
Chris@0 17 entries_path = "#{RAILS_ROOT}/.svn/entries"
Chris@0 18 if File.readable?(entries_path)
Chris@0 19 begin
Chris@0 20 f = File.open(entries_path, 'r')
Chris@0 21 entries = f.read
Chris@0 22 f.close
Chris@441 23 if entries.match(%r{^\d+})
Chris@441 24 revision = $1.to_i if entries.match(%r{^\d+\s+dir\s+(\d+)\s})
Chris@441 25 else
Chris@441 26 xml = REXML::Document.new(entries)
Chris@441 27 revision =
Chris@441 28 xml.elements['wc-entries'].elements[1].attributes['revision'].to_i
Chris@441 29 end
Chris@441 30 rescue
Chris@441 31 # Could not find the current revision
Chris@441 32 end
Chris@441 33 end
Chris@441 34 revision
Chris@0 35 end
Chris@0 36
Chris@0 37 REVISION = self.revision
Chris@441 38 ARRAY = [MAJOR, MINOR, TINY, BRANCH, REVISION].compact
Chris@441 39 STRING = ARRAY.join('.')
Chris@0 40
Chris@441 41 def self.to_a; ARRAY end
Chris@0 42 def self.to_s; STRING end
Chris@0 43 end
Chris@0 44 end