lono 2.0.5 → 2.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +3 -1
- data/lib/lono/clean.rb +2 -2
- data/lib/lono/template/dsl.rb +36 -2
- data/lib/lono/version.rb +1 -1
- data/spec/spec_helper.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01b405f56d85200ea0063749316264a0587ea359
|
4
|
+
data.tar.gz: 8963150180a2ff89f2cf125bea08099e27b73917
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9c78aa0037081874d77499a5ae30e127558fcf36c99098a318bb87dd3b493c6c59b5092c316ce7c77be55d71634ec70143e1520463f0657d1312732376c24b8
|
7
|
+
data.tar.gz: 9cf8a0df5380cf41469efcb82ec35466d5e9a7737d60275c727f4897f47ed0f55c3ee4b88aec7cb02c308a63bbb8a701fd4fe1a64275cc2bf906419cbb1a5625
|
data/CHANGELOG.md
CHANGED
@@ -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
|
+
## [2.1.0]
|
7
|
+
- improve instance_eval error when lono.rb errors, print out line of code and context
|
8
|
+
|
6
9
|
## [2.0.5]
|
7
10
|
- add example template to starter app
|
8
11
|
- add docs website
|
data/README.md
CHANGED
@@ -16,7 +16,9 @@ Lono is a tool for managing CloudFormation templates.
|
|
16
16
|
* Lono takes simple env-like files to and generates the CloudFormation parameter files.
|
17
17
|
* Lono wraps the CloudFormation api calls in a simple interface using the generated files to launch the CloudFormation stacks.
|
18
18
|
|
19
|
-
|
19
|
+
Lono documentation is at [lono.cloud](http://lono.cloud).
|
20
|
+
|
21
|
+
These blog posts also cover lono:
|
20
22
|
|
21
23
|
* [Why Generate CloudFormation Templates with Lono](https://medium.com/boltops/why-generate-cloudformation-templates-with-lono-65b8ea5eb87d)
|
22
24
|
* [Generating CloudFormation Templates with Lono](https://medium.com/boltops/generating-cloudformation-templates-with-lono-4709afa1299b)
|
data/lib/lono/clean.rb
CHANGED
data/lib/lono/template/dsl.rb
CHANGED
@@ -16,11 +16,45 @@ class Lono::Template::DSL
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def evaluate_templates
|
19
|
-
|
19
|
+
evaluate_template(@path)
|
20
20
|
load_subfolder
|
21
21
|
@detected_format = detect_format
|
22
22
|
end
|
23
23
|
|
24
|
+
def evaluate_template(path)
|
25
|
+
begin
|
26
|
+
instance_eval(File.read(path), path)
|
27
|
+
rescue Exception => e
|
28
|
+
template_evaluation_error(e)
|
29
|
+
puts "\nFull error:"
|
30
|
+
raise
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Prints out a user friendly task_definition error message
|
35
|
+
def template_evaluation_error(e)
|
36
|
+
error_info = e.backtrace.first
|
37
|
+
path, line_no, _ = error_info.split(':')
|
38
|
+
line_no = line_no.to_i
|
39
|
+
puts "Error evaluating #{path}:".colorize(:red)
|
40
|
+
puts e.message
|
41
|
+
puts "Here's the line in #{path} with the error:\n\n"
|
42
|
+
|
43
|
+
contents = IO.read(path)
|
44
|
+
content_lines = contents.split("\n")
|
45
|
+
context = 5 # lines of context
|
46
|
+
top, bottom = [line_no-context-1, 0].max, line_no+context-1
|
47
|
+
spacing = content_lines.size.to_s.size
|
48
|
+
content_lines[top..bottom].each_with_index do |line_content, index|
|
49
|
+
line_number = top+index+1
|
50
|
+
if line_number == line_no
|
51
|
+
printf("%#{spacing}d %s\n".colorize(:red), line_number, line_content)
|
52
|
+
else
|
53
|
+
printf("%#{spacing}d %s\n", line_number, line_content)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
24
58
|
# Detects the format of the templates. Simply checks the extension of all the
|
25
59
|
# templates files.
|
26
60
|
# All the templates must be of the same format, either all json or all yaml.
|
@@ -48,7 +82,7 @@ class Lono::Template::DSL
|
|
48
82
|
# load any templates defined in project/config/lono/*
|
49
83
|
def load_subfolder
|
50
84
|
Dir.glob("#{File.dirname(@path)}/lono/**/*").select{ |e| File.file? e }.each do |path|
|
51
|
-
|
85
|
+
evaluate_template(path)
|
52
86
|
end
|
53
87
|
end
|
54
88
|
|
data/lib/lono/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
ENV['TEST'] = '1'
|
2
|
+
# Ensures aws api never called. Fixture home folder does not contain ~/.aws/credentails
|
3
|
+
ENV['HOME'] = "spec/fixtures/home"
|
4
|
+
|
1
5
|
require "pp"
|
2
6
|
require "byebug"
|
3
7
|
require "bundler"
|
4
8
|
|
5
|
-
ENV['TEST'] = '1'
|
6
|
-
|
7
9
|
Bundler.require(:development)
|
8
10
|
|
9
11
|
$root = File.expand_path('../../', __FILE__)
|
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: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|