Skip to content

A platform for community discussion. Free, open, simple.

DEV: Refactor `Discourse::VERSION` and add `-dev` support (#22807)

David Taylor6222a6033592
diff --git a/lib/version.rb b/lib/version.rb
index 26db10bb5fa..ffc72bc9b8e 100644
--- a/lib/version.rb
+++ b/lib/version.rb
@@ -7,12 +7,16 @@ module Discourse
# work around reloader
unless defined?(::Discourse::VERSION)
module VERSION #:nodoc:
- MAJOR = 3
- MINOR = 1
- TINY = 0
- PRE = "beta6"
+ STRING = "3.1.0.beta6"
- STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
+ PARTS = STRING.split(".")
+ private_constant :PARTS
+
+ MAJOR = PARTS[0].to_i
+ MINOR = PARTS[1].to_i
+ TINY = PARTS[2].to_i
+ PRE = PARTS[3]&.split("-", 2)&.first
+ DEV = PARTS[3]&.split("-", 2)&.second
end
end