Sha256: 05adc439da732244f7e9e2ad6a066a34498553faeda9d9e650cf5f57e10d5a8a

Contents?: true

Size: 1.28 KB

Versions: 12

Compression:

Stored size: 1.28 KB

Contents

require 'json'

module CiCd
	module Builder
    # noinspection RubySuperCallWithoutSuperclassInspection
    module Manifest
      module Repo
        require 'cicd/builder/mixlib/repo/base'
        require 'cicd/builder/mixlib/repo/S3'
        # noinspection RubyResolve
        if ENV.has_key?('REPO_TYPE') and (not ENV['REPO_TYPE'].capitalize.eql?('S3'))
          require "cicd/builder/manifest/mixlib/repo/#{ENV['REPO_TYPE'].downcase}"
        end

        # ---------------------------------------------------------------------------------------------------------------
        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

      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
manifest-builder-0.7.5 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.7.4 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.7.3 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.7.2 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.7.1 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.7.0 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.6.9 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.6.8 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.6.7 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.6.6 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.6.5 lib/cicd/builder/manifest/mixlib/repo.rb
manifest-builder-0.6.4 lib/cicd/builder/manifest/mixlib/repo.rb