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

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. require 'rexml/document'
  2. module Redmine
  3. module VERSION #:nodoc:
  4. MAJOR = 1
  5. MINOR = 2
  6. TINY = 2
  7. # Branch values:
  8. # * official release: nil
  9. # * stable branch: stable
  10. # * trunk: devel
  11. BRANCH = 'devel'
  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 =
  25. xml.elements['wc-entries'].elements[1].attributes['revision'].to_i
  26. end
  27. rescue
  28. # Could not find the current revision
  29. end
  30. end
  31. revision
  32. end
  33. REVISION = self.revision
  34. ARRAY = [MAJOR, MINOR, TINY, BRANCH, REVISION].compact
  35. STRING = ARRAY.join('.')
  36. def self.to_a; ARRAY end
  37. def self.to_s; STRING end
  38. end
  39. end