lono-pro 0.4.8 → 0.4.9

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
  SHA256:
3
- metadata.gz: 9314998d776bc4e6fda6708fe33994efeae53604fe7a1833ff21c9687ab6e521
4
- data.tar.gz: f4a8890b64606852faaf88c05c1d05012dd520165a85f76d055f881ffa08ad21
3
+ metadata.gz: ec1f4e571babb526db3598539b72bb9921de4f74f9d53bb5e13047e078dfbff7
4
+ data.tar.gz: 262fa8af460642f576bb2a40e2cf70a0b4355b2024dec898fee8ddbff101b8dd
5
5
  SHA512:
6
- metadata.gz: 41c377c51692c483f97aaffccef61671d3553625448e0b7eacef1eeec9a6e1ad666aef71270901c205c252f811f7189f0e4eb125743497c392520018ccc2f5a5
7
- data.tar.gz: 2d9a89e34462ae5c79f975dcc0b83dc11e22ed31157e28c0f952ac0e000e1cdfedc25ececc56f533d9e674693385ea4854e56858aaac0a12e95735799f74ec1f
6
+ metadata.gz: 9b65743cfc4d93eb73a70fcbd367468241285dab7e1d0bad54f107c6ec8b5c97a3c5bd33ab3e0b99e44c398467ad33fe6eb1dd9c79931d46dcbbe6ac4a48ecf2
7
+ data.tar.gz: 4250ac5cbd0348edb648c5fb398ffc1013e2793d8130104e29815458c86be6a4e1a42d563c4c78c9c91c027a64cbfa339e8637ced8028644ca600a3543ed3dab
data/.gitignore CHANGED
@@ -9,4 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
- Gemfile.lock
12
+ Gemfile.lock
13
+ /blueprints
@@ -3,6 +3,10 @@
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.4.9]
7
+ - #2 improve error response with error data
8
+ - yellow color for invalid ruby syntax warning
9
+
6
10
  ## [0.4.8]
7
11
  - add options for Thor::Actions to work with empty configs folder
8
12
 
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Lono Pro Addon
2
2
 
3
+ [![BoltOps Badge](https://img.boltops.com/boltops/badges/boltops-badge.png)](https://www.boltops.com)
4
+
3
5
  Lono pro is a paid addon that adds additional features to [lono](https://lono.cloud). Notably, the `lono code import` and `lono code convert` commands.
4
6
 
5
7
  The conversion process gets you 80% of the way here. It saves you time.
@@ -3,11 +3,28 @@
3
3
  lono code import path/to/file
4
4
  lono code import http://example.com/url/to/template.yml
5
5
  lono code import http://example.com/url/to/template.json
6
+ lono code import http://example.com/url/to/template.json --blueprint myblueprint
6
7
 
7
8
  ## Example with Output
8
9
 
9
- $ URL=https://s3-us-east-2.amazonaws.com/cloudformation-templates-us-east-2/AutoScalingMultiAZWithNotifications.template
10
- $ lono code import $URL --blueprint asg
11
- Template imported to: blueprints/asg/app/templates/asg.rb
12
- Params file created at configs/asg/development.txt
10
+ $ URL=https://s3.amazonaws.com/cloudformation-templates-us-east-1/EC2InstanceWithSecurityGroupSample.template
11
+ $ lono code import $URL --blueprint ec2
12
+ => Creating new blueprint called ec2.
13
+ create blueprints/ec2
14
+ create blueprints/ec2/ec2.gemspec
15
+ create blueprints/ec2/.gitignore
16
+ create blueprints/ec2/.meta/config.yml
17
+ create blueprints/ec2/CHANGELOG.md
18
+ create blueprints/ec2/Gemfile
19
+ create blueprints/ec2/README.md
20
+ create blueprints/ec2/Rakefile
21
+ create blueprints/ec2/seed/configs.rb
22
+ create blueprints/ec2/app/templates
23
+ create blueprints/ec2/app/templates/ec2.rb
24
+ create configs/ec2/params/development.txt
25
+ create configs/ec2/params/production.txt
26
+ ================================================================
27
+ Congrats You have successfully imported a lono blueprint.
28
+
29
+ More info: https://lono.cloud/docs/core/blueprints
13
30
  $
@@ -23,8 +23,7 @@ class Lono::Pro::Importer::Service::Coder
23
23
 
24
24
  if res.code == "200"
25
25
  data = JSON.load(res.body)
26
- print(data)
27
- data["ruby_code"]
26
+ print(data) # returns data["ruby_code"] / passthrough
28
27
  else
29
28
  puts "Unable to convert template to Ruby code."
30
29
  puts "The error has been reported."
@@ -36,12 +35,25 @@ class Lono::Pro::Importer::Service::Coder
36
35
 
37
36
  private
38
37
  def print(data)
39
- return unless @options[:print]
38
+ return unless @options[:print] || ENV['LONO_PRO_TEST']
39
+
40
+ if data["error"]
41
+ # Code was processed but there was this error with an HTTP 200 OK
42
+ $stderr.puts "ERROR: #{data["error"]}".color(:red)
43
+ if data["message"]
44
+ $stderr.puts data["message"]
45
+ end
46
+ return
47
+ end
40
48
 
41
49
  validity = data["valid_ruby"] ? "valid" : "invalid"
50
+ if validity == "valid"
51
+ $stderr.puts "INFO: The generated Ruby code is has #{validity} syntax."
52
+ else
53
+ $stderr.puts "WARN: The generated Ruby code is has #{validity} syntax. Providing because it may be small errors.".color(:yellow) # note redirection disables color
54
+ end
42
55
  $stderr.puts <<~EOL
43
- INFO: The ruby syntax is #{validity}
44
- INFO: Translated ruby code below:
56
+ Translated ruby code below:
45
57
 
46
58
  EOL
47
59
  ruby_code = data["ruby_code"]
@@ -1,5 +1,5 @@
1
1
  module Lono
2
2
  module Pro
3
- VERSION = "0.4.8"
3
+ VERSION = "0.4.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lono-pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-30 00:00:00.000000000 Z
11
+ date: 2019-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk