Sha256: e77bd09bae64cf3fa2cd7e4011b02ebd4687f8f6fa35a4a9197675a92fb06776
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
module Flak::Template module MergeEngine def infuse target settings = target.settings flat = flatten_yaml settings settings = settings.flak_merge(flat) module_mods = settings_modifications(settings) target.settings = settings.flak_merge(module_mods) end # substutute environment variables in yaml file # and faltten out the os and configuration keys. def self.flatten_yaml_file(settings, file) if File.exists? file content = File.open(file, "rb").read.substitute_env_vars yml = YAML::load(content) || {} yml.flak_flatten(settings[:configuration], settings[:os]) else {} end end # open the yaml file associated with the current module and flatten it def flatten_yaml settings file = settings[:root] + '/config/'+self.name.split("::")[2].underscoreize+'.yml' Flak::Template::MergeEngine.flatten_yaml_file(settings,file) end # fallback modifications method for #{self.name} def settings_modifications settings {} end end end
Version data entries
5 entries across 5 versions & 1 rubygems