lono 2.0.5 → 2.1.0

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: 4004cb33d3863a0160d5e75e3e24fd261448e206
4
- data.tar.gz: b83737a5e2de0c98835fcebbc44da709b4e0e2b1
3
+ metadata.gz: 01b405f56d85200ea0063749316264a0587ea359
4
+ data.tar.gz: 8963150180a2ff89f2cf125bea08099e27b73917
5
5
  SHA512:
6
- metadata.gz: 781e08333e3487dfc7025406f2b83b994bbadc22783bbb723e31f479ae4e9686accef93dfc870c6c014d6c8bb5245d24ff0ea55dfe6b4c33fd52cf01f65a693e
7
- data.tar.gz: 9fbbd4cd14c0b7ae2b7a644950acb954fe54774c07f5c3d89a8a2cb302d2a02b43077e41e5ced05c5dc6c5cc08e7cd86cc2542763532251aebc82d8a05c2fabb
6
+ metadata.gz: c9c78aa0037081874d77499a5ae30e127558fcf36c99098a318bb87dd3b493c6c59b5092c316ce7c77be55d71634ec70143e1520463f0657d1312732376c24b8
7
+ data.tar.gz: 9cf8a0df5380cf41469efcb82ec35466d5e9a7737d60275c727f4897f47ed0f55c3ee4b88aec7cb02c308a63bbb8a701fd4fe1a64275cc2bf906419cbb1a5625
@@ -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
- These blog posts cover lono:
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)
@@ -9,7 +9,7 @@ class Lono::Clean
9
9
 
10
10
  def run
11
11
  puts "Cleaning up"
12
- puts "Removing output/*"
13
- FileUtils.rm_rf("#{@project_root}/output/*")
12
+ puts "Removing output/ folder"
13
+ FileUtils.rm_rf("#{@project_root}/output")
14
14
  end
15
15
  end
@@ -16,11 +16,45 @@ class Lono::Template::DSL
16
16
  end
17
17
 
18
18
  def evaluate_templates
19
- instance_eval(File.read(@path), @path)
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
- instance_eval(File.read(path), path)
85
+ evaluate_template(path)
52
86
  end
53
87
  end
54
88
 
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "2.0.5"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -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.5
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-07 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json