autostacker24 2.5.1 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/autostacker24 +20 -9
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c15b72565ca13411d45f0755a98315e3058d5b21
4
- data.tar.gz: 240058491f2f9e38e18ba03a9f3b6b37bce42567
3
+ metadata.gz: 5060871b0994fa6b788507e1613aa95fda045059
4
+ data.tar.gz: 0f46c2f43bf01522c8942abb718e431ef2a6d6ac
5
5
  SHA512:
6
- metadata.gz: 0e6bff296bea3cc5f682cfe1317d0eb15643f09cfd070a7f80929c054c1bac1fbca8cf1bc4b8d9ae48265e7654b8b414dc774ec330df1824778b91068ea3ce96
7
- data.tar.gz: f8aedf783770239be91f70138a3d5606192ff6b04a446f14942167c43d00068dbbc0648a6c3d1818bc76d47dba558fd3c6630640ea077d4f2300e2849cf3aca6
6
+ metadata.gz: 131bc460dc4aa5ee92bc2239235b11d1293ec05bcd37756da074045831ee6d04a8014347a8ffe1dd2b70e5657742d69ff86e8a0545318469e93fc54470d6daf4
7
+ data.tar.gz: 706faddbb9db962d1dfa9d6e522e3e7bc8fd0fa890cc2c5efbdc8b24d2c57c5401902c4652d270c9d806809d488b7ad166cdbccfe20f0dbc08237f0b5b9a2e46
data/bin/autostacker24 CHANGED
@@ -17,6 +17,16 @@ def check_stack(args)
17
17
  error('--stack name missing') unless args.stack
18
18
  end
19
19
 
20
+ def json?(data)
21
+ data =~ /\A((\s*\{)|(\s*\/{2}))/
22
+ end
23
+
24
+ def load_file(path)
25
+ error('params file not found') unless File.exists?(path)
26
+ data = File.read(path)
27
+ json?(data) ? JSON.parse(data) : YAML.load(data)
28
+ end
29
+
20
30
  args = OpenStruct.new
21
31
  args.region = ENV['AWS_REGION']
22
32
  args.params = {}
@@ -32,14 +42,15 @@ parser = OptionParser.new do |opts|
32
42
  opts.separator "\tconvert convert template to and from YAML"
33
43
  opts.separator ''
34
44
  opts.separator 'Options:'
35
- opts.on('--template TEMPLATE', 'Path to template') {|v| args.template = v}
36
- opts.on('--stack STACK', 'Name of stack') {|v| args.stack = v}
37
- opts.on('--parent PARENT', 'Name of parent stack') {|v| args.parent = v}
38
- opts.on('--region REGION', 'AWS region') {|v| args.region = v}
39
- opts.on('--profile PROFILE', 'AWS profile (use aws configure)') {|v| args.profile = v}
40
- opts.on('--param KEY=VALUE', 'Stack Parameter') {|v| args.params.store(*v.split('=')) }
41
- opts.on('--help', 'Show this help') {|_| puts opts; exit!;}
42
- opts.on('--version', 'Show version') {|_| puts `gem list autostacker24`; exit!;}
45
+ opts.on('--template TEMPLATE', 'Path to template') {|v| args.template = v}
46
+ opts.on('--stack STACK', 'Name of stack') {|v| args.stack = v}
47
+ opts.on('--parent PARENT', 'Name of parent stack') {|v| args.parent = v}
48
+ opts.on('--region REGION', 'AWS region') {|v| args.region = v}
49
+ opts.on('--profile PROFILE', 'AWS profile (use aws configure)') {|v| args.profile = v}
50
+ opts.on('--param KEY=VALUE', 'Stack Parameter') {|v| args.params.store(*v.split('=')) }
51
+ opts.on('--params FILE', 'Stack Parameter from yaml/json file') {|v| args.params.merge!(load_file(v)) }
52
+ opts.on('--help', 'Show this help') {|_| puts opts; exit!;}
53
+ opts.on('--version', 'Show version') {|_| puts `gem list autostacker24`; exit!;}
43
54
  opts.separator ''
44
55
  end
45
56
  USAGE = parser.to_s
@@ -77,7 +88,7 @@ case args.command
77
88
  when /convert/
78
89
  check_template(args)
79
90
  template = File.read(args.template)
80
- if template =~ /\A((\s*\{)|(\s*\/{2}))/
91
+ if json?(template)
81
92
  puts JSON.parse(template).to_yaml.sub('---', '# AutoStacker24 CloudFormation YAML Template')
82
93
  else
83
94
  puts '// AutoStacker24 CloudFormation JSON Template '
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autostacker24
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Mueller
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-11-14 00:00:00.000000000 Z
12
+ date: 2017-02-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-core
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.5.1
138
+ rubygems_version: 2.6.8
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Library for managing AWS CloudFormation stacks