2019-07-23 10:51:13 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-01 08:41:37 -04:00
|
|
|
require 'active_support/inflector'
|
|
|
|
|
2019-07-23 10:51:13 -04:00
|
|
|
module InjectEnterpriseEditionModule
|
2019-08-27 11:11:15 -04:00
|
|
|
def prepend_if_ee(constant, with_descendants: false)
|
|
|
|
return unless Gitlab.ee?
|
|
|
|
|
|
|
|
ee_module = constant.constantize
|
|
|
|
prepend(ee_module)
|
|
|
|
|
|
|
|
if with_descendants
|
|
|
|
descendants.each { |descendant| descendant.prepend(ee_module) }
|
|
|
|
end
|
2019-07-23 10:51:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def extend_if_ee(constant)
|
|
|
|
extend(constant.constantize) if Gitlab.ee?
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_if_ee(constant)
|
|
|
|
include(constant.constantize) if Gitlab.ee?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Module.prepend(InjectEnterpriseEditionModule)
|