diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2018-04-24 15:07:34 +1000 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2018-04-24 15:07:34 +1000 |
commit | 1b9c1ac3adb3d65e51f38e37c4705d46c5618f88 (patch) | |
tree | b724afd0596dd658f7ef7baddf9411ff3e599f7d /lib/gitlab.rb | |
parent | 392c411bdc16386ef42c86afaf8c4d8e4cddb955 (diff) | |
parent | 2e00c1a72afc4b7388bb46bd6d58608e2ae61899 (diff) | |
download | gitlab-ce-1b9c1ac3adb3d65e51f38e37c4705d46c5618f88.tar.gz |
Merge branch 'master' into 10244-add-project-ci-cd-settings
Diffstat (limited to 'lib/gitlab.rb')
-rw-r--r-- | lib/gitlab.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/gitlab.rb b/lib/gitlab.rb index 2526a870976..0a167104bf4 100644 --- a/lib/gitlab.rb +++ b/lib/gitlab.rb @@ -1,20 +1,35 @@ -require_dependency 'gitlab/git' +require_dependency 'settings' +require_dependency 'gitlab/popen' module Gitlab + def self.root + Pathname.new(File.expand_path('..', __dir__)) + end + + def self.config + Settings + 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 Gitlab.config.gitlab.url == COM_URL || gl_subdomain? end + def self.org? + Gitlab.config.gitlab.url == 'https://dev.gitlab.org' + end + def self.gl_subdomain? SUBDOMAIN_REGEX === Gitlab.config.gitlab.url end def self.dev_env_or_com? - Rails.env.test? || Rails.env.development? || com? + Rails.env.test? || Rails.env.development? || org? || com? end end |