pangea 0.0.30 → 0.0.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Gemfile +0 -2
- data/Gemfile.lock +22 -55
- data/bin/stitches +0 -0
- data/gemset.nix +17 -132
- data/lib/pangea/cli/subcommands/config.rb +26 -12
- data/lib/pangea/cli/subcommands/infra.rb +75 -48
- data/lib/pangea/modules.rb +67 -0
- data/lib/pangea/sandbox.rb +90 -0
- data/lib/pangea/version.rb +1 -1
- data/lib/pangea.rb +11 -0
- data/pangea.gemspec +4 -1
- data/pangea.rb +11 -9
- metadata +6 -7
- data/spec/cli/config_spec.rb +0 -16
- data/spec/synthesizer/config_spec.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46052df7d5af548947dc13c3ae5e5070fbf0e21eaa967616891ebc5714b36efc
|
4
|
+
data.tar.gz: aba95de983196fb4b726b9f70c18a939b3368c5df39301e3b6f5958f6844aa65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6060dcac778672b6f28f7d62a82257353261638363322049a5a9228d2102bc979d92df0b79fea821018b76aae300c42f355b945a1764bdf2b8956d818c00a06c
|
7
|
+
data.tar.gz: 521c84514bac1460138845852016f94159fb8bccf5561228f119406c7d20ff1560a9bba1a41aeb74412b2c7c1bcb68f2dbc7a4757f3f201c04ca9e4c60052c2d
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,50 +1,37 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
abstract-synthesizer (0.0.
|
4
|
+
abstract-synthesizer (0.0.2)
|
5
5
|
ast (2.4.2)
|
6
6
|
aws-eventstream (1.2.0)
|
7
|
-
aws-partitions (1.
|
8
|
-
aws-sdk-core (3.
|
7
|
+
aws-partitions (1.854.0)
|
8
|
+
aws-sdk-core (3.187.1)
|
9
9
|
aws-eventstream (~> 1, >= 1.0.2)
|
10
10
|
aws-partitions (~> 1, >= 1.651.0)
|
11
11
|
aws-sigv4 (~> 1.5)
|
12
12
|
jmespath (~> 1, >= 1.6.1)
|
13
|
-
aws-sdk-dynamodb (1.
|
14
|
-
aws-sdk-core (~> 3, >= 3.
|
13
|
+
aws-sdk-dynamodb (1.96.0)
|
14
|
+
aws-sdk-core (~> 3, >= 3.184.0)
|
15
15
|
aws-sigv4 (~> 1.1)
|
16
|
-
aws-sigv4 (1.6.
|
16
|
+
aws-sigv4 (1.6.1)
|
17
17
|
aws-eventstream (~> 1, >= 1.0.2)
|
18
|
-
backport (1.2.0)
|
19
|
-
benchmark (0.2.1)
|
20
18
|
citrus (3.0.2)
|
21
19
|
diff-lcs (1.5.0)
|
22
|
-
e2mmap (0.1.0)
|
23
|
-
jaro_winkler (1.5.6)
|
24
20
|
jmespath (1.6.2)
|
25
21
|
json (2.6.3)
|
26
22
|
keycutter (1.0.2)
|
27
|
-
kramdown (2.4.0)
|
28
|
-
rexml
|
29
|
-
kramdown-parser-gfm (1.1.0)
|
30
|
-
kramdown (~> 2.0)
|
31
23
|
language_server-protocol (3.17.0.3)
|
32
|
-
nokogiri (1.15.3)
|
33
|
-
racc (~> 1.4)
|
34
24
|
parallel (1.23.0)
|
35
|
-
parser (3.2.2.
|
25
|
+
parser (3.2.2.4)
|
36
26
|
ast (~> 2.4.1)
|
37
27
|
racc
|
38
28
|
pastel (0.8.0)
|
39
29
|
tty-color (~> 0.5)
|
40
|
-
racc (1.7.
|
30
|
+
racc (1.7.3)
|
41
31
|
rainbow (3.1.1)
|
42
|
-
rake (13.0
|
43
|
-
|
44
|
-
|
45
|
-
reverse_markdown (2.1.1)
|
46
|
-
nokogiri
|
47
|
-
rexml (3.2.5)
|
32
|
+
rake (13.1.0)
|
33
|
+
regexp_parser (2.8.2)
|
34
|
+
rexml (3.2.6)
|
48
35
|
rspec (3.12.0)
|
49
36
|
rspec-core (~> 3.12.0)
|
50
37
|
rspec-expectations (~> 3.12.0)
|
@@ -58,54 +45,36 @@ GEM
|
|
58
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
59
46
|
rspec-support (~> 3.12.0)
|
60
47
|
rspec-support (3.12.1)
|
61
|
-
rubocop (1.
|
48
|
+
rubocop (1.57.2)
|
62
49
|
json (~> 2.3)
|
63
50
|
language_server-protocol (>= 3.17.0)
|
64
51
|
parallel (~> 1.10)
|
65
|
-
parser (>= 3.2.2.
|
52
|
+
parser (>= 3.2.2.4)
|
66
53
|
rainbow (>= 2.2.2, < 4.0)
|
67
54
|
regexp_parser (>= 1.8, < 3.0)
|
68
55
|
rexml (>= 3.2.5, < 4.0)
|
69
|
-
rubocop-ast (>= 1.28.
|
56
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
70
57
|
ruby-progressbar (~> 1.7)
|
71
58
|
unicode-display_width (>= 2.4.0, < 3.0)
|
72
|
-
rubocop-ast (1.
|
59
|
+
rubocop-ast (1.30.0)
|
73
60
|
parser (>= 3.2.1.0)
|
74
|
-
rubocop-capybara (2.
|
61
|
+
rubocop-capybara (2.19.0)
|
75
62
|
rubocop (~> 1.41)
|
76
|
-
rubocop-factory_bot (2.
|
63
|
+
rubocop-factory_bot (2.24.0)
|
77
64
|
rubocop (~> 1.33)
|
78
65
|
rubocop-rake (0.6.0)
|
79
66
|
rubocop (~> 1.0)
|
80
|
-
rubocop-rspec (2.
|
81
|
-
rubocop (~> 1.
|
67
|
+
rubocop-rspec (2.25.0)
|
68
|
+
rubocop (~> 1.40)
|
82
69
|
rubocop-capybara (~> 2.17)
|
83
70
|
rubocop-factory_bot (~> 2.22)
|
84
71
|
ruby-progressbar (1.13.0)
|
85
|
-
solargraph (0.49.0)
|
86
|
-
backport (~> 1.2)
|
87
|
-
benchmark
|
88
|
-
bundler (~> 2.0)
|
89
|
-
diff-lcs (~> 1.4)
|
90
|
-
e2mmap
|
91
|
-
jaro_winkler (~> 1.5)
|
92
|
-
kramdown (~> 2.3)
|
93
|
-
kramdown-parser-gfm (~> 1.1)
|
94
|
-
parser (~> 3.0)
|
95
|
-
rbs (~> 2.0)
|
96
|
-
reverse_markdown (~> 2.0)
|
97
|
-
rubocop (~> 1.38)
|
98
|
-
thor (~> 1.0)
|
99
|
-
tilt (~> 2.0)
|
100
|
-
yard (~> 0.9, >= 0.9.24)
|
101
72
|
strings (0.2.1)
|
102
73
|
strings-ansi (~> 0.2)
|
103
74
|
unicode-display_width (>= 1.5, < 3.0)
|
104
75
|
unicode_utils (~> 1.4)
|
105
76
|
strings-ansi (0.2.0)
|
106
|
-
terraform-synthesizer (0.0.
|
107
|
-
thor (1.2.2)
|
108
|
-
tilt (2.2.0)
|
77
|
+
terraform-synthesizer (0.0.2)
|
109
78
|
toml-rb (2.2.0)
|
110
79
|
citrus (~> 3.0, > 3.0)
|
111
80
|
tty-box (0.7.0)
|
@@ -125,12 +94,12 @@ GEM
|
|
125
94
|
pastel (~> 0.8)
|
126
95
|
strings (~> 0.2.0)
|
127
96
|
tty-screen (~> 0.8)
|
128
|
-
unicode-display_width (2.
|
97
|
+
unicode-display_width (2.5.0)
|
129
98
|
unicode_utils (1.4.0)
|
130
99
|
yard (0.9.34)
|
131
100
|
|
132
101
|
PLATFORMS
|
133
|
-
|
102
|
+
x86_64-linux
|
134
103
|
|
135
104
|
DEPENDENCIES
|
136
105
|
abstract-synthesizer
|
@@ -138,10 +107,8 @@ DEPENDENCIES
|
|
138
107
|
keycutter
|
139
108
|
rake
|
140
109
|
rspec
|
141
|
-
rubocop
|
142
110
|
rubocop-rake
|
143
111
|
rubocop-rspec
|
144
|
-
solargraph
|
145
112
|
terraform-synthesizer
|
146
113
|
toml-rb
|
147
114
|
tty-box
|
data/bin/stitches
CHANGED
File without changes
|
data/gemset.nix
CHANGED
@@ -34,10 +34,10 @@
|
|
34
34
|
platforms = [];
|
35
35
|
source = {
|
36
36
|
remotes = ["https://rubygems.org"];
|
37
|
-
sha256 = "
|
37
|
+
sha256 = "1z6667xiw59fwbz6hqmw8nbw07hllcl9xbqr928d9g8cpwbz1ys6";
|
38
38
|
type = "gem";
|
39
39
|
};
|
40
|
-
version = "1.
|
40
|
+
version = "1.802.0";
|
41
41
|
};
|
42
42
|
aws-sdk-core = {
|
43
43
|
dependencies = ["aws-eventstream" "aws-partitions" "aws-sigv4" "jmespath"];
|
@@ -45,10 +45,10 @@
|
|
45
45
|
platforms = [];
|
46
46
|
source = {
|
47
47
|
remotes = ["https://rubygems.org"];
|
48
|
-
sha256 = "
|
48
|
+
sha256 = "0lc3j74v49b2akyimfnsx3vsgi1i3068cpchn358l0dv27aib6c2";
|
49
49
|
type = "gem";
|
50
50
|
};
|
51
|
-
version = "3.
|
51
|
+
version = "3.180.3";
|
52
52
|
};
|
53
53
|
aws-sdk-dynamodb = {
|
54
54
|
dependencies = ["aws-sdk-core" "aws-sigv4"];
|
@@ -56,10 +56,10 @@
|
|
56
56
|
platforms = [];
|
57
57
|
source = {
|
58
58
|
remotes = ["https://rubygems.org"];
|
59
|
-
sha256 = "
|
59
|
+
sha256 = "18siyaajyd59sbfvxj16rlgfdlbdshmkqcvdsmbmd7pl88wxr0c4";
|
60
60
|
type = "gem";
|
61
61
|
};
|
62
|
-
version = "1.
|
62
|
+
version = "1.93.1";
|
63
63
|
};
|
64
64
|
aws-sigv4 = {
|
65
65
|
dependencies = ["aws-eventstream"];
|
@@ -72,25 +72,15 @@
|
|
72
72
|
};
|
73
73
|
version = "1.6.0";
|
74
74
|
};
|
75
|
-
|
75
|
+
base64 = {
|
76
76
|
groups = ["default" "development"];
|
77
77
|
platforms = [];
|
78
78
|
source = {
|
79
79
|
remotes = ["https://rubygems.org"];
|
80
|
-
sha256 = "
|
80
|
+
sha256 = "0cydk9p2cv25qysm0sn2pb97fcpz1isa7n3c8xm1gd99li8x6x8c";
|
81
81
|
type = "gem";
|
82
82
|
};
|
83
|
-
version = "1.
|
84
|
-
};
|
85
|
-
benchmark = {
|
86
|
-
groups = ["default" "development"];
|
87
|
-
platforms = [];
|
88
|
-
source = {
|
89
|
-
remotes = ["https://rubygems.org"];
|
90
|
-
sha256 = "017jh2lx3z5hqjvnqclc5bfr5q0d3zk0nqjfz73909ybr4h20kmi";
|
91
|
-
type = "gem";
|
92
|
-
};
|
93
|
-
version = "0.2.1";
|
83
|
+
version = "0.1.1";
|
94
84
|
};
|
95
85
|
citrus = {
|
96
86
|
groups = ["default" "production"];
|
@@ -112,26 +102,6 @@
|
|
112
102
|
};
|
113
103
|
version = "1.5.0";
|
114
104
|
};
|
115
|
-
e2mmap = {
|
116
|
-
groups = ["default" "development"];
|
117
|
-
platforms = [];
|
118
|
-
source = {
|
119
|
-
remotes = ["https://rubygems.org"];
|
120
|
-
sha256 = "0n8gxjb63dck3vrmsdcqqll7xs7f3wk78mw8w0gdk9wp5nx6pvj5";
|
121
|
-
type = "gem";
|
122
|
-
};
|
123
|
-
version = "0.1.0";
|
124
|
-
};
|
125
|
-
jaro_winkler = {
|
126
|
-
groups = ["default" "development"];
|
127
|
-
platforms = [];
|
128
|
-
source = {
|
129
|
-
remotes = ["https://rubygems.org"];
|
130
|
-
sha256 = "10fd3i92897blalxfkgc0jjv0qqx31v7cm7j2b6a3b97an0bfz80";
|
131
|
-
type = "gem";
|
132
|
-
};
|
133
|
-
version = "1.5.6";
|
134
|
-
};
|
135
105
|
jmespath = {
|
136
106
|
groups = ["default" "production"];
|
137
107
|
platforms = [];
|
@@ -162,28 +132,6 @@
|
|
162
132
|
};
|
163
133
|
version = "1.0.2";
|
164
134
|
};
|
165
|
-
kramdown = {
|
166
|
-
dependencies = ["rexml"];
|
167
|
-
groups = ["default" "development"];
|
168
|
-
platforms = [];
|
169
|
-
source = {
|
170
|
-
remotes = ["https://rubygems.org"];
|
171
|
-
sha256 = "1ic14hdcqxn821dvzki99zhmcy130yhv5fqfffkcf87asv5mnbmn";
|
172
|
-
type = "gem";
|
173
|
-
};
|
174
|
-
version = "2.4.0";
|
175
|
-
};
|
176
|
-
kramdown-parser-gfm = {
|
177
|
-
dependencies = ["kramdown"];
|
178
|
-
groups = ["default" "development"];
|
179
|
-
platforms = [];
|
180
|
-
source = {
|
181
|
-
remotes = ["https://rubygems.org"];
|
182
|
-
sha256 = "0a8pb3v951f4x7h968rqfsa19c8arz21zw1vaj42jza22rap8fgv";
|
183
|
-
type = "gem";
|
184
|
-
};
|
185
|
-
version = "1.1.0";
|
186
|
-
};
|
187
135
|
language_server-protocol = {
|
188
136
|
groups = ["default" "development"];
|
189
137
|
platforms = [];
|
@@ -194,17 +142,6 @@
|
|
194
142
|
};
|
195
143
|
version = "3.17.0.3";
|
196
144
|
};
|
197
|
-
nokogiri = {
|
198
|
-
dependencies = ["racc"];
|
199
|
-
groups = ["default" "development"];
|
200
|
-
platforms = [];
|
201
|
-
source = {
|
202
|
-
remotes = ["https://rubygems.org"];
|
203
|
-
sha256 = "1jw8a20a9k05fpz3q24im19b97idss3179z76yn5scc5b8lk2rl7";
|
204
|
-
type = "gem";
|
205
|
-
};
|
206
|
-
version = "1.15.3";
|
207
|
-
};
|
208
145
|
parallel = {
|
209
146
|
groups = ["default" "development"];
|
210
147
|
platforms = [];
|
@@ -267,16 +204,6 @@
|
|
267
204
|
};
|
268
205
|
version = "13.0.6";
|
269
206
|
};
|
270
|
-
rbs = {
|
271
|
-
groups = ["default" "development"];
|
272
|
-
platforms = [];
|
273
|
-
source = {
|
274
|
-
remotes = ["https://rubygems.org"];
|
275
|
-
sha256 = "0dgj5n7rj83981fvrhswfwsh88x42p7r00nvd80hkxmdcjvda2h6";
|
276
|
-
type = "gem";
|
277
|
-
};
|
278
|
-
version = "2.8.4";
|
279
|
-
};
|
280
207
|
regexp_parser = {
|
281
208
|
groups = ["default" "development"];
|
282
209
|
platforms = [];
|
@@ -287,26 +214,15 @@
|
|
287
214
|
};
|
288
215
|
version = "2.8.1";
|
289
216
|
};
|
290
|
-
reverse_markdown = {
|
291
|
-
dependencies = ["nokogiri"];
|
292
|
-
groups = ["default" "development"];
|
293
|
-
platforms = [];
|
294
|
-
source = {
|
295
|
-
remotes = ["https://rubygems.org"];
|
296
|
-
sha256 = "0087vhw5ik50lxvddicns01clkx800fk5v5qnrvi3b42nrk6885j";
|
297
|
-
type = "gem";
|
298
|
-
};
|
299
|
-
version = "2.1.1";
|
300
|
-
};
|
301
217
|
rexml = {
|
302
218
|
groups = ["default" "development"];
|
303
219
|
platforms = [];
|
304
220
|
source = {
|
305
221
|
remotes = ["https://rubygems.org"];
|
306
|
-
sha256 = "
|
222
|
+
sha256 = "05i8518ay14kjbma550mv0jm8a6di8yp5phzrd8rj44z9qnrlrp0";
|
307
223
|
type = "gem";
|
308
224
|
};
|
309
|
-
version = "3.2.
|
225
|
+
version = "3.2.6";
|
310
226
|
};
|
311
227
|
rspec = {
|
312
228
|
dependencies = ["rspec-core" "rspec-expectations" "rspec-mocks"];
|
@@ -363,15 +279,15 @@
|
|
363
279
|
version = "3.12.1";
|
364
280
|
};
|
365
281
|
rubocop = {
|
366
|
-
dependencies = ["json" "language_server-protocol" "parallel" "parser" "rainbow" "regexp_parser" "rexml" "rubocop-ast" "ruby-progressbar" "unicode-display_width"];
|
367
|
-
groups = ["development"];
|
282
|
+
dependencies = ["base64" "json" "language_server-protocol" "parallel" "parser" "rainbow" "regexp_parser" "rexml" "rubocop-ast" "ruby-progressbar" "unicode-display_width"];
|
283
|
+
groups = ["default" "development"];
|
368
284
|
platforms = [];
|
369
285
|
source = {
|
370
286
|
remotes = ["https://rubygems.org"];
|
371
|
-
sha256 = "
|
287
|
+
sha256 = "1ig23w64f9y1gi6l4pv69m0nfhn3nnr3q4s81br9vl1b1z02n5cn";
|
372
288
|
type = "gem";
|
373
289
|
};
|
374
|
-
version = "1.
|
290
|
+
version = "1.56.0";
|
375
291
|
};
|
376
292
|
rubocop-ast = {
|
377
293
|
dependencies = ["parser"];
|
@@ -423,10 +339,10 @@
|
|
423
339
|
platforms = [];
|
424
340
|
source = {
|
425
341
|
remotes = ["https://rubygems.org"];
|
426
|
-
sha256 = "
|
342
|
+
sha256 = "0ylwy4afnxhbrvlaf8an9nrizj78axnzggiyfcp8v531cv8six5f";
|
427
343
|
type = "gem";
|
428
344
|
};
|
429
|
-
version = "2.
|
345
|
+
version = "2.23.2";
|
430
346
|
};
|
431
347
|
ruby-progressbar = {
|
432
348
|
groups = ["default" "development"];
|
@@ -438,17 +354,6 @@
|
|
438
354
|
};
|
439
355
|
version = "1.13.0";
|
440
356
|
};
|
441
|
-
solargraph = {
|
442
|
-
dependencies = ["backport" "benchmark" "diff-lcs" "e2mmap" "jaro_winkler" "kramdown" "kramdown-parser-gfm" "parser" "rbs" "reverse_markdown" "rubocop" "thor" "tilt" "yard"];
|
443
|
-
groups = ["development"];
|
444
|
-
platforms = [];
|
445
|
-
source = {
|
446
|
-
remotes = ["https://rubygems.org"];
|
447
|
-
sha256 = "18wpma2mgw82qzf1jwjalmz7nwdvn87b22wd5yy16jb67fqgrq78";
|
448
|
-
type = "gem";
|
449
|
-
};
|
450
|
-
version = "0.49.0";
|
451
|
-
};
|
452
357
|
strings = {
|
453
358
|
dependencies = ["strings-ansi" "unicode-display_width" "unicode_utils"];
|
454
359
|
groups = ["default" "production"];
|
@@ -480,26 +385,6 @@
|
|
480
385
|
};
|
481
386
|
version = "0.0.1";
|
482
387
|
};
|
483
|
-
thor = {
|
484
|
-
groups = ["default" "development"];
|
485
|
-
platforms = [];
|
486
|
-
source = {
|
487
|
-
remotes = ["https://rubygems.org"];
|
488
|
-
sha256 = "0k7j2wn14h1pl4smibasw0bp66kg626drxb59z7rzflch99cd4rg";
|
489
|
-
type = "gem";
|
490
|
-
};
|
491
|
-
version = "1.2.2";
|
492
|
-
};
|
493
|
-
tilt = {
|
494
|
-
groups = ["default" "development"];
|
495
|
-
platforms = [];
|
496
|
-
source = {
|
497
|
-
remotes = ["https://rubygems.org"];
|
498
|
-
sha256 = "0bmjgbv8158klwp2r3klxjwaj93nh1sbl4xvj9wsha0ic478avz7";
|
499
|
-
type = "gem";
|
500
|
-
};
|
501
|
-
version = "2.2.0";
|
502
|
-
};
|
503
388
|
toml-rb = {
|
504
389
|
dependencies = ["citrus"];
|
505
390
|
groups = ["production"];
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require %(pangea/cli/subcommands/pangea)
|
2
2
|
require %(pangea/synthesizer/config)
|
3
|
+
require %(terraform-synthesizer)
|
3
4
|
require %(pangea/cli/config)
|
4
|
-
require %(json)
|
5
5
|
require %(aws-sdk-dynamodb)
|
6
6
|
require %(aws-sdk-s3)
|
7
|
-
require %(
|
7
|
+
require %(json)
|
8
8
|
|
9
9
|
class ConfigCommand < PangeaCommand
|
10
10
|
usage do
|
11
|
-
desc
|
11
|
+
desc %(manage configuration)
|
12
12
|
program %(pangea)
|
13
13
|
command %(config)
|
14
14
|
end
|
@@ -30,6 +30,10 @@ class ConfigCommand < PangeaCommand
|
|
30
30
|
HELP
|
31
31
|
end
|
32
32
|
|
33
|
+
#############################################################################
|
34
|
+
# helpers
|
35
|
+
#############################################################################
|
36
|
+
|
33
37
|
# check if dynamodb table exists
|
34
38
|
def table_exists?(table_name)
|
35
39
|
dynamodb.describe_table({ table_name: table_name })
|
@@ -72,6 +76,12 @@ class ConfigCommand < PangeaCommand
|
|
72
76
|
}
|
73
77
|
end
|
74
78
|
|
79
|
+
# end helpers
|
80
|
+
|
81
|
+
#####################################################################
|
82
|
+
# catch pangea config <subcommand>
|
83
|
+
#####################################################################
|
84
|
+
|
75
85
|
def run(argv)
|
76
86
|
case argv[1].to_s
|
77
87
|
when %(show)
|
@@ -95,21 +105,17 @@ class ConfigCommand < PangeaCommand
|
|
95
105
|
module_dirs = %w[lib src test]
|
96
106
|
modules = ctx[:modules]
|
97
107
|
|
98
|
-
puts "modules:"
|
99
|
-
puts JSON.pretty_generate(modules)
|
100
|
-
|
101
108
|
modules.each_key do |mod_name|
|
102
109
|
this_mod = modules[mod_name]
|
103
110
|
|
104
111
|
if this_mod[:sandboxed]
|
105
112
|
# TODO: setup sandboxed module
|
113
|
+
# sandbox should be a complete ruby executable space
|
106
114
|
nil
|
107
115
|
elsif this_mod[:path]
|
108
116
|
|
109
117
|
lib_dir = File.join(this_mod[:path], %(lib))
|
110
118
|
lib_files = Dir.glob(File.join(this_mod[:path], %(lib), %(**/*.rb)))
|
111
|
-
puts lib_dir
|
112
|
-
puts lib_files
|
113
119
|
|
114
120
|
system(%(mkdir -p #{lib_dir})) unless Dir.exist?(lib_dir)
|
115
121
|
|
@@ -130,8 +136,6 @@ class ConfigCommand < PangeaCommand
|
|
130
136
|
|
131
137
|
src_dir = File.join(this_mod[:path], %(src))
|
132
138
|
src_files = Dir.glob(File.join(src_dir, %(**/*.rb)))
|
133
|
-
puts src_dir
|
134
|
-
puts src_files
|
135
139
|
|
136
140
|
system(%(mkdir -p #{src_dir})) unless Dir.exist?(src_dir)
|
137
141
|
|
@@ -149,6 +153,11 @@ class ConfigCommand < PangeaCommand
|
|
149
153
|
|
150
154
|
config[:namespace].each_key do |ns_name|
|
151
155
|
ns = config[:namespace][ns_name]
|
156
|
+
|
157
|
+
#####################################################################
|
158
|
+
# process namespaces in configuraton
|
159
|
+
#####################################################################
|
160
|
+
|
152
161
|
ns.each_key do |ctx_name|
|
153
162
|
ctx = ns[ctx_name]
|
154
163
|
next unless ctx[:state_config][:terraform][:s3]
|
@@ -166,7 +175,7 @@ class ConfigCommand < PangeaCommand
|
|
166
175
|
)
|
167
176
|
puts "Created table. Status: #{result.table_description.table_status}"
|
168
177
|
rescue Aws::DynamoDB::Errors::ServiceError => e
|
169
|
-
puts e.message
|
178
|
+
puts e.message
|
170
179
|
end
|
171
180
|
end
|
172
181
|
|
@@ -175,10 +184,11 @@ class ConfigCommand < PangeaCommand
|
|
175
184
|
###################################################################
|
176
185
|
# s3 bucket setup
|
177
186
|
###################################################################
|
187
|
+
|
178
188
|
bucket_name =
|
179
189
|
ctx[:state_config][:terraform][:s3][:bucket]
|
180
190
|
if bucket_exist?(bucket_name)
|
181
|
-
|
191
|
+
nil
|
182
192
|
else
|
183
193
|
s3.create_bucket(bucket: bucket_name)
|
184
194
|
end
|
@@ -198,7 +208,11 @@ class ConfigCommand < PangeaCommand
|
|
198
208
|
|
199
209
|
# end setup directories
|
200
210
|
end
|
211
|
+
|
212
|
+
# end process namespaces in configuraton
|
201
213
|
end
|
202
214
|
end
|
203
215
|
end
|
216
|
+
|
217
|
+
# end catch pangea config <subcommand>
|
204
218
|
end
|
@@ -7,6 +7,7 @@ require %(pangea/errors/project_not_found_error)
|
|
7
7
|
require %(pangea/errors/no_infra_target_error)
|
8
8
|
require %(pangea/errors/incorrect_subcommand_error)
|
9
9
|
require %(pangea/say/init)
|
10
|
+
require %(pangea/modules)
|
10
11
|
require %(terraform-synthesizer)
|
11
12
|
require %(json)
|
12
13
|
|
@@ -25,10 +26,11 @@ class InfraCommand < PangeaCommand
|
|
25
26
|
end
|
26
27
|
|
27
28
|
argument :target do
|
28
|
-
desc %(target like ${namespace}.${site}
|
29
|
+
desc %(target like ${namespace}.${site})
|
29
30
|
end
|
30
31
|
|
31
32
|
def run(argv)
|
33
|
+
Say.terminal %(planning!)
|
32
34
|
parse(argv)
|
33
35
|
|
34
36
|
# grab a config synth
|
@@ -40,12 +42,38 @@ class InfraCommand < PangeaCommand
|
|
40
42
|
exit
|
41
43
|
end
|
42
44
|
|
45
|
+
Say.terminal JSON.pretty_generate(cfg_synth)
|
46
|
+
|
43
47
|
# preflight checks for the command execution
|
44
|
-
check_run
|
45
|
-
check_target(params[:target], cfg_synth)
|
48
|
+
# check_run
|
49
|
+
# check_target(params[:target], cfg_synth)
|
50
|
+
|
51
|
+
# targets = params[:target].split('.').map(&:to_sym)
|
52
|
+
# process_target(targets, cfg_synth)
|
53
|
+
|
54
|
+
###########################################################################
|
55
|
+
# modules
|
56
|
+
# modules can be fetched from git or local path
|
57
|
+
# modules can have a virtual environment to execute in
|
58
|
+
###########################################################################
|
59
|
+
|
60
|
+
namespaces = cfg_synth[:namespace].keys.map(&:to_sym)
|
61
|
+
|
62
|
+
namespaces.each do |namespace_name|
|
63
|
+
namespace = cfg_synth[:namespace][namespace_name]
|
64
|
+
context_names = namespace.keys.map(&:to_sym)
|
65
|
+
|
66
|
+
context_names.each do |cn|
|
67
|
+
context = namespace[cn]
|
68
|
+
modules = context[:modules]
|
69
|
+
|
70
|
+
modules.each do |mod|
|
71
|
+
PangeaModule.process(mod)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
46
75
|
|
47
|
-
|
48
|
-
process_target(targets, cfg_synth)
|
76
|
+
###########################################################################
|
49
77
|
|
50
78
|
# provide some kind of default exit of the command execution
|
51
79
|
exit
|
@@ -146,50 +174,49 @@ class InfraCommand < PangeaCommand
|
|
146
174
|
# targets can be...
|
147
175
|
# ${namespace}
|
148
176
|
# ${namespace}.${site}
|
149
|
-
# ${namespace}.${site}.${project}
|
150
177
|
def check_target(target, config)
|
151
|
-
raise NamespaceNotFoundError if target.nil?
|
152
|
-
|
153
|
-
targets = target.split('.').map(&:to_sym)
|
154
|
-
namespaces = config[:namespace].keys.map(&:to_sym)
|
155
|
-
runtype = nil
|
156
|
-
environments = []
|
157
|
-
|
158
|
-
namespaces.each do |ns_name|
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
raise NamespaceNotFoundError unless namespaces.include?(targets[0])
|
163
|
-
|
164
|
-
namespaces.each do |ns_name|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
end
|
178
|
+
# raise NamespaceNotFoundError if target.nil?
|
179
|
+
|
180
|
+
# targets = target.split('.').map(&:to_sym)
|
181
|
+
# namespaces = config[:namespace].keys.map(&:to_sym)
|
182
|
+
# runtype = nil
|
183
|
+
# environments = []
|
184
|
+
|
185
|
+
# namespaces.each do |ns_name|
|
186
|
+
# environments.concat(config[:namespace][ns_name].keys.map(&:to_sym))
|
187
|
+
# end
|
188
|
+
|
189
|
+
# raise NamespaceNotFoundError unless namespaces.include?(targets[0])
|
190
|
+
|
191
|
+
# namespaces.each do |ns_name|
|
192
|
+
# environments.each do |e_name|
|
193
|
+
# sites = config[:namespace][ns_name][e_name][:sites] || []
|
194
|
+
#
|
195
|
+
# next if sites.empty?
|
196
|
+
#
|
197
|
+
# site_names = []
|
198
|
+
# sites.each do |site|
|
199
|
+
# site_names << site[:name]
|
200
|
+
# end
|
201
|
+
#
|
202
|
+
# raise SiteNotFoundError unless site_names.include?(targets[1].to_sym)
|
203
|
+
#
|
204
|
+
# projects = config[:namespace][ns_name][e_name][:projects] || []
|
205
|
+
#
|
206
|
+
# next if projects.empty?
|
207
|
+
#
|
208
|
+
# project_names = []
|
209
|
+
# projects.each do |project|
|
210
|
+
# project_names << project[:name]
|
211
|
+
# end
|
212
|
+
#
|
213
|
+
# raise ProjectNotFoundError \
|
214
|
+
# unless project_names
|
215
|
+
# .include?(
|
216
|
+
# targets[2].to_sym
|
217
|
+
# )
|
218
|
+
# end
|
219
|
+
# end
|
193
220
|
end
|
194
221
|
|
195
222
|
def check_run
|
@@ -0,0 +1,67 @@
|
|
1
|
+
###############################################################################
|
2
|
+
# modules
|
3
|
+
# module for handling pangea modules
|
4
|
+
# pangea modules are execution units
|
5
|
+
# for terraform code.
|
6
|
+
###############################################################################
|
7
|
+
|
8
|
+
module PangeaBase
|
9
|
+
BASE_DIR = File.join(
|
10
|
+
Dir.home,
|
11
|
+
%(.pangea)
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
module PangeaRbenv
|
16
|
+
include PangeaBase
|
17
|
+
|
18
|
+
BIN = %(rbenv).freeze
|
19
|
+
|
20
|
+
RBENV_DIR = File.join(
|
21
|
+
BASE_DIR,
|
22
|
+
%(rbenv)
|
23
|
+
)
|
24
|
+
|
25
|
+
VERSIONS_DIR = File.join(
|
26
|
+
RBENV_DIR,
|
27
|
+
%(versions)
|
28
|
+
)
|
29
|
+
|
30
|
+
class << self
|
31
|
+
def rbenv_installed?
|
32
|
+
`which rbenv`.strip != ''
|
33
|
+
end
|
34
|
+
|
35
|
+
def rbenv_install(_version)
|
36
|
+
system %(mkdir -p #{VERSIONS_DIR}) unless Dir.exist?(VERSIONS_DIR)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
module PangeaModule
|
42
|
+
include PangeaBase
|
43
|
+
|
44
|
+
CACHE_DIR = File.join(
|
45
|
+
BASE_DIR,
|
46
|
+
%(cache)
|
47
|
+
)
|
48
|
+
|
49
|
+
RUBIES_DIR = File.join(
|
50
|
+
BASE_DIR,
|
51
|
+
%(rubies)
|
52
|
+
)
|
53
|
+
|
54
|
+
# SECTIONS = %i[
|
55
|
+
# lib
|
56
|
+
# src
|
57
|
+
# ].freeze
|
58
|
+
|
59
|
+
class << self
|
60
|
+
# entrypoint for module processing
|
61
|
+
def process(mod)
|
62
|
+
exit 1 unless mod.fetch(:sandboxed, false)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# end modules
|
@@ -0,0 +1,90 @@
|
|
1
|
+
###############################################################################
|
2
|
+
# sandbox
|
3
|
+
#
|
4
|
+
# modules need an execution space which I'm naming sandboxes
|
5
|
+
# sandboxes will contain the ruby interpreter, associated packages
|
6
|
+
# and pangea DSL code for the execution of a single module
|
7
|
+
###############################################################################
|
8
|
+
|
9
|
+
class SandboxRuby
|
10
|
+
attr_reader(*%i[base_dir name gemset version])
|
11
|
+
|
12
|
+
def initialize(base_dir:, name:, gemset:, version:)
|
13
|
+
@base_dir = base_dir
|
14
|
+
@version = version
|
15
|
+
@name = name
|
16
|
+
@gemset = gemset
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class SandBox
|
21
|
+
attr_reader(*%i[base_dir name rubies])
|
22
|
+
|
23
|
+
def initialize(
|
24
|
+
name:,
|
25
|
+
base_dir: %(~/.pangea/sandbox),
|
26
|
+
rubies: []
|
27
|
+
)
|
28
|
+
@base_dir = base_dir
|
29
|
+
@name = name
|
30
|
+
@rubies = rubies
|
31
|
+
|
32
|
+
@rubies_dir = File.join(@base_dir, @name, %(rubies))
|
33
|
+
|
34
|
+
@ruby_build_cmd = %(ruby-build)
|
35
|
+
end
|
36
|
+
|
37
|
+
def prepare_sandbox
|
38
|
+
ensure_base_dir_exists
|
39
|
+
ensure_rubies_directories_exist
|
40
|
+
check_ruby_build_installed
|
41
|
+
ensure_rubies_installed
|
42
|
+
end
|
43
|
+
|
44
|
+
def clean_sandbox
|
45
|
+
system %(rm -rf #{base_dir})
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def ensure_base_dir_exists
|
51
|
+
system %(mkdir -p #{base_dir}) unless Dir.exist?(base_dir)
|
52
|
+
end
|
53
|
+
|
54
|
+
def ensure_rubies_directories_exist
|
55
|
+
rubies.each do |ruby|
|
56
|
+
ruby_dir = File.join(@rubies_dir, ruby.version, ruby.gemset, ruby.name)
|
57
|
+
system %(mkdir -p #{ruby_dir}) unless Dir.exist?(ruby_dir)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def command_exists_on_path?(cmd)
|
62
|
+
system("which #{cmd} > /dev/null 2>&1")
|
63
|
+
end
|
64
|
+
|
65
|
+
def ruby_build_installed?
|
66
|
+
command_exists_on_path?(@ruby_build_cmd)
|
67
|
+
end
|
68
|
+
|
69
|
+
def ensure_rubies_installed
|
70
|
+
rubies.each do |ruby|
|
71
|
+
ruby_dir = File.join(@rubies_dir, ruby.version, ruby.gemset, ruby.name)
|
72
|
+
system %(#{@ruby_build_cmd} #{ruby.version} #{ruby_dir}) unless File.exist?(
|
73
|
+
File.join(
|
74
|
+
ruby_dir,
|
75
|
+
%(.installed_by_pangea)
|
76
|
+
)
|
77
|
+
)
|
78
|
+
system %(touch #{File.join(ruby_dir, %(.installed_by_pangea))}) unless File.exist?(
|
79
|
+
File.join(
|
80
|
+
ruby_dir,
|
81
|
+
%(.installed_by_pangea)
|
82
|
+
)
|
83
|
+
)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def check_ruby_build_installed
|
88
|
+
raise %(ruby-build not installed) unless ruby_build_installed?
|
89
|
+
end
|
90
|
+
end
|
data/lib/pangea/version.rb
CHANGED
data/lib/pangea.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
###############################################################################
|
2
|
+
# non-cli top level commands
|
3
|
+
###############################################################################
|
4
|
+
|
5
|
+
module Pangea
|
6
|
+
class << self
|
7
|
+
def ping
|
8
|
+
%(pong)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/pangea.gemspec
CHANGED
@@ -13,11 +13,14 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.summary = %(control rest apis declaratively with ruby)
|
14
14
|
spec.homepage = %(https://github.com/drzln/#{spec.name})
|
15
15
|
spec.license = %(MIT)
|
16
|
-
spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
17
16
|
spec.require_paths = [%(lib)]
|
18
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
18
|
spec.required_ruby_version = %(>= #{`cat .ruby-version`})
|
20
19
|
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
|
+
f.match(%r{^(test|spec|features)/})
|
22
|
+
end
|
23
|
+
|
21
24
|
%i[
|
22
25
|
rubocop-rspec
|
23
26
|
rubocop-rake
|
data/pangea.rb
CHANGED
@@ -2,17 +2,19 @@ namespace :nexus, :atavan do
|
|
2
2
|
long :atavan
|
3
3
|
short :at
|
4
4
|
|
5
|
-
state_config(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
state_config(
|
6
|
+
{
|
7
|
+
terraform: {
|
8
|
+
s3: {
|
9
|
+
bucket: %(atavan-terraform-state),
|
10
|
+
key: %(atavan/terraform.tfstate),
|
11
|
+
region: %(us-west-2),
|
12
|
+
dynamodb_table: %(atavan-terraform-lock),
|
13
|
+
encrypt: true
|
14
|
+
}
|
13
15
|
}
|
14
16
|
}
|
15
|
-
|
17
|
+
)
|
16
18
|
|
17
19
|
# environments(
|
18
20
|
# {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pangea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- drzthslnt@gmail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop-rspec
|
@@ -265,9 +265,7 @@ dependencies:
|
|
265
265
|
description: control rest apis declaratively with ruby
|
266
266
|
email:
|
267
267
|
- drzthslnt@gmail.com
|
268
|
-
executables:
|
269
|
-
- pangea
|
270
|
-
- stitches
|
268
|
+
executables: []
|
271
269
|
extensions: []
|
272
270
|
extra_rdoc_files: []
|
273
271
|
files:
|
@@ -288,6 +286,7 @@ files:
|
|
288
286
|
- flake.lock
|
289
287
|
- flake.nix
|
290
288
|
- gemset.nix
|
289
|
+
- lib/pangea.rb
|
291
290
|
- lib/pangea/cli.rb
|
292
291
|
- lib/pangea/cli/config.rb
|
293
292
|
- lib/pangea/cli/constants.rb
|
@@ -302,6 +301,8 @@ files:
|
|
302
301
|
- lib/pangea/errors/project_not_found_error.rb
|
303
302
|
- lib/pangea/errors/site_not_found_error.rb
|
304
303
|
- lib/pangea/log/init.rb
|
304
|
+
- lib/pangea/modules.rb
|
305
|
+
- lib/pangea/sandbox.rb
|
305
306
|
- lib/pangea/say/init.rb
|
306
307
|
- lib/pangea/shell/README.md
|
307
308
|
- lib/pangea/shell/terraform.rb
|
@@ -314,8 +315,6 @@ files:
|
|
314
315
|
- lib/pangea/version.rb
|
315
316
|
- pangea.gemspec
|
316
317
|
- pangea.rb
|
317
|
-
- spec/cli/config_spec.rb
|
318
|
-
- spec/synthesizer/config_spec.rb
|
319
318
|
homepage: https://github.com/drzln/pangea
|
320
319
|
licenses:
|
321
320
|
- MIT
|
data/spec/cli/config_spec.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require %(pangea/cli/config)
|
4
|
-
|
5
|
-
describe Config do
|
6
|
-
context %(#resolve_configuration) do
|
7
|
-
defaults = { ignore_default_paths: true }
|
8
|
-
it %(empty when paths ignored) do
|
9
|
-
expect(
|
10
|
-
Config.resolve_configurations(**defaults.merge(
|
11
|
-
{ extra_paths: [] }
|
12
|
-
))
|
13
|
-
).to be_empty
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require %(pangea/synthesizer/config)
|
4
|
-
|
5
|
-
# describe ConfigSynthesizer do
|
6
|
-
# context %(main) do
|
7
|
-
# let(:synth) do
|
8
|
-
# described_class.new
|
9
|
-
# end
|
10
|
-
#
|
11
|
-
# it %(should compile small declaration and be hash) do
|
12
|
-
# synth.synthesize do
|
13
|
-
# namespace :nietztche, :thus_spoke_zarathustra do
|
14
|
-
# superman(%(came from krypton))
|
15
|
-
# overman(%(came from austria))
|
16
|
-
# end
|
17
|
-
# end
|
18
|
-
# expect(synth.synthesis).to be_kind_of(Hash)
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
# it %(should raise an argument error with more than one arg per field) do
|
22
|
-
# expect do
|
23
|
-
# synth.synthesize do
|
24
|
-
# namespace :socrates, :the_republic do
|
25
|
-
# things(%(may), %(not), %(be), %(what), %(you), %(think))
|
26
|
-
# end
|
27
|
-
# end
|
28
|
-
# end.to raise_error(TooManyFieldValuesError)
|
29
|
-
# end
|
30
|
-
#
|
31
|
-
# it %(should have expected keys) do
|
32
|
-
# synth.synthesize do
|
33
|
-
# namespace :kafka, :metamorphasis do
|
34
|
-
# change :inevitable
|
35
|
-
# end
|
36
|
-
# end
|
37
|
-
# expect(
|
38
|
-
# synth.synthesis[:namespace][:kafka][:metamorphasis][:change]
|
39
|
-
# ).to be(:inevitable)
|
40
|
-
# end
|
41
|
-
# end
|
42
|
-
# end
|