lono-pro 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d3d921141c36b14bbfedbe78646c6e09966fd55dfd0d13f809cfbb50b7fb44a
4
- data.tar.gz: 54d5618c7985e3a578f2f9f51c88e0e56dda900f1d5542308e728b09d07b3cee
3
+ metadata.gz: a31793de41cad9bbf7c4be534c30f19a3aebbdd73bc099024717c9e4e46e8359
4
+ data.tar.gz: 924d5bbea56cb33ccee980288d0cc11e24d2629983bba698e5a00b8bd9d0fd5c
5
5
  SHA512:
6
- metadata.gz: '0228935145363b2238c72b9f61245043d233bbce07c39ad0a3b9a4722f6aaf6894e2d33168170bd0e5d272ac4397b2411b243ff656877f1287673a925e97f2f3'
7
- data.tar.gz: 3507512cf1e0c40e0b42d3d36322c61425e4725d01d877f6211cabc7dc26fb1bde8fce3ec028ea8972293ecc09b8a93c094473a1d7d4c5ce8b7a8ff47c609d97
6
+ metadata.gz: f0d4d2722b5ddb3815e56a99602f64463215be021fd85174e07d5b0e16b27e73e9efa70f05dadccdf3154c54917fa523396208487bc2659f57a7f5366d54d61b
7
+ data.tar.gz: 38ca2bcc2782d359783cfa51b40d86e5e150a86d3f92431ce948e2398367c17d32fa48cd6585e097fc348ff972551d3f4f5cc189608f1d5b3c0a0625565ea55f
data/CHANGELOG.md CHANGED
@@ -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.0]
7
+ - exit 1 if ruby code was not able to be translated
8
+ - fill in imported params file with default values
9
+
6
10
  ## [0.3.0]
7
11
  - only print ruby code to stdout with lono code convert
8
12
  - source can be file or url source
data/Gemfile CHANGED
@@ -4,5 +4,4 @@ gemspec
4
4
 
5
5
  group :development, :test do
6
6
  gem "lono"
7
- # gem "lono", path: "#{ENV['HOME']}/environment/lono"
8
7
  end
@@ -6,7 +6,7 @@
6
6
 
7
7
  ## Example with Output
8
8
 
9
- $ lono code import https://s3-us-east-2.amazonaws.com/cloudformation-templates-us-east-2/asg.template
9
+ $ lono code import https://s3-us-east-2.amazonaws.com/cloudformation-templates-us-east-2/AutoScalingMultiAZWithNotifications.template --blueprint asg
10
10
  Template imported to: blueprints/asg/app/templates/asg.rb
11
11
  Params file created at configs/asg/development.txt
12
12
  $
@@ -22,9 +22,9 @@ class Lono::Pro::Importer
22
22
 
23
23
  def create_params(template_path)
24
24
  params_path = if @blueprint != @template
25
- "configs/#{@blueprint}/#{Lono.env}/#{@template}.txt"
25
+ "configs/#{@blueprint}/params/#{Lono.env}/#{@template}.txt"
26
26
  else
27
- "configs/#{@blueprint}/#{Lono.env}.txt"
27
+ "configs/#{@blueprint}/params/#{Lono.env}.txt"
28
28
  end
29
29
  params = Params.new(template_path, params_path)
30
30
  params.create
@@ -12,7 +12,7 @@ class Lono::Pro::Importer
12
12
  tmp_template_path = download_template(@source, tmp_path)
13
13
  template = IO.read(tmp_template_path)
14
14
  coder = Service::Coder.new(template, @options)
15
- puts coder.translate
15
+ coder.translate
16
16
  end
17
17
  end
18
18
  end
@@ -13,7 +13,7 @@ class Lono::Pro::Importer
13
13
 
14
14
  result = []
15
15
  required_parameters.each do |name, attributes|
16
- result << "#{name}="
16
+ result << "#{name}=#{attributes["Default"]}"
17
17
  end
18
18
  optional_parameters.each do |name, attributes|
19
19
  key = "#{name}=".ljust(20, ' ')
@@ -26,16 +26,18 @@ class Lono::Pro::Importer::Service::Coder
26
26
  print(data)
27
27
  data["ruby_code"]
28
28
  else
29
- puts "Unable to convert template to ruby code."
29
+ puts "Unable to convert template to Ruby code."
30
30
  puts "The error has been reported."
31
31
  puts "Non-successful http response status code: #{res.code}"
32
32
  # puts "headers: #{res.each_header.to_h.inspect}"
33
+ exit 1
33
34
  end
34
35
  end
35
36
 
36
37
  private
37
38
  def print(data)
38
39
  return unless @options[:print]
40
+
39
41
  validity = data["valid_ruby"] ? "valid" : "invalid"
40
42
  $stderr.puts <<~EOL
41
43
  INFO: The ruby syntax is #{validity}
@@ -44,6 +46,7 @@ private
44
46
  EOL
45
47
  ruby_code = data["ruby_code"]
46
48
  puts ruby_code
49
+ ruby_code
47
50
  end
48
51
 
49
52
  def net_http_client(url)
@@ -63,6 +66,6 @@ private
63
66
  end
64
67
 
65
68
  def lono_command
66
- "lono #{ARGV.join(' ')}"
69
+ "#{$0} #{ARGV.join(' ')}"
67
70
  end
68
71
  end
@@ -1,5 +1,5 @@
1
1
  module Lono
2
2
  module Pro
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
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.3.0
4
+ version: 0.4.0
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-08 00:00:00.000000000 Z
11
+ date: 2019-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk