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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2966c945cd9bacb079a294f296133c5c978589e8c0c0ceb1fd55d11f3d58664
4
- data.tar.gz: 10e6fb03aae1ad14486a7f9197c016ff88fd9c5aa0acaf940a0b900527fc9863
3
+ metadata.gz: 6664d8cf753fd5e4a36c6525af5208c6629076f635c2afe2a951d73251a54951
4
+ data.tar.gz: 49027000adecf0a2e1657ef530b58ddc05b1fc723655e187a1086925d7462080
5
5
  SHA512:
6
- metadata.gz: dc0aa68ea9d1484f0786d1a184e4b1b5a3c50bb95313deaa7c8d024f42130ac988007bfdf48211c27de6cf64309d470fa90378680a98b25e5e1a0d598e808dc4
7
- data.tar.gz: 781a981cfbd8d761e0e8bd4cdb3cc22149930ff0cfc1950507384b483d8d70de00c99917a298f431b1a3668dd77f8cec116cb72ac261594ad18f6bef9b7ec87d
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
@@ -1,3 +1,3 @@
1
1
  module Pangea
2
- VERSION = %(0.0.23).freeze
2
+ VERSION = %(0.0.24).freeze
3
3
  end
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.23
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-22 00:00:00.000000000 Z
11
+ date: 2023-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop-rspec