2013-02-06 03:16:51 +08:00
|
|
|
module Discourse
|
2013-08-08 06:47:04 +08:00
|
|
|
# work around reloader
|
|
|
|
unless defined? ::Discourse::VERSION
|
2013-03-13 11:06:58 +08:00
|
|
|
module VERSION #:nodoc:
|
2014-08-27 03:24:07 +08:00
|
|
|
MAJOR = 1
|
2017-01-07 05:10:39 +08:00
|
|
|
MINOR = 8
|
2014-08-27 03:24:07 +08:00
|
|
|
TINY = 0
|
2017-06-01 04:18:32 +08:00
|
|
|
PRE = nil
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2013-03-13 11:06:58 +08:00
|
|
|
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
|
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
2015-04-28 01:06:53 +08:00
|
|
|
|
|
|
|
def self.has_needed_version?(current, needed)
|
|
|
|
current_split = current.split('.')
|
|
|
|
needed_split = needed.split('.')
|
|
|
|
|
|
|
|
(0..[current_split.size, needed_split.size].max).each do |idx|
|
|
|
|
current_str = current_split[idx] || ''
|
|
|
|
|
|
|
|
c0 = (needed_split[idx] || '').sub('beta', '').to_i
|
|
|
|
c1 = (current_str || '').sub('beta', '').to_i
|
|
|
|
|
|
|
|
# beta is less than stable
|
|
|
|
return false if current_str.include?('beta') && (c0 == 0) && (c1 > 0)
|
|
|
|
|
|
|
|
return true if c1 > c0
|
|
|
|
return false if c0 > c1
|
|
|
|
end
|
|
|
|
|
|
|
|
true
|
|
|
|
end
|
2013-03-13 11:06:58 +08:00
|
|
|
end
|