stax 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stax.rb +1 -0
- data/lib/stax/stack.rb +4 -0
- data/lib/stax/stack/crud.rb +0 -20
- data/lib/stax/stack/template.rb +68 -0
- data/lib/stax/staxfile.rb +1 -0
- data/lib/stax/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77112f21d23c34b627328dbe16dee4c49c380f60094a27584cbd1a58467847ed
|
4
|
+
data.tar.gz: c04005d73b1e5d2d2dd49369b66941419722f01b16a59f9f96993ae87fe95469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdb6d027064fb78ce133795d3244eed99bb76ca4b4ab1abd6fa85ab748a07d3aaa3b76d4e3bafc3c487813eb90bce623977787138e7252b543da0b9fde17ac37
|
7
|
+
data.tar.gz: 0364f0379cd4dadf176b36172cae8624ee9afb315244758fe587b14df39a705fc887f8a99653378717de34a3f4e9f24048ed9109f0bb35be6c47ab6a4b62827e
|
data/lib/stax.rb
CHANGED
data/lib/stax/stack.rb
CHANGED
data/lib/stax/stack/crud.rb
CHANGED
@@ -73,26 +73,6 @@ module Stax
|
|
73
73
|
}
|
74
74
|
end
|
75
75
|
|
76
|
-
## location of templates relative to Staxfile
|
77
|
-
def cfn_template_dir
|
78
|
-
'cf'
|
79
|
-
end
|
80
|
-
|
81
|
-
## get cfn template from file depending on the format
|
82
|
-
def cfn_template
|
83
|
-
@_cfn_template ||= \
|
84
|
-
begin
|
85
|
-
stub = File.join(cfn_template_dir, "#{class_name}")
|
86
|
-
if File.exists?(f = "#{stub}.rb")
|
87
|
-
cfer_generate(f)
|
88
|
-
elsif File.exists?(f = "#{stub}.yaml")
|
89
|
-
File.read(f)
|
90
|
-
elsif File.exists?(f = "#{stub}.json")
|
91
|
-
File.read(f)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
76
|
## set this to always do an S3 upload of template
|
97
77
|
def cfn_force_s3?
|
98
78
|
false
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Stax
|
2
|
+
class Stack < Base
|
3
|
+
|
4
|
+
no_commands do
|
5
|
+
## location of templates relative to Staxfile
|
6
|
+
def cfn_template_dir
|
7
|
+
'cf'
|
8
|
+
end
|
9
|
+
|
10
|
+
## template filename without extension
|
11
|
+
def cfn_template_stub
|
12
|
+
@_cfn_template_stub ||= File.join(cfn_template_dir, "#{class_name}")
|
13
|
+
end
|
14
|
+
|
15
|
+
## load a yaml template
|
16
|
+
def cfn_template_yaml
|
17
|
+
if File.exists?(f = "#{cfn_template_stub}.yaml")
|
18
|
+
File.read(f)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
## load a json template
|
23
|
+
def cfn_template_json
|
24
|
+
if File.exists?(f = "#{cfn_template_stub}.json")
|
25
|
+
File.read(f)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
## load a ruby cfer template
|
30
|
+
def cfn_template_cfer
|
31
|
+
if File.exists?(f = "#{cfn_template_stub}.rb")
|
32
|
+
cfer_generate(f)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
## by default look for cdk templates in same dir as Staxfile
|
37
|
+
def cfn_cdk_dir
|
38
|
+
Stax.root_path
|
39
|
+
end
|
40
|
+
|
41
|
+
## transcompile and load a cdk template
|
42
|
+
def cfn_template_cdk
|
43
|
+
Dir.chdir(cfn_cdk_dir) do
|
44
|
+
%x[npm run build]
|
45
|
+
%x[cdk synth]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
## try to guess template by filename
|
50
|
+
def cfn_template_guess
|
51
|
+
cfn_template_cfer || cfn_template_yaml || cfn_template_json
|
52
|
+
end
|
53
|
+
|
54
|
+
## get cfn template based on stack type
|
55
|
+
def cfn_template
|
56
|
+
@_cfn_template ||= \
|
57
|
+
begin
|
58
|
+
if stack_type
|
59
|
+
send("cfn_template_#{stack_type}")
|
60
|
+
else
|
61
|
+
cfn_template_guess || fail_task('cannot find template')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/stax/staxfile.rb
CHANGED
data/lib/stax/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -246,6 +246,7 @@ files:
|
|
246
246
|
- lib/stax/stack/outputs.rb
|
247
247
|
- lib/stax/stack/parameters.rb
|
248
248
|
- lib/stax/stack/resources.rb
|
249
|
+
- lib/stax/stack/template.rb
|
249
250
|
- lib/stax/staxfile.rb
|
250
251
|
- lib/stax/subcommand.rb
|
251
252
|
- lib/stax/version.rb
|