Class: Standard::BuildsConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/standard/builds_config.rb

Instance Method Summary collapse

Constructor Details

#initializeBuildsConfig

Returns a new instance of BuildsConfig.



9
10
11
12
13
14
# File 'lib/standard/builds_config.rb', line 9

def initialize
  @resolves_yaml_option = ResolvesYamlOption.new
  @loads_yaml_config = LoadsYamlConfig.new
  @merges_settings = MergesSettings.new
  @creates_config_store = CreatesConfigStore.new
end

Instance Method Details

#call(argv, search_path = Dir.pwd) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/standard/builds_config.rb', line 16

def call(argv, search_path = Dir.pwd)
  standard_yaml_path = @resolves_yaml_option.call(argv, search_path, "--config", ".standard.yml")

  # Don't load the existing todo file when generating a new todo file.  Otherwise the
  # new todo file won't have the ignore rules in the existing file.
  todo_yaml_path = unless argv.include?("--generate-todo")
    @resolves_yaml_option.call(argv, search_path, "--todo", ".standard_todo.yml")
  end

  standard_config = @loads_yaml_config.call(standard_yaml_path, todo_yaml_path)

  settings = @merges_settings.call(argv, standard_config)
  Config.new(
    settings.runner,
    settings.paths,
    settings.options,
    @creates_config_store.call(standard_config)
  )
end