Sha256: bf2327e0f95d1b6c6c157a6da93073d57b37efa0f38b31e5e04c48a1b35d5447

Contents?: true

Size: 906 Bytes

Versions: 3

Compression:

Stored size: 906 Bytes

Contents

class Ufo::Cfn::Stack
  class Builder < Ufo::Cfn::Base
    include Ufo::Utils::Logging

    def initialize(options={})
      super
      @vars = options[:vars]
      @template = {Description: "UFO ECS stack #{@vars[:stack_name]}"}
    end

    def build
      @template[:Parameters] = Parameters.build(@options)
      @template[:Conditions] = Conditions.build(@options)
      @template[:Resources] = Resources.build(@options)
      @template[:Outputs] = Outputs.build(@options)
      @template.deep_stringify_keys!
      @template = Ufo::Utils::Squeezer.new(@template).squeeze
      @template = CustomProperties.new(@template, @vars[:stack_name]).apply
      write(@template)
    end

    def write(template)
      text = YAML.dump(template)
      path = ".ufo/output/template.yml"
      IO.write("#{Ufo.root}/#{path}", text)
      logger.info "Template built:        #{path}"
      text
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ufo-6.0.2 lib/ufo/cfn/stack/builder.rb
ufo-6.0.1 lib/ufo/cfn/stack/builder.rb
ufo-6.0.0 lib/ufo/cfn/stack/builder.rb