summaryrefslogtreecommitdiff
path: root/lib/gitlab.rb
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2019-08-20 20:22:43 +0200
committerAchilleas Pipinellis <axil@gitlab.com>2019-08-20 20:22:43 +0200
commite61308ce1d82e12e5087371469baea4a452875d1 (patch)
tree62551a3ae4eab75e5af7e3b35358c07a51b2132f /lib/gitlab.rb
parent4f323bb62fbe71a4352de25cab141f361a3fe1a6 (diff)
parent2989ed078c1d45b0959dcecb1bc3c8f4740a3c0d (diff)
downloadgitlab-ce-docs-patch-71.tar.gz
Merge branch 'master' into docs-patch-71docs-patch-71
Diffstat (limited to 'lib/gitlab.rb')
-rw-r--r--lib/gitlab.rb20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/gitlab.rb b/lib/gitlab.rb
index ccaf06c5d6a..d9d8dcf7900 100644
--- a/lib/gitlab.rb
+++ b/lib/gitlab.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_dependency 'gitlab/popen'
+require 'pathname'
module Gitlab
def self.root
@@ -60,11 +60,19 @@ module Gitlab
end
def self.ee?
- if ENV['IS_GITLAB_EE'].present?
- Gitlab::Utils.to_boolean(ENV['IS_GITLAB_EE'])
- else
- Object.const_defined?(:License)
- end
+ @is_ee ||=
+ if ENV['IS_GITLAB_EE'] && !ENV['IS_GITLAB_EE'].empty?
+ Gitlab::Utils.to_boolean(ENV['IS_GITLAB_EE'])
+ else
+ # We may use this method when the Rails environment is not loaded. This
+ # means that checking the presence of the License class could result in
+ # this method returning `false`, even for an EE installation.
+ root.join('ee/app/models/license.rb').exist?
+ end
+ end
+
+ def self.ee
+ yield if ee?
end
def self.http_proxy_env?