aws-cfn-yats 0.0.3 → 0.0.4
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 +5 -13
- data/aws-cfn-yats.gemspec +1 -1
- data/aws-cfn-yats.iml +2 -3
- data/bin/cfn-yaml2json +59 -0
- data/bin/cfn-yats +24 -0
- data/bin/yats +24 -0
- data/lib/aws/cfn/yats.rb +1 -0
- data/lib/aws/cfn/yats/json2yaml.rb +1 -1
- data/lib/aws/cfn/yats/version.rb +1 -1
- data/lib/aws/cfn/yats/yaml2json.rb +28 -0
- metadata +25 -32
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
OWYwYWIwYWVjNzI4YzVhNjYxMTk4ZTUxNzZjNTkzYzU1N2Y0YmY5ZA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fda00bef545348a75a1f0174c6326191849f52c0
|
4
|
+
data.tar.gz: b8a994c8177d43ccb3851431ef539fd00c50875f
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NTg3MGZhNWEyNTIyMzhlYWZiMzY2NGQ1YjdlYzIwOWJkNTlmZTk0MTM2MGM4
|
11
|
-
MjczYWNkMmQwNzUwMTI5ODZlOTIwOTc2NGI0N2UyNWI3MjQ2YzQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTc2MDFmNDY4N2Q0YzZhYmU4NWIwZDJiNDk3MTRlNWUwMTY3MzU2MjhhY2Y0
|
14
|
-
MzUxNWViNDk4ZDgyZjAwM2Y2OWEyNDU3M2JjYTBlZjViNjM5ZTE0ZGI0ODgx
|
15
|
-
MzZiM2Q0ZjY5ODRjZDhjYmIxMTc4ZmIyMzk4OTdhMTE0NGE0MjU=
|
6
|
+
metadata.gz: bfe62e3061e0501f7aea69dfdf07af1907d49385eabf9029c2b0b74b4509b959a96d469c89a1cb96c0d11bb73cfe2ae0adfea9868be610ff5a78b8cfab70ce3d
|
7
|
+
data.tar.gz: 3d7bf59a237f67fa825cfc513d84511bb14d55bf1a2bf46966c6cbae8e9df3d841ad9ee7f60f366f08aaa287aa9fd2b3281afd1cb94a0033b240d436247a717e
|
data/aws-cfn-yats.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'aws-cfn-dsl', '>=0.0.2'
|
21
|
+
# spec.add_dependency 'aws-cfn-dsl', '>=0.0.2'
|
22
22
|
spec.add_dependency 'aws-cfn-decompiler', '>= 0.0.3', '~> 0.0'
|
23
23
|
spec.add_dependency 'aws-cfn-compiler', '>= 0.2.1', '~> 0.2'
|
24
24
|
spec.add_dependency 'cloud_builder', '> 0'
|
data/aws-cfn-yats.iml
CHANGED
@@ -21,14 +21,13 @@
|
|
21
21
|
<orderEntry type="sourceFolder" forTests="false" />
|
22
22
|
<orderEntry type="library" scope="PROVIDED" name="activesupport (v4.1.1, RVM: ruby-2.1.2) [gem]" level="application" />
|
23
23
|
<orderEntry type="library" scope="PROVIDED" name="awesome_print (v1.2.0, RVM: ruby-2.1.2) [gem]" level="application" />
|
24
|
-
<orderEntry type="library" scope="PROVIDED" name="aws-cfn-
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="aws-cfn-compiler (v0.2.1, RVM: ruby-2.1.2) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="aws-cfn-decompiler (v0.0.3, RVM: ruby-2.1.2) [gem]" level="application" />
|
25
26
|
<orderEntry type="library" scope="PROVIDED" name="aws-sdk (v1.43.2, RVM: ruby-2.1.2) [gem]" level="application" />
|
26
27
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.6.2, RVM: ruby-2.1.2) [gem]" level="application" />
|
27
28
|
<orderEntry type="library" scope="PROVIDED" name="clamp (v0.6.3, RVM: ruby-2.1.2) [gem]" level="application" />
|
28
29
|
<orderEntry type="library" scope="PROVIDED" name="cloud_builder (v0.0.11, RVM: ruby-2.1.2) [gem]" level="application" />
|
29
|
-
<orderEntry type="library" scope="PROVIDED" name="cloudformation-ruby-dsl (v0.4.3, RVM: ruby-2.1.2) [gem]" level="application" />
|
30
30
|
<orderEntry type="library" scope="PROVIDED" name="cloudformer (v0.0.11, RVM: ruby-2.1.2) [gem]" level="application" />
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="detabulator (v0.1.0, RVM: ruby-2.1.2) [gem]" level="application" />
|
32
31
|
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.6.9, RVM: ruby-2.1.2) [gem]" level="application" />
|
33
32
|
<orderEntry type="library" scope="PROVIDED" name="mini_portile (v0.6.0, RVM: ruby-2.1.2) [gem]" level="application" />
|
34
33
|
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.3.4, RVM: ruby-2.1.2) [gem]" level="application" />
|
data/bin/cfn-yaml2json
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
# Borrowing from "whiches" gem ...
|
6
|
+
cmd = File.basename(__FILE__)
|
7
|
+
exes = []
|
8
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
9
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
10
|
+
exts.each { |ext|
|
11
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
12
|
+
exes << exe if File.executable? exe
|
13
|
+
}
|
14
|
+
end
|
15
|
+
path = if exes.size > 0
|
16
|
+
File.dirname(exes[0])
|
17
|
+
else
|
18
|
+
File.dirname(__FILE__)
|
19
|
+
end
|
20
|
+
|
21
|
+
add_path = File.expand_path(File.join(path, "..", "lib"))
|
22
|
+
$:.unshift(add_path)
|
23
|
+
|
24
|
+
require 'aws/cfn/yats'
|
25
|
+
require 'json'
|
26
|
+
|
27
|
+
unless (ARGV & %w(-h --help -?)).empty?
|
28
|
+
$stderr.puts <<"EOF"
|
29
|
+
usage: #{$PROGRAM_NAME} [cloudformation-template.json] ...
|
30
|
+
|
31
|
+
Converts the specified CloudFormation JSON template or template fragment to
|
32
|
+
Ruby DSL syntax. Reads from stdin or from the specified json files. Note
|
33
|
+
that the input must be valid JSON.
|
34
|
+
|
35
|
+
Examples:
|
36
|
+
|
37
|
+
# Convert a JSON CloudFormation template to Ruby DSL syntax
|
38
|
+
#{$PROGRAM_NAME} my-template.json > my-template.rb
|
39
|
+
chmod +x my-template.rb
|
40
|
+
|
41
|
+
# Convert the JSON fragment in the clipboard to Ruby DSL syntax
|
42
|
+
pbpaste | #{$PROGRAM_NAME} | less
|
43
|
+
|
44
|
+
EOF
|
45
|
+
exit(2)
|
46
|
+
end
|
47
|
+
|
48
|
+
y2j = Aws::Cfn::Yats::Yaml2Json.new
|
49
|
+
|
50
|
+
if ARGV.empty?
|
51
|
+
template = $stdin.read
|
52
|
+
y2j.transform(template)
|
53
|
+
else
|
54
|
+
ARGV.each do |filename|
|
55
|
+
template = File.read(filename)
|
56
|
+
y2j.transform(template)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
# The user should make the resulting template executable w/chmod +x
|
data/bin/cfn-yats
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
# Borrowing from "whiches" gem ...
|
6
|
+
cmd = File.basename(__FILE__)
|
7
|
+
exes = []
|
8
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
9
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
10
|
+
exts.each { |ext|
|
11
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
12
|
+
exes << exe if File.executable? exe
|
13
|
+
}
|
14
|
+
end
|
15
|
+
path = if exes.size > 0
|
16
|
+
File.dirname(exes[0])
|
17
|
+
else
|
18
|
+
File.dirname(__FILE__)
|
19
|
+
end
|
20
|
+
|
21
|
+
add_path = File.expand_path(File.join(path, "..", "lib"))
|
22
|
+
$:.unshift(add_path)
|
23
|
+
|
24
|
+
require 'aws/cfn/yats'
|
data/bin/yats
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
# Borrowing from "whiches" gem ...
|
6
|
+
cmd = File.basename(__FILE__)
|
7
|
+
exes = []
|
8
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
9
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
10
|
+
exts.each { |ext|
|
11
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
12
|
+
exes << exe if File.executable? exe
|
13
|
+
}
|
14
|
+
end
|
15
|
+
path = if exes.size > 0
|
16
|
+
File.dirname(exes[0])
|
17
|
+
else
|
18
|
+
File.dirname(__FILE__)
|
19
|
+
end
|
20
|
+
|
21
|
+
add_path = File.expand_path(File.join(path, "..", "lib"))
|
22
|
+
$:.unshift(add_path)
|
23
|
+
|
24
|
+
require 'aws/cfn/yats'
|
data/lib/aws/cfn/yats.rb
CHANGED
data/lib/aws/cfn/yats/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require "aws/cfn/yats/base"
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Aws
|
5
|
+
module Cfn
|
6
|
+
module Yats
|
7
|
+
|
8
|
+
class Yaml2Json < Base
|
9
|
+
attr_accessor :yaml
|
10
|
+
|
11
|
+
def transform(template)
|
12
|
+
@template = template
|
13
|
+
@yaml = YAML.load(template)
|
14
|
+
@simple = simplify(@yaml)
|
15
|
+
pprint(@simple)
|
16
|
+
end
|
17
|
+
|
18
|
+
def pprint_cfn_template(tpl)
|
19
|
+
|
20
|
+
@json = JSON.pretty_generate(tpl)
|
21
|
+
|
22
|
+
puts @json
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-cfn-yats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christo De Lange
|
@@ -10,100 +10,86 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: aws-cfn-dsl
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ! '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.2
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ! '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.2
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: aws-cfn-decompiler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- -
|
17
|
+
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
19
|
version: 0.0.3
|
34
|
-
- - ~>
|
20
|
+
- - "~>"
|
35
21
|
- !ruby/object:Gem::Version
|
36
22
|
version: '0.0'
|
37
23
|
type: :runtime
|
38
24
|
prerelease: false
|
39
25
|
version_requirements: !ruby/object:Gem::Requirement
|
40
26
|
requirements:
|
41
|
-
- -
|
27
|
+
- - ">="
|
42
28
|
- !ruby/object:Gem::Version
|
43
29
|
version: 0.0.3
|
44
|
-
- - ~>
|
30
|
+
- - "~>"
|
45
31
|
- !ruby/object:Gem::Version
|
46
32
|
version: '0.0'
|
47
33
|
- !ruby/object:Gem::Dependency
|
48
34
|
name: aws-cfn-compiler
|
49
35
|
requirement: !ruby/object:Gem::Requirement
|
50
36
|
requirements:
|
51
|
-
- -
|
37
|
+
- - ">="
|
52
38
|
- !ruby/object:Gem::Version
|
53
39
|
version: 0.2.1
|
54
|
-
- - ~>
|
40
|
+
- - "~>"
|
55
41
|
- !ruby/object:Gem::Version
|
56
42
|
version: '0.2'
|
57
43
|
type: :runtime
|
58
44
|
prerelease: false
|
59
45
|
version_requirements: !ruby/object:Gem::Requirement
|
60
46
|
requirements:
|
61
|
-
- -
|
47
|
+
- - ">="
|
62
48
|
- !ruby/object:Gem::Version
|
63
49
|
version: 0.2.1
|
64
|
-
- - ~>
|
50
|
+
- - "~>"
|
65
51
|
- !ruby/object:Gem::Version
|
66
52
|
version: '0.2'
|
67
53
|
- !ruby/object:Gem::Dependency
|
68
54
|
name: cloud_builder
|
69
55
|
requirement: !ruby/object:Gem::Requirement
|
70
56
|
requirements:
|
71
|
-
- -
|
57
|
+
- - ">"
|
72
58
|
- !ruby/object:Gem::Version
|
73
59
|
version: '0'
|
74
60
|
type: :runtime
|
75
61
|
prerelease: false
|
76
62
|
version_requirements: !ruby/object:Gem::Requirement
|
77
63
|
requirements:
|
78
|
-
- -
|
64
|
+
- - ">"
|
79
65
|
- !ruby/object:Gem::Version
|
80
66
|
version: '0'
|
81
67
|
- !ruby/object:Gem::Dependency
|
82
68
|
name: bundler
|
83
69
|
requirement: !ruby/object:Gem::Requirement
|
84
70
|
requirements:
|
85
|
-
- - ~>
|
71
|
+
- - "~>"
|
86
72
|
- !ruby/object:Gem::Version
|
87
73
|
version: '1.5'
|
88
74
|
type: :development
|
89
75
|
prerelease: false
|
90
76
|
version_requirements: !ruby/object:Gem::Requirement
|
91
77
|
requirements:
|
92
|
-
- - ~>
|
78
|
+
- - "~>"
|
93
79
|
- !ruby/object:Gem::Version
|
94
80
|
version: '1.5'
|
95
81
|
- !ruby/object:Gem::Dependency
|
96
82
|
name: rake
|
97
83
|
requirement: !ruby/object:Gem::Requirement
|
98
84
|
requirements:
|
99
|
-
- -
|
85
|
+
- - ">="
|
100
86
|
- !ruby/object:Gem::Version
|
101
87
|
version: '0'
|
102
88
|
type: :development
|
103
89
|
prerelease: false
|
104
90
|
version_requirements: !ruby/object:Gem::Requirement
|
105
91
|
requirements:
|
106
|
-
- -
|
92
|
+
- - ">="
|
107
93
|
- !ruby/object:Gem::Version
|
108
94
|
version: '0'
|
109
95
|
description: AWS Cloudformation templates expressed with a Ruby DSL, YAML or JSON
|
@@ -113,10 +99,13 @@ email:
|
|
113
99
|
executables:
|
114
100
|
- cfn-json2rb
|
115
101
|
- cfn-json2yaml
|
102
|
+
- cfn-yaml2json
|
103
|
+
- cfn-yats
|
104
|
+
- yats
|
116
105
|
extensions: []
|
117
106
|
extra_rdoc_files: []
|
118
107
|
files:
|
119
|
-
- .gitignore
|
108
|
+
- ".gitignore"
|
120
109
|
- Gemfile
|
121
110
|
- LICENSE
|
122
111
|
- LICENSE.txt
|
@@ -126,12 +115,16 @@ files:
|
|
126
115
|
- aws-cfn-yats.iml
|
127
116
|
- bin/cfn-json2rb
|
128
117
|
- bin/cfn-json2yaml
|
118
|
+
- bin/cfn-yaml2json
|
119
|
+
- bin/cfn-yats
|
120
|
+
- bin/yats
|
129
121
|
- lib/aws/cfn/yats.rb
|
130
122
|
- lib/aws/cfn/yats/base.rb
|
131
123
|
- lib/aws/cfn/yats/fncall.rb
|
132
124
|
- lib/aws/cfn/yats/json2rb.rb
|
133
125
|
- lib/aws/cfn/yats/json2yaml.rb
|
134
126
|
- lib/aws/cfn/yats/version.rb
|
127
|
+
- lib/aws/cfn/yats/yaml2json.rb
|
135
128
|
homepage: ''
|
136
129
|
licenses:
|
137
130
|
- MIT
|
@@ -142,12 +135,12 @@ require_paths:
|
|
142
135
|
- lib
|
143
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
137
|
requirements:
|
145
|
-
- -
|
138
|
+
- - ">="
|
146
139
|
- !ruby/object:Gem::Version
|
147
140
|
version: '0'
|
148
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
142
|
requirements:
|
150
|
-
- -
|
143
|
+
- - ">="
|
151
144
|
- !ruby/object:Gem::Version
|
152
145
|
version: '0'
|
153
146
|
requirements: []
|