module Config
def default_paths
def default_paths paths = {} # configuration files to look for EXTENSIONS.each do |ext| paths[ext] = [] unless paths[ext] ############################### # system level configuration ############################### paths[ext] << File.join(%(/etc), %(pangea), %(pangea.#{ext})) paths[ext].concat( Dir.glob( File.join(%(/etc/), %(pangea), %(conf.d), %(*.#{ext})) ) ) # end system level configuration ############################### # home configuration ############################### paths[ext] << File.join(xdg_config_home, %(pangea), %(pangea.#{ext})) paths[ext].concat( Dir.glob( File.join(xdg_config_home, %(pangea), %(conf.d), %(*.#{ext})) ) ) # end home configuration ############################### # local configuration ############################### paths[ext] << %(pangea.#{ext}) paths[ext] << Dir.glob( File.join( %(pangea), %(conf.d), %(*.#{ext}) ) ) # end local configuration end # only return existing files res = [] EXTENSIONS.each do |ext| files = paths[ext] files.each do |file| res << file if File.exist?(file.to_s) end end res end