kumogata 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +5 -5
- data/lib/kumogata/client.rb +19 -5
- data/lib/kumogata/ext/string_ext.rb +0 -4
- data/lib/kumogata/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWVlZDU1MjQ3Y2Y3NDk1Nzg5YmRiZTZjN2NkZjAyODY2NWNmY2NjYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjBkOWE5MjJhZTRkY2I0MjExMTc0ODY3NGYzY2M5MGRhOTg4ZjQzOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWNlZjUyZGRlNzJmYjc1MGFiYmU2M2U1ZDMwYTQyZGU5MzAwOWNjYTNlYmNi
|
10
|
+
MTRmOGIwOTk3OGM2OTIxOTRjYmVmOWUwZWY2MWU4NDVhMDQ3NjlhZWYzZjVh
|
11
|
+
MDU2NTM2ZGYwNjEwZGZiNzRiM2NhZjMyYmZhNjlhYmQ5NTM3YTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjEwYzI0Zjc5ZGZlNDA4ZmI5Yzc0ZWVjMGE3Y2FkNmJjZmY0MGMwZGMwOGJj
|
14
|
+
MmY2ZDdhNGM3MmQwZTY0ZTFlMDI5NzE4OTJiNjBkZjlmNzY0YTY3N2Y2ZmMx
|
15
|
+
YzhkOWQ2ZDFkNzBlNTlmZDNiMzUxNzJiMmJlNWU1OTk4Yzk3MDM=
|
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Kumogata is a tool for [AWS CloudFormation](https://aws.amazon.com/cloudformation/).
|
4
4
|
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/kumogata.png?
|
6
|
-
[![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/kumogata.png?201403031512)](http://badge.fury.io/rb/kumogata)
|
6
|
+
[![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403031512)](https://drone.io/github.com/winebarrel/kumogata/latest)
|
7
7
|
|
8
8
|
It can define a template in Ruby DSL, such as:
|
9
9
|
|
@@ -123,7 +123,7 @@ Ruby templates will be converted as follows by `_join()`:
|
|
123
123
|
```ruby
|
124
124
|
UserData do
|
125
125
|
Fn__Base64 _join(<<-EOS)
|
126
|
-
#!/bin/bash
|
126
|
+
#!/bin/bash
|
127
127
|
/opt/aws/bin/cfn-init -s <%= Ref "AWS::StackId" %> -r myEC2Instance --region <%= Ref "AWS::Region" %>
|
128
128
|
EOS
|
129
129
|
end
|
@@ -134,11 +134,11 @@ end
|
|
134
134
|
"Fn::Join": [
|
135
135
|
"",
|
136
136
|
[
|
137
|
-
"#!/bin/bash
|
137
|
+
"#!/bin/bash\n/opt/aws/bin/cfn-init -s ",
|
138
138
|
{
|
139
139
|
"Ref": "AWS::StackId"
|
140
140
|
},
|
141
|
-
"-r myEC2Instance --region
|
141
|
+
"-r myEC2Instance --region ",
|
142
142
|
{
|
143
143
|
"Ref": "AWS::Region"
|
144
144
|
},
|
data/lib/kumogata/client.rb
CHANGED
@@ -153,8 +153,12 @@ class Kumogata::Client
|
|
153
153
|
:strip => true,
|
154
154
|
}.merge(options)
|
155
155
|
|
156
|
-
|
156
|
+
if options[:strip]
|
157
|
+
data = data.split("\n").map {|i| i.gsub(/\A\s+/, "") }.join("\n") + "\n"
|
158
|
+
end
|
159
|
+
|
157
160
|
data = data.encode64 if options[:encode]
|
161
|
+
|
158
162
|
return data
|
159
163
|
end
|
160
164
|
|
@@ -175,12 +179,22 @@ class Kumogata::Client
|
|
175
179
|
|
176
180
|
data = data.flatten.select {|i| not i.nil? }
|
177
181
|
|
178
|
-
|
179
|
-
data
|
182
|
+
if options[:strip]
|
183
|
+
data = data.map do |item|
|
184
|
+
if item.kind_of?(String)
|
185
|
+
item.split("\n").map {|i| i.gsub(/\A\s+/, "") }.join("\n")
|
186
|
+
else
|
187
|
+
item
|
188
|
+
end
|
189
|
+
end
|
180
190
|
end
|
181
191
|
|
182
|
-
if
|
183
|
-
data
|
192
|
+
if data.last.kind_of?(String) and data.last == ""
|
193
|
+
data.last << "\n"
|
194
|
+
end
|
195
|
+
|
196
|
+
unless data.last.kind_of?(String) and data.last =~ /\n\Z/
|
197
|
+
data << "\n"
|
184
198
|
end
|
185
199
|
|
186
200
|
return {
|
data/lib/kumogata/version.rb
CHANGED