kumogata 0.2.1 → 0.2.2

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: d994503ecb53c0aa9e0a0d7317a3f6b6cc8b2b39
4
- data.tar.gz: cd96c9f28fdc83ba2025828f9ef5b305a3d5a313
3
+ metadata.gz: 9282e45b98b32e3c888ddfff061da0bc320528c0
4
+ data.tar.gz: 280684e5055d626dfb1215a6f53eae8c386b5c61
5
5
  SHA512:
6
- metadata.gz: 8392415cc172bc02adc1fb976316dfd7b7e4bdd4cde81cf6aca088a0af13480f5da9517461da3d1e8c530c1ce6a78662057a04e300706f2dda5695e046ccc621
7
- data.tar.gz: 14a7759b1a3acfc951f3cc20ab317180972c9fe147b2f4fc7d1920cefda4b2c5d43c0f96c3e86499501404c66dec2855f279e4a6b7c4661a1e6b4aabb642ceec
6
+ metadata.gz: 8787902eada204842507d2e54a9d6cd1e740e12416cf335684970a602040460bef6a3c4ba87478b58db0c141be5b17cc78b5938ba3fad01aea032bb40b1281ac
7
+ data.tar.gz: 561ce9fcc167842fc85a5aaa42ac3a11a7142b4cf0cf49b08b1f6386a34293dfa545455b3add759b72caa00003da303b3e882f159840e875f8168adcbb5cfbf4
data/README.md CHANGED
@@ -5,8 +5,8 @@
5
5
 
6
6
  Kumogata is a tool for [AWS CloudFormation](https://aws.amazon.com/cloudformation/).
7
7
 
8
- [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403050220)](http://badge.fury.io/rb/kumogata)
9
- [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403050220)](https://drone.io/github.com/winebarrel/kumogata/latest)
8
+ [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403050245)](http://badge.fury.io/rb/kumogata)
9
+ [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403050245)](https://drone.io/github.com/winebarrel/kumogata/latest)
10
10
 
11
11
  It can define a template in Ruby DSL, such as:
12
12
 
@@ -58,32 +58,81 @@ class String
58
58
  end
59
59
 
60
60
  def Fn__Base64(value)
61
- @__functions__ << {'Fn::Base64' => @__value_conv__[value]}
61
+ value = {'Fn::Base64' => @__value_conv__[value]}
62
+
63
+ case @__functions__
64
+ when Array
65
+ @__functions__ << value
66
+ when Hash
67
+ @__functions__.update(value)
68
+ end
69
+
62
70
  #{null.inspect}
63
71
  end
64
72
 
65
73
  def Fn__FindInMap(map_name, top_level_key, second_level_key)
66
- @__functions__ << {'Fn::FindInMap' => [
74
+ value = {'Fn::FindInMap' => [
67
75
  map_name, top_level_key, second_level_key].map(&@__value_conv__)}
76
+
77
+ case @__functions__
78
+ when Array
79
+ @__functions__ << value
80
+ when Hash
81
+ @__functions__.update(value)
82
+ end
83
+
68
84
  #{null.inspect}
69
85
  end
70
86
 
71
87
  def Fn__GetAtt(logical_name, attr_name)
72
- @__functions__ << {'Fn::GetAtt' => [
88
+ value = {'Fn::GetAtt' => [
73
89
  logical_name, attr_name].map(&@__value_conv__)}
90
+
91
+ case @__functions__
92
+ when Array
93
+ @__functions__ << value
94
+ when Hash
95
+ @__functions__.update(value)
96
+ end
97
+
74
98
  #{null.inspect}
75
99
  end
76
100
 
77
101
  def Fn__GetAZs(region)
78
- @__functions__ << {'Fn::GetAZs' => @__value_conv__[region]}
102
+ value = {'Fn::GetAZs' => @__value_conv__[region]}
103
+
104
+ case @__functions__
105
+ when Array
106
+ @__functions__ << value
107
+ when Hash
108
+ @__functions__.update(value)
109
+ end
110
+
79
111
  #{null.inspect}
80
112
  end
81
113
 
82
114
  def Ref(value)
83
- @__functions__ << {'Ref' => value}
115
+ value = {'Ref' => value}
116
+
117
+ case @__functions__
118
+ when Array
119
+ @__functions__ << value
120
+ when Hash
121
+ @__functions__.update(value)
122
+ end
123
+
84
124
  #{null.inspect}
85
125
  end
86
126
 
127
+ def _(&block)
128
+ __functions__orig = @__functions__
129
+ @__functions__ = {}
130
+ block.call if block
131
+ value = @__functions__
132
+ @__functions__ = __functions__orig
133
+ return value
134
+ end
135
+
87
136
  ERB.new(#{data.inspect}, nil, #{trim_mode.inspect}).result(binding).split(#{null.inspect}).zip(@__functions__)
88
137
  EOS
89
138
 
@@ -1,3 +1,3 @@
1
1
  module Kumogata
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -359,7 +359,7 @@ Outputs do
359
359
 
360
360
  MappedValue do
361
361
  Value (<<-EOS).fn_join
362
- <%= Fn__FindInMap "RegionMap", { "Ref" => "AWS::Region" }, 32 %>
362
+ <%= Fn__FindInMap "RegionMap", _{ Ref "AWS::Region" }, 32 %>
363
363
  EOS
364
364
  end
365
365
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumogata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara