Sha256: 5e6ec2e87df9156adfd423ea4452f25be9fcc090deaaf9be7d11d3e4152784a9

Contents?: true

Size: 728 Bytes

Versions: 63

Compression:

Stored size: 728 Bytes

Contents

module CC
  module Analyzer
    class EngineRegistry
      def initialize(dev_mode = false)
        @path = File.expand_path("../../../../config/engines.yml", __FILE__)
        @config = YAML.safe_load(File.read(@path))
        @dev_mode = dev_mode
      end

      def [](engine_name)
        if dev_mode?
          { "channels" => { "stable" => "codeclimate/codeclimate-#{engine_name}:latest" } }
        else
          @config[engine_name]
        end
      end

      def list
        @config
      end

      def key?(engine_name)
        return true if dev_mode?
        list.key?(engine_name)
      end

      alias_method :exists?, :key?

      private

      def dev_mode?
        @dev_mode
      end
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
codeclimate-0.32.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.32.0.rc1 lib/cc/analyzer/engine_registry.rb
codeclimate-0.31.1 lib/cc/analyzer/engine_registry.rb