cloud_builder 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -49,6 +49,13 @@ See stacks/example.rb for an example stack.
49
49
 
50
50
  ## Changelog
51
51
 
52
+ ### 0.0.9
53
+ - add support for DeletionPolicy resource attribute (see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html)
54
+ - remove debug puts in mappings.rb
55
+
56
+ ### 0.0.8
57
+ - fix #3 Prevent creation of resources with the same name
58
+
52
59
  ### 0.0.7
53
60
  - add license to gemspec
54
61
 
data/lib/cloud_builder.rb CHANGED
@@ -36,6 +36,7 @@ module CloudBuilder
36
36
  VALUE = 'Value'
37
37
  PROPAGATE_AT_LAUNCH = 'PropagateAtLaunch'
38
38
  VERSION = 'AWSTemplateFormatVersion'
39
+ DELETION_POLICY = 'DeletionPolicy'
39
40
 
40
41
 
41
42
  class Spec
@@ -51,9 +51,10 @@ module CloudBuilder
51
51
  end
52
52
 
53
53
  def resource(name, &block)
54
- if _resources[name.to_s]
54
+ if _resources.has_key?(name.to_s)
55
55
  raise NameError('resource %s is already defined' % name.to_s)
56
56
  end
57
+
57
58
  _resources[name.to_s] = Resource.new(self, name, &block)
58
59
  end
59
60
 
@@ -62,10 +63,18 @@ module CloudBuilder
62
63
  end
63
64
 
64
65
  def parameter(name, &block)
66
+ if _parameters.has_key?(DSL.format(name.to_s))
67
+ raise NameError('parameter %s is already defined' % name.to_s)
68
+ end
69
+
65
70
  _parameters[DSL.format(name.to_s)] = Parameter.new(self, &block)
66
71
  end
67
72
 
68
73
  def output(name, &block)
74
+ if _outputs.has_key?(DSL.format(name.to_s))
75
+ raise NameError('output %s is already defined' % name.to_s)
76
+ end
77
+
69
78
  _outputs[DSL.format(name.to_s)] = Output.new(self, &block)
70
79
  end
71
80
 
@@ -9,6 +9,7 @@ module CloudBuilder
9
9
  @properties = {}
10
10
  @metadata = {}
11
11
  @block = block
12
+ @deletion_policy = nil
12
13
 
13
14
  # add metadata describing the brick we were defined in
14
15
  if @block.binding.eval('@type')
@@ -42,6 +43,10 @@ module CloudBuilder
42
43
  @current_map = old_map
43
44
  end
44
45
 
46
+ def deletion_policy(value)
47
+ @deletion_policy = value
48
+ end
49
+
45
50
  def brick
46
51
  @block.binding.eval('brick')
47
52
  end
@@ -63,11 +68,17 @@ module CloudBuilder
63
68
  end
64
69
 
65
70
  def to_json_data
71
+ ret = {TYPE => @type, METADATA => @metadata, PROPERTIES => @properties}
72
+
66
73
  if @version
67
- {TYPE => @type, "Version" => @version, METADATA => @metadata, PROPERTIES => @properties}
68
- else
69
- {TYPE => @type, METADATA => @metadata, PROPERTIES => @properties}
74
+ ret["Version"] = @version
70
75
  end
76
+
77
+ if @deletion_policy
78
+ ret[DELETION_POLICY] = @deletion_policy
79
+ end
80
+
81
+ ret
71
82
  end
72
83
 
73
84
  def method_missing(field, *params)
@@ -1,3 +1,3 @@
1
1
  module CloudBuilder
2
- GEM_VERSION = "0.0.8"
2
+ GEM_VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-21 00:00:00.000000000 Z
12
+ date: 2013-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: netaddr