aws-cfn-compiler 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 673fc4ca1fb32bdf4d0cd901c871f90ac7ad5190
4
- data.tar.gz: 279e4d973d987754067c8cd953bacb94a692d220
3
+ metadata.gz: 4dc34770145a9ddf67f63101feabf87cdc1e89b6
4
+ data.tar.gz: bdeab59b0bda7341b1b8c4efc42462072c3394db
5
5
  SHA512:
6
- metadata.gz: 7b2f4148f025221973449b2023b47288245ac36628cc67cc87a83f2fbd618f06668184813d868b515ce52c2094817ef8552f797f7b73bc3f357d9508839fa09a
7
- data.tar.gz: 824819dad7a1c603df967fd082eb1e8d58a6a1d8f4bbba95ff3c0d4b98bfaef87ddaccff7487aa3bfa7b4787cc992ae21a30d0de2411e81d4add7db6bcc74b08
6
+ metadata.gz: 3810cd9f49bf57b042eb15e628d1517e70ae9587763e8a886de098b343f64706acad12b70b1a8809a1f712523b83b3caa9674059031fd097cd34e2c2109b71b9
7
+ data.tar.gz: d661351b044e2243112bf08bb25c16cf184912cb35be2817ca2934d183c28a0a0678c5c8a5a92072996200744adbb61f706c3c5adf8c97247b6298b8e4c60009
@@ -17,12 +17,14 @@ module Aws
17
17
  @items = {}
18
18
  end
19
19
 
20
- def run ()
20
+ def run
21
21
 
22
22
  @opts = Slop.parse(help: true) do
23
23
  on :d, :directory=, 'The directory to look in', as: String
24
24
  on :o, :output=, 'The JSON file to output', as: String
25
25
  on :s, :specification=, 'The specification to use when selecting components. A JSON or YAML file or JSON object', as: String
26
+ on :f, :formatversion=, 'The AWS Template format version. Default 2010-09-09', as: String
27
+ on :t, :description=, "The AWS Template description. Default: output basename or #{File.basename(__FILE__,'.rb')}", as: String
26
28
  end
27
29
 
28
30
  unless @opts[:directory]
@@ -32,9 +34,13 @@ module Aws
32
34
 
33
35
  load @opts[:specification]
34
36
 
37
+ desc = @opts[:output] ? File.basename(@opts[:output]).gsub(%r/\.(json|yaml)/, '') : File.basename(__FILE__,'.rb')
38
+ if @spec and @spec['description']
39
+ desc = @spec['description']
40
+ end
35
41
  compiled = {
36
- AWSTemplateFormatVersion: '2010-09-09',
37
- Description: 'Description goes here',
42
+ AWSTemplateFormatVersion: (@opts[:formatversion].nil? ? '2010-09-09' : @opts[:formatversion]),
43
+ Description: (@opts[:description].nil? rescue desc ),
38
44
  Parameters: @items['params'],
39
45
  Mappings: @items['mappings'],
40
46
  Resources: @items['resources'],
@@ -94,7 +100,7 @@ module Aws
94
100
  # pass
95
101
  end
96
102
  if File.exists?(abs)
97
- raise "Unsupported specification file type" unless abs =~ /\.(json|ya?ml)\z/i
103
+ raise 'Unsupported specification file type' unless abs =~ /\.(json|ya?ml)\z/i
98
104
 
99
105
  puts "Loading specification #{abs}..."
100
106
  spec = File.read(abs)
@@ -107,6 +113,7 @@ module Aws
107
113
  else
108
114
  raise "Unsupported file type for specification: #{spec}"
109
115
  end
116
+ @spec = spec
110
117
  else
111
118
  raise "Unable to open specification: #{abs}"
112
119
  end
@@ -1,7 +1,7 @@
1
1
  module Aws
2
2
  module Cfn
3
3
  module Compiler
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-cfn-compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - PKinney