Class: CC::CLI::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/cc/cli/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Config

Returns a new instance of Config.



6
7
8
# File 'lib/cc/cli/config.rb', line 6

def initialize(config = {})
  @config = default_config.merge(config)
end

Instance Method Details

#add_engine(engine_name, engine_config) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cc/cli/config.rb', line 10

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

  # we may not want this code in the general case.
  # for now, we need it to test one of our own Maintainability engines
  # which is in the 'beta' channel
  if engine_config.key?("channels") && !engine_config["channels"].include?("stable")
    config["engines"][engine_name]["channel"] = engine_config["channels"].first.first
  end

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

#add_exclude_paths(paths) ⇒ Object



27
28
29
30
# File 'lib/cc/cli/config.rb', line 27

def add_exclude_paths(paths)
  config["exclude_paths"] ||= []
  config["exclude_paths"] |= paths
end