kumogata 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTA0NDRkYThiNzBhNzgwODU4YWUxOTM5ZDNjYjUwMjU2Yzc3OTY0MA==
4
+ MDNiMDIxYmY2ZWM3MmI4ZDBiMzgwMGI1NjBmYTIxMDE5ZDhhZDliMw==
5
5
  data.tar.gz: !binary |-
6
- NzJmZjYzZTI2NDg0OGFkN2M2NTZiZWNkOTA0ZmZmYWVkODkwMDU5Zg==
6
+ NWMzMTI4ZTBmZDczMzRhYmIwZjUxZThmMWVhMzRlYmZiZGFkMTVlZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjY5YTYzMDliYTkwNTJhNzdkMmY4MDgwY2E0NTJiMDEwOTUxMzliNDNiZjBh
10
- ZmMxOTA2OWM2ZjI1MWVjOWYxOGRlNTAwMmIwNWZjNjNhNmZiMGU1Nzg0N2Ux
11
- ODZiOTBjOWVlY2VlNjQyYjZiZjgyZTBjZDhjZDYwZWZhY2E4M2Q=
9
+ YWRkMTA5NzMzMzE3M2M5MjNmNzMyOTVjZDU3MWU4YmY2OTQ1YzFiYTlmMzMz
10
+ ODQzZGIyNzg4ZjQ0MjgzYTIzMzZjYWY2ZWU1MTYyMTMzOGE0Njk0ZWI5N2Y3
11
+ NjIzMjdkMTc1YTUyZmVjMGZkMzc5MWQ4M2YwMTZlZTgxMDI3NzI=
12
12
  data.tar.gz: !binary |-
13
- ZmU3MmY5YjU0YWE4YmY1ZDczNWU1Nzg1NGJiN2Y4ODkyMmE4ZDg0YzBhYzgx
14
- OGZkNjM2NzBjOTViZWUzZmI3ZTQwOTYwYTA3ZWZkYmI2YTNjODZlMmU5MmE1
15
- MjViMmQ4YTMxNzU4ZWZmOTM1ZTJhYmNjNzE1N2Q4NWJjMTlhNTk=
13
+ ZTAwZDc5MjExNThlM2U1ODJhN2NiNDNlZDRlNzFkMmMyNGVkZjlmNzA4OGU5
14
+ NjUxNTAyMWVjOGQzYTgwYmUyMTk3YTUwMWEwMzU1YWJlNTliYmE5OWQwODMx
15
+ N2VmODhiZjRiYTRlNmEzMmVhMzY0NzAyZjg5ZGRhZDZkNzhjNWU=
data/README.md CHANGED
@@ -1,9 +1,12 @@
1
1
  # Kumogata
2
2
 
3
+ ![Stack is not required!](http://serif.hatelabo.jp/images/cache/a69b56ca6985b6ee7e605a102445953f355f54f5/62192c286da4377e608f3f5a5200f1bec272a92e.gif)
4
+
5
+
3
6
  Kumogata is a tool for [AWS CloudFormation](https://aws.amazon.com/cloudformation/).
4
7
 
5
- [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403031647)](http://badge.fury.io/rb/kumogata)
6
- [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403031647)](https://drone.io/github.com/winebarrel/kumogata/latest)
8
+ [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403041709)](http://badge.fury.io/rb/kumogata)
9
+ [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403041709)](https://drone.io/github.com/winebarrel/kumogata/latest)
7
10
 
8
11
  It can define a template in Ruby DSL, such as:
9
12
 
@@ -124,7 +127,7 @@ Ruby templates will be converted as follows by `_join()`:
124
127
  UserData do
125
128
  Fn__Base64 _join(<<-EOS)
126
129
  #!/bin/bash
127
- /opt/aws/bin/cfn-init -s <%= Ref "AWS::StackId" %> -r myEC2Instance --region <%= Ref "AWS::Region" %>
130
+ /opt/aws/bin/cfn-init -s <%= Ref "AWS::StackName" %> -r myEC2Instance --region <%= Ref "AWS::Region" %>
128
131
  EOS
129
132
  end
130
133
  ```
@@ -136,7 +139,7 @@ end
136
139
  [
137
140
  "#!/bin/bash\n/opt/aws/bin/cfn-init -s ",
138
141
  {
139
- "Ref": "AWS::StackId"
142
+ "Ref": "AWS::StackName"
140
143
  },
141
144
  " -r myEC2Instance --region ",
142
145
  {
@@ -154,7 +154,7 @@ class Kumogata::Client
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"
157
+ data = data.split("\n").map {|i| i.gsub(/\A\s+/, '') }.join("\n") + "\n"
158
158
  end
159
159
 
160
160
  data = data.encode64 if options[:encode]
@@ -180,23 +180,35 @@ class Kumogata::Client
180
180
  data = data.flatten.select {|i| not i.nil? }
181
181
 
182
182
  if options[:strip]
183
- prev_not_str = false
183
+ prev_elem_is_string = true
184
184
 
185
- data = data.map do |item|
185
+ data = data.map {|item|
186
186
  if item.kind_of?(String)
187
- item = item.split("\n").map {|i|
188
- prev_not_str ? i : i.gsub(/\A\s+/, "")
189
- }.join("\n")
190
- prev_not_str = false
191
- item
187
+ new_item = []
188
+ splited = item.split("\n")
189
+
190
+ splited.each_with_index do |i, idx|
191
+ unless idx.zero? and not prev_elem_is_string
192
+ i.gsub!(/\A\s+/, '')
193
+ end
194
+
195
+ if idx < splited.length - 1
196
+ i << "\n"
197
+ end
198
+
199
+ new_item << i
200
+ end
201
+
202
+ prev_elem_is_string = true
203
+ new_item
192
204
  else
193
- prev_not_str = true
205
+ prev_elem_is_string = false
194
206
  item
195
207
  end
196
- end
208
+ }.flatten
197
209
  end
198
210
 
199
- if data.last.kind_of?(String) and data.last.strip == ""
211
+ if data.last.kind_of?(String) and data.last.strip.empty?
200
212
  data.last.replace("\n")
201
213
  end
202
214
 
@@ -1,3 +1,3 @@
1
1
  module Kumogata
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
@@ -113,7 +113,9 @@ Resources do
113
113
  UserData do
114
114
  Fn__Base64 _join(<<-EOS)
115
115
  #!/bin/bash
116
+ echo START | logger
116
117
  /opt/aws/bin/cfn-init -s <%= Ref "AWS::StackName" %> -r myEC2Instance --region <%= Ref "AWS::Region" %>
118
+ echo END | logger
117
119
  EOS
118
120
  end
119
121
  end
@@ -171,7 +173,9 @@ end
171
173
  "Fn::Join": [
172
174
  "",
173
175
  [
174
- "#!/bin/bash\n/opt/aws/bin/cfn-init -s ",
176
+ "#!/bin/bash\n",
177
+ "echo START | logger\n",
178
+ "/opt/aws/bin/cfn-init -s ",
175
179
  {
176
180
  "Ref": "AWS::StackName"
177
181
  },
@@ -179,6 +183,8 @@ end
179
183
  {
180
184
  "Ref": "AWS::Region"
181
185
  },
186
+ "\n",
187
+ "echo END | logger",
182
188
  "\n"
183
189
  ]
184
190
  ]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumogata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-03 00:00:00.000000000 Z
11
+ date: 2014-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk