module CiCd::Builder::EnvironmentsList::Repo

Public Instance Methods

getRepoClass(type = nil) { || ... } click to toggle source

# File lib/cicd/builder/environments-list/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
            begin
              # Object.const_get("#{self.class.name.gsub(%r'::\w+$', '')}::Repo::#{type}")
              Object.const_get("CiCd::Builder::Manifest::Repo::#{type}")
            rescue NameError #=> e
              Object.const_get("CiCd::Builder::Repo::#{type}")
            end
          end

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

  clazz
end