lib/rubber/environment.rb in rubber-2.1.1 vs lib/rubber/environment.rb in rubber-2.1.2

- old
+ new

@@ -34,11 +34,11 @@ def read_config(file) Rubber.logger.debug{"Reading rubber configuration from #{file}"} if File.exist?(file) begin - @items = Environment.combine(@items, YAML.load_file(file) || {}) + @items = Environment.combine(@items, YAML::load(ERB.new(IO.read(file)).result) || {}) rescue Exception => e Rubber.logger.error{"Unable to read rubber configuration from #{file}"} raise end end @@ -54,11 +54,11 @@ # all the roles known about in script directory roles.concat Dir["#{Rubber.root}/script/*/role/*"].collect {|f| File.basename(f) } # all the roles known about in yml files Dir["#{@config_root}/rubber*.yml"].each do |yml| - rubber_yml = YAML.load(File.read(yml)) rescue {} + rubber_yml = YAML::load(ERB.new(IO.read(yml)).result) rescue {} roles.concat(rubber_yml['roles'].keys) rescue nil roles.concat(rubber_yml['role_dependencies'].keys) rescue nil roles.concat(rubber_yml['role_dependencies'].values) rescue nil end @@ -87,10 +87,15 @@ return new if old.nil? value = old if old.is_a?(Hash) && new.is_a?(Hash) value = old.clone new.each do |nk, nv| - value[nk] = combine(value[nk], nv) + if nk[0] == '^' + nk = nk[1..-1] + value[nk] = combine(nil, nv) + else + value[nk] = combine(value[nk], nv) + end end elsif old.is_a?(Array) && new.is_a?(Array) value = old | new else value = new \ No newline at end of file