aws-cfn-compiler 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws/cfn/compiler.rb +11 -4
- data/lib/aws/cfn/compiler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dc34770145a9ddf67f63101feabf87cdc1e89b6
|
4
|
+
data.tar.gz: bdeab59b0bda7341b1b8c4efc42462072c3394db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3810cd9f49bf57b042eb15e628d1517e70ae9587763e8a886de098b343f64706acad12b70b1a8809a1f712523b83b3caa9674059031fd097cd34e2c2109b71b9
|
7
|
+
data.tar.gz: d661351b044e2243112bf08bb25c16cf184912cb35be2817ca2934d183c28a0a0678c5c8a5a92072996200744adbb61f706c3c5adf8c97247b6298b8e4c60009
|
data/lib/aws/cfn/compiler.rb
CHANGED
@@ -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:
|
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
|
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
|