summaryrefslogtreecommitdiff
path: root/lib/gitlab.rb
diff options
context:
space:
mode:
authorDennis Tang <dtang@gitlab.com>2018-05-25 23:56:17 +0200
committerDennis Tang <dtang@gitlab.com>2018-05-25 23:56:17 +0200
commit95a63a881673533e3fd44243297d1a81e19396b6 (patch)
tree9a3190b813e2d599043394b30afaa5a5c8f8e565 /lib/gitlab.rb
parent48e46f959716c8915f5b59d1314b5e5781f3cd8d (diff)
parent50c8ed2bf498c69d3d52ba1451274e3fbf438429 (diff)
downloadgitlab-ce-95a63a881673533e3fd44243297d1a81e19396b6.tar.gz
Merge remote-tracking branch 'origin/master' into 38759-fetch-available-parameters-directly-from-gke-when-creating-a-cluster
Diffstat (limited to 'lib/gitlab.rb')
-rw-r--r--lib/gitlab.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/gitlab.rb b/lib/gitlab.rb
index c5498d0da1a..a129746e2c6 100644
--- a/lib/gitlab.rb
+++ b/lib/gitlab.rb
@@ -9,11 +9,30 @@ module Gitlab
Settings
end
+ def self.migrations_hash
+ @_migrations_hash ||= Digest::MD5.hexdigest(ActiveRecord::Migrator.get_all_versions.to_s)
+ end
+
+ def self.revision
+ @_revision ||= begin
+ if File.exist?(root.join("REVISION"))
+ File.read(root.join("REVISION")).strip.freeze
+ else
+ result = Gitlab::Popen.popen_with_detail(%W[#{config.git.bin_path} log --pretty=format:%h -n 1])
+
+ if result.status.success?
+ result.stdout.chomp.freeze
+ else
+ "Unknown".freeze
+ end
+ end
+ end
+ 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
- REVISION = Gitlab::Popen.popen(%W(#{config.git.bin_path} log --pretty=format:%h -n 1)).first.chomp.freeze
def self.com?
# Check `gl_subdomain?` as well to keep parity with gitlab.com