pangea 0.0.23 → 0.0.24
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 +4 -4
- data/lib/pangea/cli/subcommands/config.rb +85 -0
- data/lib/pangea/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6664d8cf753fd5e4a36c6525af5208c6629076f635c2afe2a951d73251a54951
|
4
|
+
data.tar.gz: 49027000adecf0a2e1657ef530b58ddc05b1fc723655e187a1086925d7462080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e26a27dcc7804b25d108481ff10e9e749a049e97a110fe2cee7a2802077b7bbdf83ee47ac4bf13e3d3fbdb14fde5a3cb7bb1fb1eef387903218435a5e1348c9
|
7
|
+
data.tar.gz: 86e207bf1d559aa63ff5f627011c6b2f9c2327748ef065e0108f442bc05c4e044eb9302b9388d7a24beea9e06b52fdcfb2a21f9b3aae0c7f31e13064f0cf3577
|
@@ -4,6 +4,7 @@ require %(pangea/cli/config)
|
|
4
4
|
require %(json)
|
5
5
|
require %(aws-sdk-dynamodb)
|
6
6
|
require %(aws-sdk-s3)
|
7
|
+
require %(terraform-synthesizer)
|
7
8
|
|
8
9
|
class ConfigCommand < PangeaCommand
|
9
10
|
usage do
|
@@ -76,6 +77,77 @@ class ConfigCommand < PangeaCommand
|
|
76
77
|
when %(show)
|
77
78
|
config = Config.resolve_configurations
|
78
79
|
puts JSON.pretty_generate(config)
|
80
|
+
when %(plan)
|
81
|
+
puts 'planning pangea configuration...'
|
82
|
+
config = Config.resolve_configurations
|
83
|
+
|
84
|
+
config[:namespace].each_key do |ns_name|
|
85
|
+
ns = config[:namespace][ns_name]
|
86
|
+
ns.each_key do |ctx_name|
|
87
|
+
ctx = ns[ctx_name]
|
88
|
+
|
89
|
+
###################################################################
|
90
|
+
# setup modules
|
91
|
+
###################################################################
|
92
|
+
|
93
|
+
module_dirs = %w[lib src test]
|
94
|
+
modules = ctx[:modules]
|
95
|
+
synth = TerraformSynthesizer.new
|
96
|
+
|
97
|
+
modules.each_key do |mod_name|
|
98
|
+
this_mod = modules[mod_name]
|
99
|
+
|
100
|
+
if this_mod[:sandboxed]
|
101
|
+
# TODO: setup sandboxed module
|
102
|
+
nil
|
103
|
+
elsif this_mod[:path]
|
104
|
+
|
105
|
+
lib_dir = File.join(this_mod[:path], %(lib))
|
106
|
+
lib_files = Dir.glob(File.join(this_mod[:path], %(lib), %(**/*.rb)))
|
107
|
+
|
108
|
+
system(%(mkdir -p #{lib_dir})) unless Dir.exist?(lib_dir)
|
109
|
+
|
110
|
+
lib_files.each do |lib_file|
|
111
|
+
synth.synthesize(
|
112
|
+
File.read(
|
113
|
+
File.join(
|
114
|
+
this_mod[:path],
|
115
|
+
%(lib),
|
116
|
+
lib_file
|
117
|
+
)
|
118
|
+
)
|
119
|
+
)
|
120
|
+
end
|
121
|
+
|
122
|
+
# end process lib if exists
|
123
|
+
# process src if exists
|
124
|
+
|
125
|
+
src_dir = File.join(this_mod[:path], %(src))
|
126
|
+
src_files = Dir.glob(File.join(this_mod[:path], %(src), %(**/*.rb)))
|
127
|
+
|
128
|
+
system(%(mkdir -p #{src_dir})) unless Dir.exist?(src_dir)
|
129
|
+
|
130
|
+
lib_files.each do |lib_file|
|
131
|
+
synth.synthesize(
|
132
|
+
File.read(
|
133
|
+
File.join(
|
134
|
+
this_mod[:path],
|
135
|
+
%(lib),
|
136
|
+
lib_file
|
137
|
+
)
|
138
|
+
)
|
139
|
+
)
|
140
|
+
end
|
141
|
+
# read mod from a local path
|
142
|
+
# use terraform synthesizer to do it
|
143
|
+
|
144
|
+
# process lib if exists
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
puts JSON.pretty_generate(synth.synthesis)
|
150
|
+
end
|
79
151
|
when %(init)
|
80
152
|
puts 'intializing pangea configuration...'
|
81
153
|
config = Config.resolve_configurations
|
@@ -117,6 +189,19 @@ class ConfigCommand < PangeaCommand
|
|
117
189
|
end
|
118
190
|
|
119
191
|
# end s3 bucket setup
|
192
|
+
|
193
|
+
###################################################################
|
194
|
+
# setup directories
|
195
|
+
###################################################################
|
196
|
+
|
197
|
+
base_dir = File.join(ENV.fetch(%(HOME), nil), %(.pangea))
|
198
|
+
context_dir = File.join(base_dir, ctx_name)
|
199
|
+
synth_dir = File.join(base_dir, synth_dir)
|
200
|
+
|
201
|
+
system(%(mkdir -p #{context_dir})) unless Dir.exist?(context_dir)
|
202
|
+
system(%(mkdir -p #{synth_dir})) unless Dir.exist?(synth_dir)
|
203
|
+
|
204
|
+
# end setup directories
|
120
205
|
end
|
121
206
|
end
|
122
207
|
end
|
data/lib/pangea/version.rb
CHANGED
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.24
|
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-07-
|
11
|
+
date: 2023-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop-rspec
|