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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0974d1c76501fe359e3eba0417a508c24c8d4eb0
4
- data.tar.gz: d468900b6beba3b319e3c1f73d7fd0cca8f858cc
3
+ metadata.gz: f15b74755839584a05c3254388c66d505674bb0a
4
+ data.tar.gz: cbb3a4a4837f07f6b6a9968420b3bd6cab52c662
5
5
  SHA512:
6
- metadata.gz: 89cd956ad1619403b8bd0154ac9817d6efa0cf8f94dfa0069576c2ba4424e8fa6904797b2313e2d78b8ba86a7f9621f45cd6399c70f7b76a19a45b431248a15c
7
- data.tar.gz: 1ec3ce984f31598ef74f5026538804c53881434df6b5c2589db39244d9701aa194d305b07ba088aca7dd503d0be0730ec7a7b535537aa689676205d3dc6f7e6f
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?(:name)
16
- { 'Fn::GetAtt' => [@resource.name, @attribute] }
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
@@ -18,7 +18,7 @@ module CloudFormer
18
18
  elsif piece.is_a?(Function)
19
19
  piece.dump_json
20
20
  elsif piece.is_a?(Resource)
21
- { 'Ref' => piece.name }
21
+ { 'Ref' => piece.get_name }
22
22
  else
23
23
  piece
24
24
  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.name }
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.name.nil? || val.name.empty?
36
- raise ArgumentError.new("Attempting to reference a resource of type #{val.class.name} with no name")
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.name }
41
+ { 'Ref' => val.get_name }
39
42
  end
40
43
  elsif val.is_a?(Hash)
41
44
  mapped_hash = {}
@@ -1,5 +1,7 @@
1
1
  module CloudFormer
2
2
  class PseudoParameter
3
- attr_reader :name
3
+ def get_name
4
+ @name
5
+ end
4
6
  end
5
7
  end
@@ -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
- raise ArgumentError.new("Attempting to create a resource of type #{self.class.name} with no name")
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 name(arg=nil)
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.name] = r.dump_json
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].name } }
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
@@ -1,3 +1,3 @@
1
1
  module CloudFormer
2
- VERSION = '0.5.8'
2
+ VERSION = '0.5.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_former
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aubrey Holland