Sha256: 6ebe0f3e6a68b37f671f36fd4ea228948141e996d15be47c275afaf0a6985187

Contents?: true

Size: 1.56 KB

Versions: 11

Compression:

Stored size: 1.56 KB

Contents

require 'json'

module CiCd
	module Builder
    # noinspection RubySuperCallWithoutSuperclassInspection
    module ChefRepoManifest
      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/chefrepo-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
                    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

      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
chefrepo-manifest-builder-0.2.4 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb
chefrepo-manifest-builder-0.2.3 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb
chefrepo-manifest-builder-0.2.2 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb
chefrepo-manifest-builder-0.2.1 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb
chefrepo-manifest-builder-0.2.0 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb
chefrepo-manifest-builder-0.1.9 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb
chefrepo-manifest-builder-0.1.8 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb
chefrepo-manifest-builder-0.1.7 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb
chefrepo-manifest-builder-0.1.6 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb
chefrepo-manifest-builder-0.1.5 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb
chefrepo-manifest-builder-0.1.4 lib/cicd/builder/chefrepo-manifest/mixlib/repo.rb