Class: Jets::Stack
- Inherits:
-
Object
show all
- Extended by:
- Memoist
- Includes:
- Main::Dsl, Output::Dsl, Parameter::Dsl, Resource::Dsl
- Defined in:
- lib/jets/stack/output.rb,
lib/jets/stack.rb,
lib/jets/stack/main.rb,
lib/jets/stack/builder.rb,
lib/jets/stack/function.rb,
lib/jets/stack/main/dsl.rb,
lib/jets/stack/resource.rb,
lib/jets/stack/parameter.rb,
lib/jets/stack/definition.rb,
lib/jets/stack/output/dsl.rb,
lib/jets/stack/resource/dsl.rb,
lib/jets/stack/parameter/dsl.rb
Overview
Class that include Definition should implement:
template - method should use @definition to build a CloudFormation template section
Defined Under Namespace
Modules: Definition
Classes: Builder, Function, Main, Output, Parameter, Resource
Class Method Summary
collapse
#resources
#outputs
#add_common_parameters, #add_depends_on_parameters, #dependency_outputs, #parameters
Methods included from Main::Dsl
included
Class Method Details
.build? ⇒ Boolean
Build it to figure out if we need to build the stack for the SharedBuilder
30
31
32
33
|
# File 'lib/jets/stack.rb', line 30
def build?
empty = template == {"Parameters"=>{"IamRole"=>{"Type"=>"String"}, "S3Bucket"=>{"Type"=>"String"}}}
!empty
end
|
.eager_load_shared_resources! ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/jets/stack.rb', line 74
def eager_load_shared_resources!
ActiveSupport::Dependencies.autoload_paths += ["#{Jets.root}app/shared/resources"]
Dir.glob("#{Jets.root}app/shared/resources/**/*.rb").select do |path|
next if !File.file?(path) or path =~ %r{/javascript/} or path =~ %r{/views/}
class_name = path
.sub(/\.rb$/,'') .sub(Jets.root.to_s,'') .sub(%r{app/shared/resources/},'') .classify
class_name.constantize end
end
|
.functions ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/jets/stack.rb', line 35
def functions
stack = new
templates = stack.resources&.map(&:template)&.select do |t|
attributes = t.values.first
attributes['Type'] == 'AWS::Lambda::Function'
end
templates ||= []
templates.map { |t| Function.new(t) }
end
|
.has_resources? ⇒ Boolean
66
67
68
|
# File 'lib/jets/stack.rb', line 66
def has_resources?
!subclasses.empty?
end
|
.inherited(base) ⇒ Object
24
25
26
27
|
# File 'lib/jets/stack.rb', line 24
def inherited(base)
super
self.subclasses << base if base.name
end
|
.lookup(logical_id) ⇒ Object
88
89
90
|
# File 'lib/jets/stack.rb', line 88
def lookup(logical_id)
looker.output(logical_id)
end
|
.output_keys ⇒ Object
97
98
99
100
|
# File 'lib/jets/stack.rb', line 97
def output_keys
outputs = new.outputs || []
outputs.map(&:template).map {|o| o.keys.first}
end
|
.subclasses ⇒ Object
Track all command subclasses.
20
21
22
|
# File 'lib/jets/stack.rb', line 20
def subclasses
@subclasses ||= []
end
|
.template ⇒ Object
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/jets/stack.rb', line 46
def template
builder = Jets::Stack::Builder.new(new)
builder.template
end
|