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.9.7 lib/cc/analyzer/engine_registry.rb
codeclimate-0.9.6 lib/cc/analyzer/engine_registry.rb
codeclimate-0.9.5 lib/cc/analyzer/engine_registry.rb
codeclimate-0.9.4 lib/cc/analyzer/engine_registry.rb
codeclimate-0.9.3 lib/cc/analyzer/engine_registry.rb
codeclimate-0.9.2 lib/cc/analyzer/engine_registry.rb
codeclimate-0.9.1 lib/cc/analyzer/engine_registry.rb
codeclimate-0.9.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.8.1 lib/cc/analyzer/engine_registry.rb
codeclimate-0.8.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.7.2 lib/cc/analyzer/engine_registry.rb
codeclimate-0.7.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.6.4 lib/cc/analyzer/engine_registry.rb
codeclimate-0.6.3 lib/cc/analyzer/engine_registry.rb
codeclimate-0.6.2 lib/cc/analyzer/engine_registry.rb
codeclimate-0.6.1 lib/cc/analyzer/engine_registry.rb
codeclimate-0.6.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.5.0 lib/cc/analyzer/engine_registry.rb
codeclimate-0.4.4 lib/cc/analyzer/engine_registry.rb
codeclimate-0.4.3 lib/cc/analyzer/engine_registry.rb