diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 21:05:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 21:05:56 +0300 |
commit | 40597fdec080d55d36e97aab1a0b98dfc35517b9 (patch) | |
tree | 20cb97ab39cd511c22657cc23c5834464001feac /lib | |
parent | a712542edb9d52105409462de3e56d2a6d6f6c7a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab.rb | 13 | ||||
-rw-r--r-- | lib/gitlab/patch/draw_route.rb | 7 |
2 files changed, 8 insertions, 12 deletions
diff --git a/lib/gitlab.rb b/lib/gitlab.rb index 43b3642fd6b..b337f5cbf2c 100644 --- a/lib/gitlab.rb +++ b/lib/gitlab.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require 'pathname' -require_relative '../config/light_settings' module Gitlab def self.root @@ -38,18 +37,24 @@ module Gitlab COM_URL = 'https://gitlab.com' APP_DIRS_PATTERN = %r{^/?(app|config|ee|lib|spec|\(\w*\))}.freeze + SUBDOMAIN_REGEX = %r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}.freeze VERSION = File.read(root.join("VERSION")).strip.freeze INSTALLATION_TYPE = File.read(root.join("INSTALLATION_TYPE")).strip.freeze HTTP_PROXY_ENV_VARS = %w(http_proxy https_proxy HTTP_PROXY HTTPS_PROXY).freeze def self.com? - LightSettings.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_org_or_com? dev_env_or_com? || org? end @@ -74,10 +79,6 @@ module Gitlab yield if ee? end - def self.com - yield if com? - end - def self.http_proxy_env? HTTP_PROXY_ENV_VARS.any? { |name| ENV[name] } end diff --git a/lib/gitlab/patch/draw_route.rb b/lib/gitlab/patch/draw_route.rb index fc9d7ae805f..4c8ca015974 100644 --- a/lib/gitlab/patch/draw_route.rb +++ b/lib/gitlab/patch/draw_route.rb @@ -6,12 +6,11 @@ module Gitlab module Patch module DrawRoute prepend_if_ee('EE::Gitlab::Patch::DrawRoute') # rubocop: disable Cop/InjectEnterpriseEditionModule - prepend_if_com('Com::Gitlab::Patch::DrawRoute') RoutesNotFound = Class.new(StandardError) def draw(routes_name) - drawn_any = draw_ce(routes_name) | draw_ee(routes_name) | draw_com(routes_name) + drawn_any = draw_ce(routes_name) | draw_ee(routes_name) drawn_any || raise(RoutesNotFound.new("Cannot find #{routes_name}")) end @@ -24,10 +23,6 @@ module Gitlab true end - def draw_com(_) - false - end - def route_path(routes_name) Rails.root.join(routes_name) end |