lono 0.5.0 → 0.5.1

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: 413f2dec340c5b134b099eecfd6b9967de951392
4
- data.tar.gz: 5b42248ae771ea16ab77813f58313aa88799d818
3
+ metadata.gz: 5f22815f0d37b64630426f8d41b5ce9dda35d769
4
+ data.tar.gz: eda8b669d1bfc0f329aca5023675a1ee8b34749e
5
5
  SHA512:
6
- metadata.gz: 4a996fe637be6f8c862604bc0036000f9218fe2be73f4446d0c56c05886b0bcc6acec28b6b9253bee7b2e3efcd06fbbfd6cbe9cf1957728cf2b9a3333ebb5870
7
- data.tar.gz: 92d051f6da1e9e26d81eff2bac01eaf7f426caef827f27b836388552663e24c34631d3c5c3ca9757b3b37bb05d554f40e1adf6d7f0e66d8e85c005f294d5bf71
6
+ metadata.gz: be44035d6b9839f41856712b65198de7470aef27917399e86638e27610f1af6f72afc3de1280f0e0b828920f97560582ad34ebf52f502fb85712d41d93ac8122
7
+ data.tar.gz: 38a7df0f01dade04897f3b717f34b8e29bab0e51e55814598445b6830781b2daa9f212eb44595973c4af601eaa5dd1f73637d068033d84b4937b509b279ede55
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.5.1]
7
+ - move ensure_dir up above validation so folder gets created even with bad json. fixes #14
8
+
6
9
  ## [0.5.0]
7
10
 
8
11
  - Update use newer ruby syntax.
data/README.md CHANGED
@@ -12,17 +12,18 @@
12
12
  [3]: https://codeclimate.com/repos/51d7f1407e00a4042c010ab4/badges/5273fe6cdb5a13e58554/gpa.png
13
13
  [4]: https://codeclimate.com/repos/51d7f1407e00a4042c010ab4/feed
14
14
 
15
- Lono is a Cloud Formation Template ruby generator. Lono generates Cloud Formation templates based on ERB templates.
15
+ Lono is a CloudFormation Template ruby generator. Lono generates CloudFormation templates based on ERB templates.
16
16
 
17
17
  ## Usage
18
18
 
19
19
  <pre>
20
- $ lono new lono
20
+ $ lono new infra
21
21
  </pre>
22
22
 
23
- This sets up a starter lono project with example templates.
23
+ This sets up a starter lono project called infra with example templates. Next you cd into the folder and generate the templates.
24
24
 
25
25
  <pre>
26
+ $ cd infra
26
27
  $ lono generate
27
28
  </pre>
28
29
 
@@ -83,7 +84,7 @@ Here's how you would call it in the template.
83
84
  }
84
85
  ```
85
86
 
86
- Within the user_data script you can use helper methods that correspond to Cloud Formation [Instrinic Functions](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/concept-intrinsic-functions.html). Currently, base64, find_in_map, get_att, get_azs, join, and ref are supported. Here's a short example of a user_data script using a helper method:
87
+ Within the user_data script you can use helper methods that correspond to CloudFormation [Instrinic Functions](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/concept-intrinsic-functions.html). Currently, base64, find_in_map, get_att, get_azs, join, and ref are supported. Here's a short example of a user_data script using a helper method:
87
88
 
88
89
  If you have a templates/user_data/db.sh.erb that looks like this:
89
90
 
@@ -117,7 +118,7 @@ chown -R redis:redis /media/redis
117
118
  /usr/local/bin/cfn-signal -e $? -r "Ready to rock" '<%= ref("WaitHandle") %>'
118
119
  ```
119
120
 
120
- The user_data helper will transform the bash script into a json array of elements for Cloud Formation:
121
+ The user_data helper will transform the bash script into a json array of elements for CloudFormation:
121
122
 
122
123
  ```json
123
124
  [
@@ -177,7 +178,7 @@ More examples of user_data and instrinic function helper method usage are found
177
178
 
178
179
  ## Converting UserData scripts
179
180
 
180
- You can convert UserData scripts in existing Cloud Formation Templates to a starter bash script via:
181
+ You can convert UserData scripts in existing CloudFormation Templates to a starter bash script via:
181
182
 
182
183
  <pre>
183
184
  $ lono bashify cloud_formation_template.json
@@ -185,7 +186,7 @@ $ lono bash cloud_formation_template.json # shorthand
185
186
  $ lono b https://s3.amazonaws.com/cloudformation-templates-us-east-1/LAMP_Single_Instance.template # shorthand and url
186
187
  </pre>
187
188
 
188
- This is useful if you want to take an existing [Cloud Formation Template example](http://aws.amazon.com/cloudformation/aws-cloudformation-templates/) and quicklly change the UserData section into a bash script. The bashify command will generate a snippet that is meant to be copied and pasted into a bash script and used with user_data helper method. The bash script should work right off the bat as lono will transform the generated Cloud Formation object references to json objects, there's no need to manually change what is generated to the helper methods, though you can if you prefer the look of the helper methods.
189
+ This is useful if you want to take an existing [CloudFormation Template example](http://aws.amazon.com/cloudformation/aws-cloudformation-templates/) and quicklly change the UserData section into a bash script. The bashify command will generate a snippet that is meant to be copied and pasted into a bash script and used with user_data helper method. The bash script should work right off the bat as lono will transform the generated CloudFormation object references to json objects, there's no need to manually change what is generated to the helper methods, though you can if you prefer the look of the helper methods.
189
190
 
190
191
  ## Breaking up config/lono.rb
191
192
 
@@ -201,8 +202,16 @@ $ lono generate
201
202
  $ lono g -c # shortcut
202
203
  </pre>
203
204
 
204
- The lono init command also sets up guard-lono. Guard-lono continuously generates the cloud formation templates. Just run guard.
205
+ The lono init command also sets up guard-lono. Guard-lono continuously generates the cloudformation templates. Just run guard.
205
206
 
206
207
  <pre>
207
208
  $ guard
208
209
  </pre>
210
+
211
+ ## Extras
212
+
213
+ There are some helper lono gems also useful for working with CloudFormation:
214
+
215
+ * [lono-cfn](https://github.com/tongueroo/lono-cfn) - Wrapper cfn tool to quickly create CloudFormation stacks from lono templates and params files.
216
+ * [lono-params](https://github.com/tongueroo/lono-params) - Tool to generate a CloudFormation params json formatted file from a simplier env like file.
217
+
@@ -12,7 +12,7 @@ module Lono
12
12
  Lono::New.new(options.clone.merge(project_root: project_root)).run
13
13
  end
14
14
 
15
- desc "generate", "Generate the cloud formation templates"
15
+ desc "generate", "Generate the cloudformation templates"
16
16
  Help.generate
17
17
  option :clean, type: :boolean, aliases: "-c", desc: "remove all output files before generating"
18
18
  option :project_root, default: ".", aliases: "-r", desc: "project root"
@@ -22,7 +22,7 @@ module Lono
22
22
  Lono::DSL.new(options.clone).run
23
23
  end
24
24
 
25
- desc "bashify [URL-OR-PATH]", "Convert the UserData section of an existing Cloud Formation Template to a starter bash script that is compatiable with lono"
25
+ desc "bashify [URL-OR-PATH]", "Convert the UserData section of an existing CloudFormation Template to a starter bash script that is compatiable with lono"
26
26
  Help.bashify
27
27
  def bashify(path)
28
28
  Lono::Bashify.new(path: path).run
@@ -18,7 +18,7 @@ $ lono generate
18
18
 
19
19
  $ lono g -c # shortcut
20
20
 
21
- Builds the cloud formation templates files based on lono project and writes them to the output folder on the filesystem.
21
+ Builds the cloudformation templates files based on lono project and writes them to the output folder on the filesystem.
22
22
  EOL
23
23
  end
24
24
 
@@ -34,4 +34,4 @@ EOL
34
34
 
35
35
  extend self
36
36
  end
37
- end
37
+ end
@@ -34,12 +34,12 @@ module Lono
34
34
  output_path = "#{@options[:project_root]}/output"
35
35
  FileUtils.rm_rf(output_path) if @options[:clean]
36
36
  FileUtils.mkdir(output_path) unless File.exist?(output_path)
37
- puts "Generating Cloud Formation templates:" unless @options[:quiet]
37
+ puts "Generating CloudFormation templates:" unless @options[:quiet]
38
38
  @results.each do |name,json|
39
39
  path = "#{output_path}/#{name}"
40
40
  puts " #{path}" unless @options[:quiet]
41
- validate(json, path)
42
41
  ensure_parent_dir(path)
42
+ validate(json, path)
43
43
  File.open(path, 'w') do |f|
44
44
  f.write(output_json(json))
45
45
  end
@@ -82,7 +82,7 @@ module Lono
82
82
  arr.join(',')
83
83
  end
84
84
 
85
- # transform each line of bash script to array with cloud formation template objects
85
+ # transform each line of bash script to array with cloudformation template objects
86
86
  def transform(data)
87
87
  data = evaluate(data)
88
88
  if data[-1].is_a?(String)
@@ -202,4 +202,4 @@ module Lono
202
202
  recompose(decompose(line))
203
203
  end
204
204
  end
205
- end
205
+ end
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -4,8 +4,8 @@ require File.expand_path('../lib/lono/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Tung Nguyen"]
6
6
  gem.email = ["tongueroo@gmail.com"]
7
- gem.description = %q{Lono is a Cloud Formation Template ruby generator. Lono generates Cloud Formation templates based on ERB templates.}
8
- gem.summary = %q{Lono is a Cloud Formation Template ruby generator. Lono generates Cloud Formation templates based on ERB templates.}
7
+ gem.description = %q{Lono is a CloudFormation Template ruby generator. Lono generates CloudFormation templates based on ERB templates.}
8
+ gem.summary = %q{Lono is a CloudFormation Template ruby generator. Lono generates CloudFormation templates based on ERB templates.}
9
9
  gem.homepage = "http://github.com/tongueroo/lono"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
@@ -23,7 +23,7 @@ describe Lono do
23
23
  end
24
24
 
25
25
  describe "parsing" do
26
- it "should transform bash script into json array with cloud formation objects" do
26
+ it "should transform bash script into json array with cloudformation objects" do
27
27
  block = Proc.new { }
28
28
  template = Lono::Template.new("foo", block)
29
29
 
@@ -88,7 +88,7 @@ describe Lono do
88
88
  dsl.run
89
89
  end
90
90
 
91
- it "should generate cloud formation template" do
91
+ it "should generate cloudformation template" do
92
92
  raw = IO.read("#{@project}/output/prod-api-app.json")
93
93
  json = JSON.load(raw)
94
94
  expect(json['Description']).to eq "Api Stack"
@@ -181,7 +181,7 @@ describe Lono do
181
181
  expect(directory_created).to be true
182
182
  end
183
183
 
184
- it "task should generate cloud formation templates" do
184
+ it "task should generate CloudFormation templates" do
185
185
  raw = IO.read("#{@project}/output/prod-api-app.json")
186
186
  json = JSON.load(raw)
187
187
  expect(json['Description']).to eq "Api Stack"
@@ -192,7 +192,7 @@ describe Lono do
192
192
  describe "cli specs" do
193
193
  it "should generate templates" do
194
194
  out = execute("./bin/lono generate -c --project-root #{@project}")
195
- expect(out).to match /Generating Cloud Formation templates/
195
+ expect(out).to match /Generating CloudFormation templates/
196
196
  end
197
197
  end
198
198
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lono
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-29 00:00:00.000000000 Z
11
+ date: 2016-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -164,8 +164,8 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
- description: Lono is a Cloud Formation Template ruby generator. Lono generates Cloud
168
- Formation templates based on ERB templates.
167
+ description: Lono is a CloudFormation Template ruby generator. Lono generates CloudFormation
168
+ templates based on ERB templates.
169
169
  email:
170
170
  - tongueroo@gmail.com
171
171
  executables:
@@ -232,8 +232,8 @@ rubyforge_project:
232
232
  rubygems_version: 2.6.4
233
233
  signing_key:
234
234
  specification_version: 4
235
- summary: Lono is a Cloud Formation Template ruby generator. Lono generates Cloud
236
- Formation templates based on ERB templates.
235
+ summary: Lono is a CloudFormation Template ruby generator. Lono generates CloudFormation
236
+ templates based on ERB templates.
237
237
  test_files:
238
238
  - spec/fixtures/cfn.json
239
239
  - spec/lib/lono_spec.rb