cloud_former 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -7
- data/lib/cloud_former/functions/get_att.rb +2 -2
- data/lib/cloud_former/functions/join.rb +1 -1
- data/lib/cloud_former/metadata_resources/cloud_formation/authentication_item.rb +4 -2
- data/lib/cloud_former/parameters/parameter.rb +4 -1
- data/lib/cloud_former/property_or_attribute.rb +8 -5
- data/lib/cloud_former/pseudo_parameters/pseudo_parameter.rb +3 -1
- data/lib/cloud_former/resources/resource.rb +3 -4
- data/lib/cloud_former/template.rb +2 -2
- data/lib/cloud_former/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f15b74755839584a05c3254388c66d505674bb0a
|
4
|
+
data.tar.gz: cbb3a4a4837f07f6b6a9968420b3bd6cab52c662
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6eec8c39e20eacd2a2349aff9cdd07853fb3abea14153d1578f791cae5752ab83df3f529dd508ad8066c91a9dce70a401948cb95e7d0e7cafcf2cf88ee3703f
|
7
|
+
data.tar.gz: 029fcc446f60cb5f8a6d76800e9713e326ec3638a6dd6a2723c50a21b441fe16015c6441939eb87b44577cfef830e0c05dfe1bb58ca7ed6222f96f7a8ca0d3a9
|
data/.rubocop.yml
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
AllCops:
|
2
|
-
Include:
|
3
|
-
- '**/Rakefile'
|
4
|
-
|
5
|
-
Metrics/AbcSize:
|
6
|
-
Max: 20
|
7
|
-
|
8
1
|
Metrics/LineLength:
|
9
2
|
Max: 140
|
10
3
|
|
@@ -33,9 +26,15 @@ Metrics/PerceivedComplexity:
|
|
33
26
|
Style/ClassAndModuleChildren:
|
34
27
|
Enabled: false
|
35
28
|
|
29
|
+
Style/GuardClause:
|
30
|
+
Enabled: false
|
31
|
+
|
36
32
|
Style/IfUnlessModifier:
|
37
33
|
Enabled: false
|
38
34
|
|
35
|
+
Style/Next:
|
36
|
+
Enabled: false
|
37
|
+
|
39
38
|
Style/PredicateName:
|
40
39
|
Enabled: false
|
41
40
|
|
@@ -12,8 +12,8 @@ module CloudFormer
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def dump_json
|
15
|
-
if @resource.respond_to?(:
|
16
|
-
{ 'Fn::GetAtt' => [@resource.
|
15
|
+
if @resource.respond_to?(:get_name)
|
16
|
+
{ 'Fn::GetAtt' => [@resource.get_name, @attribute] }
|
17
17
|
elsif @resource.respond_to?(:to_s)
|
18
18
|
{ 'Fn::GetAtt' => [@resource.to_s, @attribute] }
|
19
19
|
end
|
@@ -3,8 +3,6 @@ module CloudFormer
|
|
3
3
|
module CloudFormation
|
4
4
|
class AuthenticationItem < MetadataResource
|
5
5
|
|
6
|
-
attr_reader :name
|
7
|
-
|
8
6
|
aws_attribute :access_key_id, name: 'accessKeyId', type: String
|
9
7
|
aws_attribute :buckets, name: 'buckets', list: true, type: String
|
10
8
|
aws_attribute :password, name: 'password', type: String
|
@@ -20,6 +18,10 @@ module CloudFormer
|
|
20
18
|
@name = name || "AuthenticationItem#{self.class.next_id}"
|
21
19
|
end
|
22
20
|
|
21
|
+
def get_name
|
22
|
+
@name
|
23
|
+
end
|
24
|
+
|
23
25
|
def self.next_id
|
24
26
|
@@current_id ||= 1
|
25
27
|
@@current_id += 1
|
@@ -16,7 +16,6 @@ module CloudFormer
|
|
16
16
|
aws_attribute :no_echo, type: Boolean
|
17
17
|
|
18
18
|
attr_reader :type
|
19
|
-
attr_reader :name
|
20
19
|
|
21
20
|
json_attribute(:type)
|
22
21
|
|
@@ -26,5 +25,9 @@ module CloudFormer
|
|
26
25
|
self.instance_eval(&block)
|
27
26
|
end
|
28
27
|
end
|
28
|
+
|
29
|
+
def get_name
|
30
|
+
@name
|
31
|
+
end
|
29
32
|
end
|
30
33
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module CloudFormer
|
2
2
|
class PropertyOrAttribute
|
3
3
|
|
4
|
-
attr_reader :name
|
5
4
|
attr_reader :options
|
6
5
|
|
7
6
|
def initialize(name, options)
|
@@ -9,6 +8,10 @@ module CloudFormer
|
|
9
8
|
@options = options
|
10
9
|
end
|
11
10
|
|
11
|
+
def get_name
|
12
|
+
@name
|
13
|
+
end
|
14
|
+
|
12
15
|
def as_json_for(instance)
|
13
16
|
val_as_json(instance.send(name))
|
14
17
|
end
|
@@ -17,7 +20,7 @@ module CloudFormer
|
|
17
20
|
|
18
21
|
def val_as_json(val)
|
19
22
|
if val.is_a?(Parameter) || val.is_a?(PseudoParameter)
|
20
|
-
{ 'Ref' => val.
|
23
|
+
{ 'Ref' => val.get_name }
|
21
24
|
elsif val.is_a?(Function)
|
22
25
|
val.dump_json
|
23
26
|
elsif val.is_a?(Resource) || val.is_a?(ResourceProperty)
|
@@ -32,10 +35,10 @@ module CloudFormer
|
|
32
35
|
end
|
33
36
|
thing
|
34
37
|
else
|
35
|
-
if val.
|
36
|
-
|
38
|
+
if val.get_name.nil? || val.get_name.empty?
|
39
|
+
fail ArgumentError, "Attempting to reference a resource of type #{val.class.name} with no name"
|
37
40
|
end
|
38
|
-
{ 'Ref' => val.
|
41
|
+
{ 'Ref' => val.get_name }
|
39
42
|
end
|
40
43
|
elsif val.is_a?(Hash)
|
41
44
|
mapped_hash = {}
|
@@ -12,7 +12,7 @@ module CloudFormer
|
|
12
12
|
aws_attribute :depends_on, list: true, type: String
|
13
13
|
aws_attribute :deletion_policy, type: String
|
14
14
|
|
15
|
-
def initialize(name=nil, &block)
|
15
|
+
def initialize(name = nil, &block)
|
16
16
|
@name = name
|
17
17
|
@metadata_items = []
|
18
18
|
@aws_type = self.class.name.sub('CloudFormer', 'AWS')
|
@@ -20,12 +20,11 @@ module CloudFormer
|
|
20
20
|
self.instance_eval(&block)
|
21
21
|
end
|
22
22
|
if @name.nil? || @name.empty?
|
23
|
-
|
23
|
+
fail ArgumentError, "Attempting to create a resource of type #{self.class.name} with no name"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
28
|
-
@name = arg if arg
|
27
|
+
def get_name
|
29
28
|
@name
|
30
29
|
end
|
31
30
|
|
@@ -34,7 +34,7 @@ module CloudFormer
|
|
34
34
|
resource_res = {}
|
35
35
|
@resources.each do |resource|
|
36
36
|
resource.resource_tree.flatten.each do |r|
|
37
|
-
resource_res[r.
|
37
|
+
resource_res[r.get_name] = r.dump_json
|
38
38
|
end
|
39
39
|
end
|
40
40
|
res['Resources'] = resource_res
|
@@ -44,7 +44,7 @@ module CloudFormer
|
|
44
44
|
output_res = {}
|
45
45
|
@outputs.each do |output|
|
46
46
|
if (output[1].is_a?(Resource) || output[1].is_a?(Parameter))
|
47
|
-
output_res[output[0]] = { 'Value' => { 'Ref' => output[1].
|
47
|
+
output_res[output[0]] = { 'Value' => { 'Ref' => output[1].get_name } }
|
48
48
|
elsif output[1].is_a?(Function)
|
49
49
|
output_res[output[0]] = { 'Value' => output[1].dump_json }
|
50
50
|
else
|
data/lib/cloud_former/version.rb
CHANGED