Sha256: 06c57869e84849830eeb0409d4ff2f46d3ec3d202572cb58887a87165768a525

Contents?: true

Size: 1.14 KB

Versions: 131

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.camelize.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

131 entries across 131 versions & 3 rubygems

Version Path
jets-4.0.12 lib/jets/stack/parameter/dsl.rb
jets-4.0.11 lib/jets/stack/parameter/dsl.rb
jets-5.0.13 lib/jets/stack/parameter/dsl.rb
jets-5.0.12 lib/jets/stack/parameter/dsl.rb
jets-5.0.11 lib/jets/stack/parameter/dsl.rb
jets-5.0.10 lib/jets/stack/parameter/dsl.rb
jets-5.0.9 lib/jets/stack/parameter/dsl.rb
jets-5.0.8 lib/jets/stack/parameter/dsl.rb
jets-5.0.7 lib/jets/stack/parameter/dsl.rb
jets-5.0.6 lib/jets/stack/parameter/dsl.rb
jets-5.0.5 lib/jets/stack/parameter/dsl.rb
jets-5.0.4 lib/jets/stack/parameter/dsl.rb
jets-5.0.3 lib/jets/stack/parameter/dsl.rb
jets-5.0.2 lib/jets/stack/parameter/dsl.rb
jets-5.0.1 lib/jets/stack/parameter/dsl.rb
jets-5.0.0 lib/jets/stack/parameter/dsl.rb
jets-4.0.10 lib/jets/stack/parameter/dsl.rb
jets-5.0.0.beta1 lib/jets/stack/parameter/dsl.rb
jets-4.0.9 lib/jets/stack/parameter/dsl.rb
jets-4.0.8 lib/jets/stack/parameter/dsl.rb