Sha256: 46c124c45779da938c883ce53a84a34694340029715689a9098601aa095a50c2

Contents?: true

Size: 875 Bytes

Versions: 12

Compression:

Stored size: 875 Bytes

Contents

module CC
  module CLI
    class Config
      delegate :to_yaml, to: :config
      def initialize
        @config = {
          "engines" => {},
          "ratings" => { "paths" => [] }
        }
      end

      def add_engine(engine_name, engine_config)
        config["engines"][engine_name] = { "enabled" => true }

        if engine_config["default_config"].present?
          config["engines"][engine_name]["config"] = engine_config["default_config"]
        end

        config["ratings"]["paths"] |= engine_config["default_ratings_paths"]
      end

      def add_exclude_paths(paths)
        config["exclude_paths"] ||= []
        config["exclude_paths"] += paths.map do |path|
          if path.ends_with?("/")
            "#{path}**/*"
          else
            path
          end
        end
      end

      private

      attr_reader :config
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
codeclimate-0.9.7 lib/cc/cli/config.rb
codeclimate-0.9.6 lib/cc/cli/config.rb
codeclimate-0.9.5 lib/cc/cli/config.rb
codeclimate-0.9.4 lib/cc/cli/config.rb
codeclimate-0.9.3 lib/cc/cli/config.rb
codeclimate-0.9.2 lib/cc/cli/config.rb
codeclimate-0.9.1 lib/cc/cli/config.rb
codeclimate-0.9.0 lib/cc/cli/config.rb
codeclimate-0.8.1 lib/cc/cli/config.rb
codeclimate-0.8.0 lib/cc/cli/config.rb
codeclimate-0.7.2 lib/cc/cli/config.rb
codeclimate-0.7.0 lib/cc/cli/config.rb