Sha256: 0559d267c9f201f61c310abde53b3c8a6c8655797a31071baed1faaac866124d

Contents?: true

Size: 725 Bytes

Versions: 29

Compression:

Stored size: 725 Bytes

Contents

require "safe_yaml"

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

      def [](engine_name)
        if dev_mode?
          { "image" => "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

29 entries across 29 versions & 1 rubygems

Version Path
codeclimate-0.4.1 lib/cc/analyzer/engine_registry.rb
codeclimate-0.4.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.3.2 lib/cc/analyzer/engine_registry.rb
codeclimate-0.3.1 lib/cc/analyzer/engine_registry.rb
codeclimate-0.3.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.2.12 lib/cc/analyzer/engine_registry.rb
codeclimate-0.2.11 lib/cc/analyzer/engine_registry.rb
codeclimate-0.2.9 lib/cc/analyzer/engine_registry.rb
codeclimate-0.2.7 lib/cc/analyzer/engine_registry.rb