Sha256: 581ac3db12e69f4a99ee1fd7d361f2f2342c4488864d69a37656498bf1ea331f
Contents?: true
Size: 1006 Bytes
Versions: 1
Compression:
Stored size: 1006 Bytes
Contents
class Profigure class << self def load(configs_dir, environment=nil) hash = file_contents("defaults", configs_dir) if environment yaml_result = file_contents(environment, configs_dir) merged_with_reference = load_referenced_config_from configs_dir, yaml_result hash.recursive_merge! merged_with_reference end hash["environment"] = environment MoStash.new hash end private def file_contents(environment, configs_dir) file = "#{configs_dir}/#{environment}.yml" content = run_erb IO.read(file) YAML.load content end def run_erb(data) ERB.new( data ).result end def load_referenced_config_from( configs_dir, config_hash ) config_like_file = config_hash["profigure_like"] || config_hash[:profigure_like] return config_hash unless config_like_file config_like = file_contents( config_like_file, configs_dir ) config_like.recursive_merge! config_hash end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
profigure-0.0.3 | lib/profigure/profigure.rb |