You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

version.rb 1.0KB

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