summaryrefslogtreecommitdiff
path: root/lib/gitlab.rb
diff options
context:
space:
mode:
authorBrandon Labuschagne <blabuschagne@gitlab.com>2019-01-14 16:10:19 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2019-01-14 16:10:19 +0000
commitcc281afb27365adef2d24c85f83686cc8b829187 (patch)
tree0c2d33acde02760d7d45e22c0cdba8f8a8a3f2d6 /lib/gitlab.rb
parent31af7daf788f3f65d630ab4e5d8bae4bd5607807 (diff)
downloadgitlab-ce-cc281afb27365adef2d24c85f83686cc8b829187.tar.gz
Resolve "Add "What's new" menu item in top navigation"
Diffstat (limited to 'lib/gitlab.rb')
-rw-r--r--lib/gitlab.rb48
1 files changed, 40 insertions, 8 deletions
diff --git a/lib/gitlab.rb b/lib/gitlab.rb
index 2ef54658a11..074d04fc32a 100644
--- a/lib/gitlab.rb
+++ b/lib/gitlab.rb
@@ -27,12 +27,52 @@ module Gitlab
end
end
+ def self.version_info
+ Gitlab::VersionInfo.parse(Gitlab::VERSION)
+ end
+
COM_URL = 'https://gitlab.com'.freeze
APP_DIRS_PATTERN = %r{^/?(app|config|ee|lib|spec|\(\w*\))}
SUBDOMAIN_REGEX = %r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}
VERSION = File.read(root.join("VERSION")).strip.freeze
INSTALLATION_TYPE = File.read(root.join("INSTALLATION_TYPE")).strip.freeze
+ def self.pre_release?
+ VERSION.include?('pre')
+ end
+
+ def self.final_release?
+ !VERSION.include?('rc') && !pre_release?
+ end
+
+ def self.minor_release
+ "#{version_info.major}.#{version_info.minor}"
+ end
+
+ def self.prev_minor_release
+ "#{version_info.major}.#{version_info.minor - 1}"
+ end
+
+ def self.prev_major_release
+ "#{version_info.major.to_i - 1}"
+ end
+
+ def self.new_major_release?
+ version_info.minor.to_i.zero?
+ end
+
+ def self.previous_release
+ if version_info.minor_version?
+ if version_info.patch_version?
+ minor_release
+ else
+ prev_minor_release
+ end
+ else
+ prev_major_release
+ end
+ end
+
def self.com?
# Check `gl_subdomain?` as well to keep parity with gitlab.com
Gitlab.config.gitlab.url == COM_URL || gl_subdomain?
@@ -49,12 +89,4 @@ module Gitlab
def self.dev_env_or_com?
Rails.env.development? || org? || com?
end
-
- def self.pre_release?
- VERSION.include?('pre')
- end
-
- def self.version_info
- Gitlab::VersionInfo.parse(Gitlab::VERSION)
- end
end