Module: Diffend::Config::FileFinder

Defined in:
lib/diffend/config/file_finder.rb

Overview

Class used to figure out the file from which we should load the settings

Class Method Summary collapse

Class Method Details

.call(build_path) ⇒ String

Looks for Diffend settings file for a given env

Parameters:

  • build_path (String)

    path of the current build

Returns:

  • (String)

    path to the file from which we should load all the settings



27
28
29
30
31
32
33
34
# File 'lib/diffend/config/file_finder.rb', line 27

def call(build_path)
  FILE_NAMES
    .map { |name| File.join(build_path, name) }
    .map { |name| Dir[name] }
    .find { |selection| !selection.empty? }
    .tap { |path| path || raise(Errors::MissingConfigurationFile) }
    .first
end