lib/convection/model/template.rb in convection-0.2.32 vs lib/convection/model/template.rb in convection-0.2.33

- old
+ new

@@ -80,10 +80,19 @@ o = Model::Template::Output.new(name, self) o.instance_exec(&block) if block outputs[name] = o end + + # @param name [String] the name of the new metadata configuration to set + # @param value [Hash] an arbritrary JSON object to set as the + # value of the new metadata configuration + def metadata(name = nil, value = nil) + return @metadata unless name + + @metadata[name] = Model::Template::Metadata.new(name, value) + end end end module Model ## @@ -197,10 +206,11 @@ @parameters = Collection.new @mappings = Collection.new @conditions = Collection.new @resources = Collection.new @outputs = Collection.new + @metadata = Collection.new end def clone(stack_) Template.new(stack_, &@definition) end @@ -220,11 +230,12 @@ 'Description' => description, 'Parameters' => parameters.map(&:render), 'Mappings' => mappings.map(&:render), 'Conditions' => conditions.map(&:render), 'Resources' => resources.map(&:render), - 'Outputs' => outputs.map(&:render) + 'Outputs' => outputs.map(&:render), + 'Metadata' => metadata.map(&:render) } end def diff(other, stack_ = nil) render(stack_).diff(other).map { |diff| Diff.new(diff[0], *diff[1]) } @@ -341,5 +352,6 @@ require_relative 'template/condition' require_relative 'template/resource' require_relative 'template/resource_property' require_relative 'template/resource_attribute' require_relative 'template/output' +require_relative 'template/metadata'