Sha256: 7314ddeaf33c2d7f27e1ce5da68664064d69ed32ed89ac5eef2bb2d9f1972ea1

Contents?: true

Size: 724 Bytes

Versions: 45

Compression:

Stored size: 724 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

45 entries across 45 versions & 1 rubygems

Version Path
codeclimate-0.22.3 lib/cc/analyzer/engine_registry.rb
codeclimate-0.22.2 lib/cc/analyzer/engine_registry.rb
codeclimate-0.22.1 lib/cc/analyzer/engine_registry.rb
codeclimate-0.22.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.21.4 lib/cc/analyzer/engine_registry.rb
codeclimate-0.21.3 lib/cc/analyzer/engine_registry.rb
codeclimate-0.21.2 lib/cc/analyzer/engine_registry.rb
codeclimate-0.21.1 lib/cc/analyzer/engine_registry.rb
codeclimate-0.21.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.20.2 lib/cc/analyzer/engine_registry.rb
codeclimate-0.20.1 lib/cc/analyzer/engine_registry.rb
codeclimate-0.20.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.19.2 lib/cc/analyzer/engine_registry.rb
codeclimate-0.19.1 lib/cc/analyzer/engine_registry.rb
codeclimate-0.19.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.18.6 lib/cc/analyzer/engine_registry.rb
codeclimate-0.18.5 lib/cc/analyzer/engine_registry.rb
codeclimate-0.18.4 lib/cc/analyzer/engine_registry.rb
codeclimate-0.18.3 lib/cc/analyzer/engine_registry.rb
codeclimate-0.18.2 lib/cc/analyzer/engine_registry.rb