gitlab.rb 651 Bytes
Newer Older
1
require_dependency 'gitlab/git'
2 3

module Gitlab
4
  COM_URL = 'https://gitlab.com'.freeze
5 6
  APP_DIRS_PATTERN = %r{^/?(app|config|ee|lib|spec|\(\w*\))}
  SUBDOMAIN_REGEX = %r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}
7
  SUBSCRIPTIONS_URL = 'https://customers.gitlab.com'.freeze
8
  SUBSCRIPTIONS_PLANS_URL = "#{SUBSCRIPTIONS_URL}/plans".freeze
9

Robert Speicher's avatar
Robert Speicher committed
10
  def self.com?
11
    # Check `gl_subdomain?` as well to keep parity with gitlab.com
12
    Gitlab.config.gitlab.url == COM_URL || gl_subdomain?
13 14
  end

15 16
  def self.gl_subdomain?
    SUBDOMAIN_REGEX === Gitlab.config.gitlab.url
Robert Speicher's avatar
Robert Speicher committed
17
  end
18 19

  def self.dev_env_or_com?
20
    Rails.env.test? || Rails.env.development? || com?
21
  end
22
end