pangea 0.0.23 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pangea/cli/subcommands/config.rb +89 -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: 919682c5c7a33bd49b88e908e4a3b82592105f95223ae76e2d73e8278e052cca
|
4
|
+
data.tar.gz: 74e0c354978523389d262290e91f397d5ba4a7a37cffebe7a45e77f220d100b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67403c1db38f13bf892c9fefa876238598dbdd3a7f24cb180f9ebc26257ebd3e4996a6ec295a393682e452287334cc11e7c5ae13c125db6f8ca2a005762253fe
|
7
|
+
data.tar.gz: c96a048eb97ac95e8983ee30a46b623076a460b4207eabc8275883e349e61bdf9a9fbc918149a4d5baeafc78fd64d6eb5409d3bd2d34e1f8005ecbea42ef13ba
|
@@ -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,81 @@ 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
|
+
puts JSON.pretty_generate(config)
|
84
|
+
|
85
|
+
config[:namespace].each_key do |ns_name|
|
86
|
+
ns = config[:namespace][ns_name]
|
87
|
+
ns.each_key do |ctx_name|
|
88
|
+
ctx = ns[ctx_name]
|
89
|
+
|
90
|
+
###################################################################
|
91
|
+
# setup modules
|
92
|
+
###################################################################
|
93
|
+
|
94
|
+
module_dirs = %w[lib src test]
|
95
|
+
modules = ctx[:modules]
|
96
|
+
synth = TerraformSynthesizer.new
|
97
|
+
|
98
|
+
puts "modules:"
|
99
|
+
puts JSON.pretty_generate(modules)
|
100
|
+
|
101
|
+
modules.each_key do |mod_name|
|
102
|
+
this_mod = modules[mod_name]
|
103
|
+
|
104
|
+
if this_mod[:sandboxed]
|
105
|
+
# TODO: setup sandboxed module
|
106
|
+
nil
|
107
|
+
elsif this_mod[:path]
|
108
|
+
|
109
|
+
lib_dir = File.join(this_mod[:path], %(lib))
|
110
|
+
lib_files = Dir.glob(File.join(this_mod[:path], %(lib), %(**/*.rb)))
|
111
|
+
|
112
|
+
system(%(mkdir -p #{lib_dir})) unless Dir.exist?(lib_dir)
|
113
|
+
|
114
|
+
lib_files.each do |lib_file|
|
115
|
+
synth.synthesize(
|
116
|
+
File.read(
|
117
|
+
File.join(
|
118
|
+
this_mod[:path],
|
119
|
+
%(lib),
|
120
|
+
lib_file
|
121
|
+
)
|
122
|
+
)
|
123
|
+
)
|
124
|
+
end
|
125
|
+
|
126
|
+
# end process lib if exists
|
127
|
+
# process src if exists
|
128
|
+
|
129
|
+
src_dir = File.join(this_mod[:path], %(src))
|
130
|
+
src_files = Dir.glob(File.join(this_mod[:path], %(src), %(**/*.rb)))
|
131
|
+
|
132
|
+
system(%(mkdir -p #{src_dir})) unless Dir.exist?(src_dir)
|
133
|
+
|
134
|
+
lib_files.each do |lib_file|
|
135
|
+
synth.synthesize(
|
136
|
+
File.read(
|
137
|
+
File.join(
|
138
|
+
this_mod[:path],
|
139
|
+
%(lib),
|
140
|
+
lib_file
|
141
|
+
)
|
142
|
+
)
|
143
|
+
)
|
144
|
+
end
|
145
|
+
# read mod from a local path
|
146
|
+
# use terraform synthesizer to do it
|
147
|
+
|
148
|
+
# process lib if exists
|
149
|
+
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
puts JSON.pretty_generate(synth.synthesis)
|
154
|
+
end
|
79
155
|
when %(init)
|
80
156
|
puts 'intializing pangea configuration...'
|
81
157
|
config = Config.resolve_configurations
|
@@ -117,6 +193,19 @@ class ConfigCommand < PangeaCommand
|
|
117
193
|
end
|
118
194
|
|
119
195
|
# end s3 bucket setup
|
196
|
+
|
197
|
+
###################################################################
|
198
|
+
# setup directories
|
199
|
+
###################################################################
|
200
|
+
|
201
|
+
base_dir = File.join(ENV.fetch(%(HOME), nil), %(.pangea))
|
202
|
+
context_dir = File.join(base_dir, ctx_name)
|
203
|
+
synth_dir = File.join(base_dir, synth_dir)
|
204
|
+
|
205
|
+
system(%(mkdir -p #{context_dir})) unless Dir.exist?(context_dir)
|
206
|
+
system(%(mkdir -p #{synth_dir})) unless Dir.exist?(synth_dir)
|
207
|
+
|
208
|
+
# end setup directories
|
120
209
|
end
|
121
210
|
end
|
122
211
|
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.25
|
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
|