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-2.0.3 lib/jets/stack/parameter/dsl.rb
jets-2.0.1 lib/jets/stack/parameter/dsl.rb
jets-2.0.0 lib/jets/stack/parameter/dsl.rb
jets-1.9.32 lib/jets/stack/parameter/dsl.rb
jets-1.9.31 lib/jets/stack/parameter/dsl.rb
jets-1.9.30 lib/jets/stack/parameter/dsl.rb
jets-1.9.29 lib/jets/stack/parameter/dsl.rb
jets-1.9.28 lib/jets/stack/parameter/dsl.rb
jets-1.9.27 lib/jets/stack/parameter/dsl.rb
jets-1.9.26 lib/jets/stack/parameter/dsl.rb
jets-1.9.25 lib/jets/stack/parameter/dsl.rb
jets-1.9.24 lib/jets/stack/parameter/dsl.rb
jets-1.9.23 lib/jets/stack/parameter/dsl.rb
jets-1.9.22 lib/jets/stack/parameter/dsl.rb
jets-1.9.21 lib/jets/stack/parameter/dsl.rb
jets-1.9.20 lib/jets/stack/parameter/dsl.rb
jets-1.9.19 lib/jets/stack/parameter/dsl.rb
jets-1.9.18 lib/jets/stack/parameter/dsl.rb
jets-1.9.17 lib/jets/stack/parameter/dsl.rb
jets-1.9.16 lib/jets/stack/parameter/dsl.rb