Module: CiCd::Builder::Manifest::Repo

Included in:
Runner
Defined in:
lib/cicd/builder/manifest/mixlib/repo.rb,
lib/cicd/builder/manifest/mixlib/repo/artifactory.rb

Defined Under Namespace

Classes: Artifactory

Instance Method Summary collapse

Instance Method Details

#getRepoClass(type = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cicd/builder/manifest/mixlib/repo.rb', line 16

def getRepoClass(type = nil)
  @logger.step CLASS+'::'+__method__.to_s
  if type.nil?
    type ||= 'S3'
    if ENV.has_key?('REPO_TYPE')
      type = ENV['REPO_TYPE']
    end
  end

  @logger.info "#{type} repo interface"
  clazz = begin
            Object.const_get("#{self.class.name.gsub(%r'::\w+$', '')}::Repo::#{type}")
          rescue NameError #=> e
            Object.const_get("CiCd::Builder::Repo::#{type}")
          end

  if block_given?
    if clazz.is_a?(Class) and not clazz.nil?
      yield
    end
  end

  clazz
end