pangea 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +56 -0
  3. data/.rubocop.yml +54 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Dockerfile +6 -0
  7. data/Gemfile +29 -0
  8. data/Gemfile.lock +127 -0
  9. data/LICENSE +201 -0
  10. data/README.md +59 -0
  11. data/Rakefile +33 -0
  12. data/bin/pangea +3 -0
  13. data/bin/stitches +0 -0
  14. data/example/config/README.md +3 -0
  15. data/example/config/sample.rb +20 -0
  16. data/flake.lock +60 -0
  17. data/flake.nix +17 -0
  18. data/gemset.nix +500 -0
  19. data/lib/pangea/cli/config.rb +69 -0
  20. data/lib/pangea/cli/constants.rb +36 -0
  21. data/lib/pangea/cli/subcommands/config.rb +14 -0
  22. data/lib/pangea/cli/subcommands/infra.rb +206 -0
  23. data/lib/pangea/cli/subcommands/main.rb +60 -0
  24. data/lib/pangea/cli/subcommands/stitches.rb +18 -0
  25. data/lib/pangea/cli.rb +1 -0
  26. data/lib/pangea/docker.rb +91 -0
  27. data/lib/pangea/errors/incorrect_subcommand_error.rb +2 -0
  28. data/lib/pangea/errors/namespace_not_found_error.rb +2 -0
  29. data/lib/pangea/errors/no_infra_target_error.rb +2 -0
  30. data/lib/pangea/errors/project_not_found_error.rb +2 -0
  31. data/lib/pangea/errors/site_not_found_error.rb +2 -0
  32. data/lib/pangea/extractors/README.md +3 -0
  33. data/lib/pangea/log/init.rb +2 -0
  34. data/lib/pangea/say/init.rb +27 -0
  35. data/lib/pangea/shell/README.md +1 -0
  36. data/lib/pangea/shell/terraform.rb +21 -0
  37. data/lib/pangea/structures/README.md +3 -0
  38. data/lib/pangea/structures/abstract.rb +2 -0
  39. data/lib/pangea/structures/namespace.rb +4 -0
  40. data/lib/pangea/structures/project.rb +4 -0
  41. data/lib/pangea/structures/site.rb +4 -0
  42. data/lib/pangea/synthesizer/config.rb +39 -0
  43. data/lib/pangea/version.rb +3 -0
  44. data/pangea.gemspec +39 -0
  45. data/spec/cli/config_spec.rb +16 -0
  46. data/spec/synthesizer/config_spec.rb +42 -0
  47. metadata +231 -0
data/flake.nix ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ description = "pangea";
3
+
4
+ inputs.nixpkgs.url = github:NixOS/nixpkgs;
5
+ inputs.ruby-flake-utils.url = github:t3rro/ruby-flake-utils;
6
+
7
+ outputs = { ruby-flake-utils, nixpkgs, ... }:
8
+ ruby-flake-utils.lib.mkGemSystems {
9
+ inherit nixpkgs;
10
+ name = "pangea";
11
+ lockfile = ./Gemfile.lock;
12
+ gemfile = ./Gemfile;
13
+ gemset = ./gemset.nix;
14
+ strategy = "bin";
15
+ src = ./.;
16
+ };
17
+ }
data/gemset.nix ADDED
@@ -0,0 +1,500 @@
1
+ {
2
+ abstract-synthesizer = {
3
+ groups = ["production"];
4
+ platforms = [];
5
+ source = {
6
+ remotes = ["https://rubygems.org"];
7
+ sha256 = "1xnhippwcywr65gm0y8rjpy35pmsx8nq4wm8k5sb87xpxidrqm35";
8
+ type = "gem";
9
+ };
10
+ version = "0.0.1";
11
+ };
12
+ ast = {
13
+ groups = ["default" "development"];
14
+ platforms = [];
15
+ source = {
16
+ remotes = ["https://rubygems.org"];
17
+ sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y";
18
+ type = "gem";
19
+ };
20
+ version = "2.4.2";
21
+ };
22
+ backport = {
23
+ groups = ["default" "development"];
24
+ platforms = [];
25
+ source = {
26
+ remotes = ["https://rubygems.org"];
27
+ sha256 = "0xbzzjrgah0f8ifgd449kak2vyf30micpz6x2g82aipfv7ypsb4i";
28
+ type = "gem";
29
+ };
30
+ version = "1.2.0";
31
+ };
32
+ benchmark = {
33
+ groups = ["default" "development"];
34
+ platforms = [];
35
+ source = {
36
+ remotes = ["https://rubygems.org"];
37
+ sha256 = "017jh2lx3z5hqjvnqclc5bfr5q0d3zk0nqjfz73909ybr4h20kmi";
38
+ type = "gem";
39
+ };
40
+ version = "0.2.1";
41
+ };
42
+ citrus = {
43
+ groups = ["default" "production"];
44
+ platforms = [];
45
+ source = {
46
+ remotes = ["https://rubygems.org"];
47
+ sha256 = "0l7nhk3gkm1hdchkzzhg2f70m47pc0afxfpl6mkiibc9qcpl3hjf";
48
+ type = "gem";
49
+ };
50
+ version = "3.0.2";
51
+ };
52
+ diff-lcs = {
53
+ groups = ["default" "development"];
54
+ platforms = [];
55
+ source = {
56
+ remotes = ["https://rubygems.org"];
57
+ sha256 = "0rwvjahnp7cpmracd8x732rjgnilqv2sx7d1gfrysslc3h039fa9";
58
+ type = "gem";
59
+ };
60
+ version = "1.5.0";
61
+ };
62
+ e2mmap = {
63
+ groups = ["default" "development"];
64
+ platforms = [];
65
+ source = {
66
+ remotes = ["https://rubygems.org"];
67
+ sha256 = "0n8gxjb63dck3vrmsdcqqll7xs7f3wk78mw8w0gdk9wp5nx6pvj5";
68
+ type = "gem";
69
+ };
70
+ version = "0.1.0";
71
+ };
72
+ jaro_winkler = {
73
+ groups = ["default" "development"];
74
+ platforms = [];
75
+ source = {
76
+ remotes = ["https://rubygems.org"];
77
+ sha256 = "10fd3i92897blalxfkgc0jjv0qqx31v7cm7j2b6a3b97an0bfz80";
78
+ type = "gem";
79
+ };
80
+ version = "1.5.6";
81
+ };
82
+ json = {
83
+ groups = ["default" "development"];
84
+ platforms = [];
85
+ source = {
86
+ remotes = ["https://rubygems.org"];
87
+ sha256 = "0nalhin1gda4v8ybk6lq8f407cgfrj6qzn234yra4ipkmlbfmal6";
88
+ type = "gem";
89
+ };
90
+ version = "2.6.3";
91
+ };
92
+ keycutter = {
93
+ groups = ["development"];
94
+ platforms = [];
95
+ source = {
96
+ remotes = ["https://rubygems.org"];
97
+ sha256 = "09v950ip9wn5l17dcd7jdyz43aj2hmy8q3rj31q430mz0q02z98n";
98
+ type = "gem";
99
+ };
100
+ version = "1.0.2";
101
+ };
102
+ kramdown = {
103
+ dependencies = ["rexml"];
104
+ groups = ["default" "development"];
105
+ platforms = [];
106
+ source = {
107
+ remotes = ["https://rubygems.org"];
108
+ sha256 = "1ic14hdcqxn821dvzki99zhmcy130yhv5fqfffkcf87asv5mnbmn";
109
+ type = "gem";
110
+ };
111
+ version = "2.4.0";
112
+ };
113
+ kramdown-parser-gfm = {
114
+ dependencies = ["kramdown"];
115
+ groups = ["default" "development"];
116
+ platforms = [];
117
+ source = {
118
+ remotes = ["https://rubygems.org"];
119
+ sha256 = "0a8pb3v951f4x7h968rqfsa19c8arz21zw1vaj42jza22rap8fgv";
120
+ type = "gem";
121
+ };
122
+ version = "1.1.0";
123
+ };
124
+ nokogiri = {
125
+ dependencies = ["racc"];
126
+ groups = ["default" "development"];
127
+ platforms = [];
128
+ source = {
129
+ remotes = ["https://rubygems.org"];
130
+ sha256 = "0c3r6dxi50cy4bdn10jr08yi7hdrgy4x4l3z64703i71kv0fwzmm";
131
+ type = "gem";
132
+ };
133
+ version = "1.15.2";
134
+ };
135
+ parallel = {
136
+ groups = ["default" "development"];
137
+ platforms = [];
138
+ source = {
139
+ remotes = ["https://rubygems.org"];
140
+ sha256 = "0jcc512l38c0c163ni3jgskvq1vc3mr8ly5pvjijzwvfml9lf597";
141
+ type = "gem";
142
+ };
143
+ version = "1.23.0";
144
+ };
145
+ parser = {
146
+ dependencies = ["ast" "racc"];
147
+ groups = ["default" "development"];
148
+ platforms = [];
149
+ source = {
150
+ remotes = ["https://rubygems.org"];
151
+ sha256 = "1swigds85jddb5gshll1g8lkmbcgbcp9bi1d4nigwvxki8smys0h";
152
+ type = "gem";
153
+ };
154
+ version = "3.2.2.3";
155
+ };
156
+ pastel = {
157
+ dependencies = ["tty-color"];
158
+ groups = ["default" "production"];
159
+ platforms = [];
160
+ source = {
161
+ remotes = ["https://rubygems.org"];
162
+ sha256 = "0xash2gj08dfjvq4hy6l1z22s5v30fhizwgs10d6nviggpxsj7a8";
163
+ type = "gem";
164
+ };
165
+ version = "0.8.0";
166
+ };
167
+ racc = {
168
+ groups = ["default" "development"];
169
+ platforms = [];
170
+ source = {
171
+ remotes = ["https://rubygems.org"];
172
+ sha256 = "11v3l46mwnlzlc371wr3x6yylpgafgwdf0q7hc7c1lzx6r414r5g";
173
+ type = "gem";
174
+ };
175
+ version = "1.7.1";
176
+ };
177
+ rainbow = {
178
+ groups = ["default" "development"];
179
+ platforms = [];
180
+ source = {
181
+ remotes = ["https://rubygems.org"];
182
+ sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503";
183
+ type = "gem";
184
+ };
185
+ version = "3.1.1";
186
+ };
187
+ rake = {
188
+ groups = ["development"];
189
+ platforms = [];
190
+ source = {
191
+ remotes = ["https://rubygems.org"];
192
+ sha256 = "15whn7p9nrkxangbs9hh75q585yfn66lv0v2mhj6q6dl6x8bzr2w";
193
+ type = "gem";
194
+ };
195
+ version = "13.0.6";
196
+ };
197
+ rbs = {
198
+ groups = ["default" "development"];
199
+ platforms = [];
200
+ source = {
201
+ remotes = ["https://rubygems.org"];
202
+ sha256 = "0dgj5n7rj83981fvrhswfwsh88x42p7r00nvd80hkxmdcjvda2h6";
203
+ type = "gem";
204
+ };
205
+ version = "2.8.4";
206
+ };
207
+ regexp_parser = {
208
+ groups = ["default" "development"];
209
+ platforms = [];
210
+ source = {
211
+ remotes = ["https://rubygems.org"];
212
+ sha256 = "136br91alxdwh1s85z912dwz23qlhm212vy6i3wkinz3z8mkxxl3";
213
+ type = "gem";
214
+ };
215
+ version = "2.8.1";
216
+ };
217
+ reverse_markdown = {
218
+ dependencies = ["nokogiri"];
219
+ groups = ["default" "development"];
220
+ platforms = [];
221
+ source = {
222
+ remotes = ["https://rubygems.org"];
223
+ sha256 = "0087vhw5ik50lxvddicns01clkx800fk5v5qnrvi3b42nrk6885j";
224
+ type = "gem";
225
+ };
226
+ version = "2.1.1";
227
+ };
228
+ rexml = {
229
+ groups = ["default" "development"];
230
+ platforms = [];
231
+ source = {
232
+ remotes = ["https://rubygems.org"];
233
+ sha256 = "08ximcyfjy94pm1rhcx04ny1vx2sk0x4y185gzn86yfsbzwkng53";
234
+ type = "gem";
235
+ };
236
+ version = "3.2.5";
237
+ };
238
+ rspec = {
239
+ dependencies = ["rspec-core" "rspec-expectations" "rspec-mocks"];
240
+ groups = ["development"];
241
+ platforms = [];
242
+ source = {
243
+ remotes = ["https://rubygems.org"];
244
+ sha256 = "171rc90vcgjl8p1bdrqa92ymrj8a87qf6w20x05xq29mljcigi6c";
245
+ type = "gem";
246
+ };
247
+ version = "3.12.0";
248
+ };
249
+ rspec-core = {
250
+ dependencies = ["rspec-support"];
251
+ groups = ["default" "development"];
252
+ platforms = [];
253
+ source = {
254
+ remotes = ["https://rubygems.org"];
255
+ sha256 = "0l95bnjxdabrn79hwdhn2q1n7mn26pj7y1w5660v5qi81x458nqm";
256
+ type = "gem";
257
+ };
258
+ version = "3.12.2";
259
+ };
260
+ rspec-expectations = {
261
+ dependencies = ["diff-lcs" "rspec-support"];
262
+ groups = ["default" "development"];
263
+ platforms = [];
264
+ source = {
265
+ remotes = ["https://rubygems.org"];
266
+ sha256 = "05j44jfqlv7j2rpxb5vqzf9hfv7w8ba46wwgxwcwd8p0wzi1hg89";
267
+ type = "gem";
268
+ };
269
+ version = "3.12.3";
270
+ };
271
+ rspec-mocks = {
272
+ dependencies = ["diff-lcs" "rspec-support"];
273
+ groups = ["default" "development"];
274
+ platforms = [];
275
+ source = {
276
+ remotes = ["https://rubygems.org"];
277
+ sha256 = "1hfm17xakfvwya236graj6c2arr4sb9zasp35q5fykhyz8mhs0w2";
278
+ type = "gem";
279
+ };
280
+ version = "3.12.5";
281
+ };
282
+ rspec-support = {
283
+ groups = ["default" "development"];
284
+ platforms = [];
285
+ source = {
286
+ remotes = ["https://rubygems.org"];
287
+ sha256 = "12y52zwwb3xr7h91dy9k3ndmyyhr3mjcayk0nnarnrzz8yr48kfx";
288
+ type = "gem";
289
+ };
290
+ version = "3.12.0";
291
+ };
292
+ rubocop = {
293
+ dependencies = ["json" "parallel" "parser" "rainbow" "regexp_parser" "rexml" "rubocop-ast" "ruby-progressbar" "unicode-display_width"];
294
+ groups = ["development"];
295
+ platforms = [];
296
+ source = {
297
+ remotes = ["https://rubygems.org"];
298
+ sha256 = "0bxc1p7bwh8dlmcvh6ns239sp9v8j46vw4h450ag8wa7bh1ii1wh";
299
+ type = "gem";
300
+ };
301
+ version = "1.52.1";
302
+ };
303
+ rubocop-ast = {
304
+ dependencies = ["parser"];
305
+ groups = ["default" "development"];
306
+ platforms = [];
307
+ source = {
308
+ remotes = ["https://rubygems.org"];
309
+ sha256 = "188bs225kkhrb17dsf3likdahs2p1i1sqn0pr3pvlx50g6r2mnni";
310
+ type = "gem";
311
+ };
312
+ version = "1.29.0";
313
+ };
314
+ ruby-progressbar = {
315
+ groups = ["default" "development"];
316
+ platforms = [];
317
+ source = {
318
+ remotes = ["https://rubygems.org"];
319
+ sha256 = "0cwvyb7j47m7wihpfaq7rc47zwwx9k4v7iqd9s1xch5nm53rrz40";
320
+ type = "gem";
321
+ };
322
+ version = "1.13.0";
323
+ };
324
+ solargraph = {
325
+ dependencies = ["backport" "benchmark" "diff-lcs" "e2mmap" "jaro_winkler" "kramdown" "kramdown-parser-gfm" "parser" "rbs" "reverse_markdown" "rubocop" "thor" "tilt" "yard"];
326
+ groups = ["development"];
327
+ platforms = [];
328
+ source = {
329
+ remotes = ["https://rubygems.org"];
330
+ sha256 = "18wpma2mgw82qzf1jwjalmz7nwdvn87b22wd5yy16jb67fqgrq78";
331
+ type = "gem";
332
+ };
333
+ version = "0.49.0";
334
+ };
335
+ strings = {
336
+ dependencies = ["strings-ansi" "unicode-display_width" "unicode_utils"];
337
+ groups = ["default" "production"];
338
+ platforms = [];
339
+ source = {
340
+ remotes = ["https://rubygems.org"];
341
+ sha256 = "1yynb0qhhhplmpzavfrrlwdnd1rh7rkwzcs4xf0mpy2wr6rr6clk";
342
+ type = "gem";
343
+ };
344
+ version = "0.2.1";
345
+ };
346
+ strings-ansi = {
347
+ groups = ["default" "production"];
348
+ platforms = [];
349
+ source = {
350
+ remotes = ["https://rubygems.org"];
351
+ sha256 = "120wa6yjc63b84lprglc52f40hx3fx920n4dmv14rad41rv2s9lh";
352
+ type = "gem";
353
+ };
354
+ version = "0.2.0";
355
+ };
356
+ terraform-synthesizer = {
357
+ groups = ["production"];
358
+ platforms = [];
359
+ source = {
360
+ remotes = ["https://rubygems.org"];
361
+ sha256 = "1yisfjkln4pyj6bsx7vlpn0gjjflpndx626d4ai570hyiqxkkknv";
362
+ type = "gem";
363
+ };
364
+ version = "0.0.1";
365
+ };
366
+ thor = {
367
+ groups = ["default" "development"];
368
+ platforms = [];
369
+ source = {
370
+ remotes = ["https://rubygems.org"];
371
+ sha256 = "0k7j2wn14h1pl4smibasw0bp66kg626drxb59z7rzflch99cd4rg";
372
+ type = "gem";
373
+ };
374
+ version = "1.2.2";
375
+ };
376
+ tilt = {
377
+ groups = ["default" "development"];
378
+ platforms = [];
379
+ source = {
380
+ remotes = ["https://rubygems.org"];
381
+ sha256 = "0bmjgbv8158klwp2r3klxjwaj93nh1sbl4xvj9wsha0ic478avz7";
382
+ type = "gem";
383
+ };
384
+ version = "2.2.0";
385
+ };
386
+ toml-rb = {
387
+ dependencies = ["citrus"];
388
+ groups = ["production"];
389
+ platforms = [];
390
+ source = {
391
+ remotes = ["https://rubygems.org"];
392
+ sha256 = "19nr4wr5accc6l2y3avn7b02lqmk9035zxq42234k7fcqd5cbqm1";
393
+ type = "gem";
394
+ };
395
+ version = "2.2.0";
396
+ };
397
+ tty-box = {
398
+ dependencies = ["pastel" "strings" "tty-cursor"];
399
+ groups = ["production"];
400
+ platforms = [];
401
+ source = {
402
+ remotes = ["https://rubygems.org"];
403
+ sha256 = "12yzhl3s165fl8pkfln6mi6mfy3vg7p63r3dvcgqfhyzq6h57x0p";
404
+ type = "gem";
405
+ };
406
+ version = "0.7.0";
407
+ };
408
+ tty-color = {
409
+ groups = ["production"];
410
+ platforms = [];
411
+ source = {
412
+ remotes = ["https://rubygems.org"];
413
+ sha256 = "0aik4kmhwwrmkysha7qibi2nyzb4c8kp42bd5vxnf8sf7b53g73g";
414
+ type = "gem";
415
+ };
416
+ version = "0.6.0";
417
+ };
418
+ tty-cursor = {
419
+ groups = ["default" "production"];
420
+ platforms = [];
421
+ source = {
422
+ remotes = ["https://rubygems.org"];
423
+ sha256 = "0j5zw041jgkmn605ya1zc151bxgxl6v192v2i26qhxx7ws2l2lvr";
424
+ type = "gem";
425
+ };
426
+ version = "0.7.1";
427
+ };
428
+ tty-option = {
429
+ groups = ["production"];
430
+ platforms = [];
431
+ source = {
432
+ remotes = ["https://rubygems.org"];
433
+ sha256 = "019ir4bcr8fag7dmq7ph6ilpvwjbv4qalip0bz7dlddbd6fk4vjs";
434
+ type = "gem";
435
+ };
436
+ version = "0.3.0";
437
+ };
438
+ tty-progressbar = {
439
+ dependencies = ["strings-ansi" "tty-cursor" "tty-screen" "unicode-display_width"];
440
+ groups = ["production"];
441
+ platforms = [];
442
+ source = {
443
+ remotes = ["https://rubygems.org"];
444
+ sha256 = "1pqjng07zjln4rxxmi8jlbx7cjrpfv684mrzl6nv715mjap2d5yv";
445
+ type = "gem";
446
+ };
447
+ version = "0.18.2";
448
+ };
449
+ tty-screen = {
450
+ groups = ["default" "production"];
451
+ platforms = [];
452
+ source = {
453
+ remotes = ["https://rubygems.org"];
454
+ sha256 = "18jr6s1cg8yb26wzkqa6874q0z93rq0y5aw092kdqazk71y6a235";
455
+ type = "gem";
456
+ };
457
+ version = "0.8.1";
458
+ };
459
+ tty-table = {
460
+ dependencies = ["pastel" "strings" "tty-screen"];
461
+ groups = ["production"];
462
+ platforms = [];
463
+ source = {
464
+ remotes = ["https://rubygems.org"];
465
+ sha256 = "0fcrbfb0hjd9vkkazkksri93dv9wgs2hp6p1xwb1lp43a13pmhpx";
466
+ type = "gem";
467
+ };
468
+ version = "0.12.0";
469
+ };
470
+ unicode-display_width = {
471
+ groups = ["default" "development" "production"];
472
+ platforms = [];
473
+ source = {
474
+ remotes = ["https://rubygems.org"];
475
+ sha256 = "1gi82k102q7bkmfi7ggn9ciypn897ylln1jk9q67kjhr39fj043a";
476
+ type = "gem";
477
+ };
478
+ version = "2.4.2";
479
+ };
480
+ unicode_utils = {
481
+ groups = ["default" "production"];
482
+ platforms = [];
483
+ source = {
484
+ remotes = ["https://rubygems.org"];
485
+ sha256 = "0h1a5yvrxzlf0lxxa1ya31jcizslf774arnsd89vgdhk4g7x08mr";
486
+ type = "gem";
487
+ };
488
+ version = "1.4.0";
489
+ };
490
+ yard = {
491
+ groups = ["development"];
492
+ platforms = [];
493
+ source = {
494
+ remotes = ["https://rubygems.org"];
495
+ sha256 = "013yrnwx1zhzhn1fnc19zck22a1qgimsaglp2iwgf5bz9l8h93js";
496
+ type = "gem";
497
+ };
498
+ version = "0.9.34";
499
+ };
500
+ }
@@ -0,0 +1,69 @@
1
+ require_relative %(../synthesizer/config)
2
+ require_relative %(./constants)
3
+
4
+ module Config
5
+ class << self
6
+ include Constants
7
+
8
+ def synthesizer
9
+ @synthesizer ||= ConfigSynthesizer.new
10
+ end
11
+
12
+ def xdg_config_home
13
+ ENV.fetch(
14
+ %(XDG_CONFIG_HOME),
15
+ %(#{ENV.fetch('HOME', nil)}/.config)
16
+ )
17
+ end
18
+
19
+ # return array of paths that can store a configuration
20
+ def default_paths
21
+ p = {}
22
+
23
+ EXTENSIONS.each do |ext|
24
+ p[ext] = [] unless p[ext]
25
+ p[ext] << File.join(%(/opt), %(share), %(pangea.#{ext}))
26
+ p[ext] << File.join(%(/etc), %(pangea), %(pangea.#{ext}))
27
+ p[ext].concat(
28
+ Dir.glob(
29
+ File.join(%(/etc/), %(pangea), %(conf.d), %(*.#{ext}))
30
+ )
31
+ )
32
+ p[ext] << File.join(xdg_config_home, %(pangea), %(pangea.#{ext}))
33
+ p[ext].concat(
34
+ Dir.glob(
35
+ File.join(xdg_config_home, %(pangea), %(conf.d), %(*.#{ext}))
36
+ )
37
+ )
38
+ end
39
+
40
+ res = []
41
+ EXTENSIONS.each do |ext|
42
+ files = p[ext]
43
+ files.each do |file|
44
+ res << file if File.exist?(file)
45
+ end
46
+ end
47
+
48
+ res
49
+ end
50
+
51
+ # read file paths and run configuration parsers
52
+ # then appropriately merge configurations
53
+ def resolve_configurations(ignore_default_paths: false, extra_paths: [])
54
+ paths = if ignore_default_paths
55
+ extra_paths
56
+ else
57
+ default_paths.concat(extra_paths)
58
+ end
59
+ paths.each do |path|
60
+ parted = path.split(%(.))
61
+ ext = parted[-1]
62
+ _base = parted[0]
63
+
64
+ synthesizer.synthesize(File.read(path), ext)
65
+ end
66
+ synthesizer.synthesis
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,36 @@
1
+ module Constants
2
+ # useful names
3
+ ARTIFACT_FILE = %(artifact.tf.json)
4
+
5
+ # cli related constants
6
+ CACHE_DIR = File.join(
7
+ ENV.fetch(%(HOME), nil),
8
+ %(.cache),
9
+ %(pangea)
10
+ ).freeze
11
+
12
+ # project related constants
13
+ PROJECT_VERSION = %i[version.rb].freeze
14
+
15
+ # order of elements matters here
16
+ # projects should be processed
17
+ # by collecting ruby files in exactly
18
+ # this order. changing this can significantly
19
+ # impact how a project is processed.
20
+ PROJECT_SRC_DIRS = %i[
21
+ lib
22
+ pre
23
+ resources
24
+ post
25
+ ].freeze
26
+
27
+ # configuration extensions
28
+ EXTENSIONS = %i[
29
+ json
30
+ toml
31
+ yaml
32
+ yml
33
+ nix
34
+ rb
35
+ ].freeze
36
+ end
@@ -0,0 +1,14 @@
1
+ require_relative %(./pangea)
2
+
3
+ class ConfigCommand < StitchesCommand
4
+ usage do
5
+ desc %(manage configuration)
6
+ program %(pangea)
7
+ command %(config)
8
+ end
9
+
10
+ def run(argv)
11
+ parse(argv)
12
+ print help
13
+ end
14
+ end