Sha256: d411711aed3837f2b8fa9aba234a52005359317fdad6692a691154203d519989

Contents?: true

Size: 1.14 KB

Versions: 101

Compression:

Stored size: 1.14 KB

Contents

class Jets::Stack
  class Parameter
    module Dsl
      extend ActiveSupport::Concern
      extend Memoist

      def parameters
        add_common_parameters
        add_depends_on_parameters
        Parameter.definitions(self.class)
      end

      def add_common_parameters
        self.class.parameter(:iam_role)
        self.class.parameter(:s3_bucket)
      end

      def add_depends_on_parameters
        depends_on = self.class.depends_on
        depends_on.each do |dependency|
          dependency_outputs(dependency).each do |output|
            self.class.parameter(output)
          end
        end if depends_on
      end
      memoize :add_depends_on_parameters # only run once

      # Returns output keys associated with the stack.  They are the resource logical ids.
      def dependency_outputs(dependency)
        dependency.to_s.classify.constantize.output_keys
      end

      class_methods do
        def parameter(*definition)
          # self is subclass is the stack that inherits from Jets::Stack
          # IE: ExampleStack < Jets::Stack
          Parameter.new(self, *definition).register
        end
      end
    end
  end
end

Version data entries

101 entries across 101 versions & 2 rubygems

Version Path
jets-1.7.2 lib/jets/stack/parameter/dsl.rb
jets-1.7.1 lib/jets/stack/parameter/dsl.rb
jets-1.7.0 lib/jets/stack/parameter/dsl.rb
jets-fs-1.6.10 lib/jets/stack/parameter/dsl.rb
jets-1.6.9 lib/jets/stack/parameter/dsl.rb
jets-1.6.8 lib/jets/stack/parameter/dsl.rb
jets-1.6.7 lib/jets/stack/parameter/dsl.rb
jets-1.6.6 lib/jets/stack/parameter/dsl.rb
jets-1.6.5 lib/jets/stack/parameter/dsl.rb
jets-1.6.4 lib/jets/stack/parameter/dsl.rb
jets-1.6.3 lib/jets/stack/parameter/dsl.rb
jets-1.6.2 lib/jets/stack/parameter/dsl.rb
jets-1.6.1 lib/jets/stack/parameter/dsl.rb
jets-1.6.0 lib/jets/stack/parameter/dsl.rb
jets-1.5.10 lib/jets/stack/parameter/dsl.rb
jets-1.5.9 lib/jets/stack/parameter/dsl.rb
jets-1.5.8 lib/jets/stack/parameter/dsl.rb
jets-1.5.7 lib/jets/stack/parameter/dsl.rb
jets-1.5.6 lib/jets/stack/parameter/dsl.rb
jets-1.5.5 lib/jets/stack/parameter/dsl.rb