blob: e3da00a1881275f5ceff62eecf8e59551d75f0b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
module QA
module Runtime
##
# Class that is responsible for plugging CE/EE extensions in, depending on
# environment variable GITLAB_RELEASE that should be present in the runtime
# environment.
#
# We need that to reduce the probability of conflicts when merging
# CE to EE.
#
class Release
UnspecifiedReleaseError = Class.new(StandardError)
def initialize(version = ENV['GITLAB_RELEASE'])
@version = version.to_s.upcase
unless %w[CE EE].include?(@version)
raise UnspecifiedReleaseError, 'GITLAB_RELEASE env not defined!'
end
begin
require "qa/#{version.downcase}/strategy"
rescue LoadError
# noop
end
end
def has_strategy?
QA.const_defined?("#{@version}::Strategy")
end
def strategy
QA.const_get("#{@version}::Strategy")
end
def self.method_missing(name, *args)
@release ||= self.new
if @release.has_strategy?
@release.strategy.public_send(name, *args)
end
end
end
end
end
|