Sha256: b78afcd27a8559ae03796a6a8a3d2b401e70d16155cfdac95176b04d448e8630

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 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 exists?(engine_name)
        return true if dev_mode?
        list.keys.include?(engine_name)
      end

      private

      def dev_mode?
        @dev_mode
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codeclimate-0.2.6 lib/cc/analyzer/engine_registry.rb