Sha256: 6874064c9a90964a1fb51a35f58f39c69c364a9fbfee88aac0c6929a3d40320e
Contents?: true
Size: 1.32 KB
Versions: 18
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true module Diffend module Config # Class used to figure out the file from which we should load the settings module FileFinder # Names of the files or paths where we will look for the settings # # @note We do the double dot trick, to look outside of the current dir because when # executed from a docker container, we copy the local uncommitted settings into the # dir above the app location not to pollute the reset state of the git repo # # @note Order is important, as for local env we should load from # local file (if present first) FILE_NAMES = %w[ .diffend.yml ].map { |name| ["../#{name}", name] }.tap(&:flatten!).freeze private_constant :FILE_NAMES class << self # Looks for Diffend settings file for a given env # # @param build_path [String] path of the current build # # @return [String] path to the file from which we should load all the settings 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 end end end end
Version data entries
18 entries across 18 versions & 2 rubygems