Sha256: f08fcbb3fced8fedf8526a8a1ab0097a3ebf8cea707c08263b8bb3a3b95c767c
Contents?: true
Size: 1.4 KB
Versions: 14
Compression:
Stored size: 1.4 KB
Contents
module Climatic module ConfigLayers class GenericLayer < SuperStack::Layer include Climatic::ConfigLayers::SourceHelper def rescan set_config_file possible_sources end def initialize rescan end def possible_config_files(places=possible_sources) result = {} already_found = false browse_files(places) do |file| exists = File.readable?(file) used = false already_found = used = true if exists and not already_found result[file] = { exists: exists, used: used, layer: [name] } end result end private def set_config_file(places) @file_name = nil browse_files(places) do |file| if File.readable? file @file_name = file return @file_name end end end def browse_files(places, &block) places.each do |path_array| begin potential_config_file = File.join(path_array.map { |path_part| perform_substitutions path_part }) rescue # do nothing end return unless potential_config_file EXTENSIONS.each do |extension| file = potential_config_file.gsub '##EXTENSION##', extension yield file end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems