pangea 0.0.55 → 0.0.57

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: 4bf557ef0a2666edac8bc5ad280eea2c7f248d166fa92956cf906a83ccd71242
4
- data.tar.gz: 242ab3f14c0080baf0f2439dabbdc61c1f9da170e4dffd77da6a2d6673124794
3
+ metadata.gz: b67384b1e67ddd2e0ce27af66f4e84cbb477eb9ca4c7d7441f347379a53664a6
4
+ data.tar.gz: 660bad90a7ad11eeea0efcba6cebb195d4b033ad5f1687f244e9b7323a6d5442
5
5
  SHA512:
6
- metadata.gz: 1e27d23827951002e1df28b6e6e7d5789ba392857f9e10817efafbb861c838c5430859b429b7e7c147091228d27a7c84460a8d423c9c5101742a3b5d16725821
7
- data.tar.gz: 1597ae0afdd33c6099b0747c45bbcc3da8876dbdb01b663279bf44e083e6996ee7a1baf6a3462fa88c9d1380617100613547b8b87ddad37db1907ce11c8de36d
6
+ metadata.gz: 859e4081b558250b3c130c4d23cf45a4d9f631cb0545e75facb6ef83129f8841c9a9afdaf115b8a3cc7f58ede4e6ff124ca2cf9b3da12e6305475a65b61583ea
7
+ data.tar.gz: dbc9e49f912a86066c05a9e6f6ddc78605cdb745614b57addd9e538222a066dc21bc6cb356cd428b6ce70d670db50db0108b28ae085bbbf69492b007368e4140
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pangea (0.0.55)
4
+ pangea (0.0.57)
5
5
  abstract-synthesizer
6
6
  aws-sdk-dynamodb
7
7
  aws-sdk-s3
@@ -127,7 +127,7 @@ GEM
127
127
  rbs (>= 3, < 5)
128
128
  sorbet-runtime (>= 0.5.10782)
129
129
  ruby-progressbar (1.13.0)
130
- sorbet-runtime (0.5.12167)
130
+ sorbet-runtime (0.5.12174)
131
131
  stringio (3.1.7)
132
132
  strings (0.2.1)
133
133
  strings-ansi (~> 0.2)
data/gemset.nix CHANGED
@@ -254,7 +254,7 @@
254
254
  path = ./.;
255
255
  type = "path";
256
256
  };
257
- version = "0.0.55";
257
+ version = "0.0.57";
258
258
  };
259
259
  parallel = {
260
260
  groups = ["default" "development"];
@@ -537,10 +537,10 @@
537
537
  platforms = [];
538
538
  source = {
539
539
  remotes = ["https://rubygems.org"];
540
- sha256 = "029irlivbgfc2j7jlrpd7bpsh4nkcq5zqmyfs0p6j9nii7kn2dz3";
540
+ sha256 = "09zjmrbdk0rb3v23n5xsc0lzgsh2mc0wi32ig7rqvslc7k6b0pk6";
541
541
  type = "gem";
542
542
  };
543
- version = "0.5.12167";
543
+ version = "0.5.12174";
544
544
  };
545
545
  stringio = {
546
546
  groups = ["default" "development"];
@@ -12,7 +12,6 @@ module Pangea
12
12
  def register_action(action)
13
13
  permitted_actions = %i[plan apply show destroy]
14
14
  @action = action if permitted_actions.map(&:to_s).include?(action.to_s)
15
- @action = 'plan' if @action.nil?
16
15
  end
17
16
 
18
17
  def process(content)
@@ -84,9 +83,13 @@ module Pangea
84
83
  )
85
84
  )
86
85
 
87
- system("cd #{local_cache} && #{bin} apply -auto-approve") if @action.to_s.eql?('apply')
88
- system("cd #{local_cache} && #{bin} plan") if @action.to_s.eql?('plan')
89
- system("cd #{local_cache} && #{bin} destroy -auto-approve") if @action.to_s.eql?('destroy')
86
+ if @action.to_s == 'apply'
87
+ system "cd #{local_cache} && #{bin} apply -auto-approve"
88
+ elsif @action.to_s == 'plan'
89
+ system "cd #{local_cache} && #{bin} plan"
90
+ elsif @action.to_s == 'destroy'
91
+ system "cd #{local_cache} && #{bin} destroy -auto-approve"
92
+ end
90
93
 
91
94
  template = Pangea::Utils.symbolize(
92
95
  JSON[File.read(
@@ -63,8 +63,6 @@ module Pangea
63
63
  resource_name = synthesizer.synthesis[:resource][synthesizer.synthesis[:resource].keys[0]].keys[0]
64
64
  dir = File.join(init_dir, resource_type.to_s, resource_name.to_s)
65
65
  create_prepped_state_directory(dir, synthesizer.synthesis)
66
- system %(cd #{dir} && #{BIN} show -json tfplan > plan.json)
67
- system %(cd #{dir} && #{BIN} init -input=false)
68
66
  system %(cd #{dir} && #{BIN} apply -auto-approve)
69
67
 
70
68
  synthesizer.clear_synthesis!
@@ -83,160 +81,5 @@ module Pangea
83
81
  @synthesizer ||= TerraformSynthesizer.new
84
82
  end
85
83
  end
86
-
87
- # BIN = %(tofu).freeze
88
-
89
- # attr_reader :namespace
90
-
91
- # def initialize
92
- # raise ArgumentError, 'provide PANGEA_NAMESPACE ENVVAR' if ENV.fetch('PANGEA_NAMESPACE').nil?
93
- #
94
- # @namespace = ENV.fetch('PANGEA_NAMESPACE', nil)
95
- # end
96
-
97
- # def config
98
- # @config ||= Pangea::Utils.symbolize(
99
- # Pangea::Config.config
100
- # )
101
- # end
102
-
103
- # def s3
104
- # @s3 = Aws::S3::Client.new
105
- # end
106
-
107
- # def verify_state(state)
108
- # raise Argumenterror, 'must have a bucket' unless state[:config][:bucket]
109
- # raise Argumenterror, 'must have a region' unless state[:config][:region]
110
- # raise Argumenterror, 'must have a lock' unless state[:config][:lock]
111
- # end
112
-
113
- # def pangea_home
114
- # %(#{Dir.home}/.pangea/#{namespace})
115
- # end
116
-
117
- # def bin
118
- # %(tofu)
119
- # end
120
-
121
- # def selected_namespace_configuration
122
- # sns = ''
123
- # config[:namespaces].each_key do |ns|
124
- # sns = config[:namespaces][ns] if ns.to_s.eql?(namespace.to_s)
125
- # end
126
- # @selected_namespace_configuration ||= sns
127
- # end
128
-
129
- # render things in a resource context
130
- # without using terraform modules
131
- # def state(name, &block)
132
- # if block.nil?
133
- # File.write(File.join(local_cache, 'main.tf.json'), JSON[{}])
134
- # system("cd #{local_cache} && #{bin} init -input=false")
135
- # system("cd #{local_cache} && #{bin} plan")
136
- # system("cd #{local_cache} && #{bin} apply -auto-approve")
137
- # return {}
138
- # end
139
- # S3Renderer.synthesizer.synthesize(&block)
140
- # synth = Pangea::Utils.symbolize(S3Renderer.synthesizer.synthesis)
141
- # prefix = "#{name}/pangea"
142
- # local_cache = File.join(pangea_home, prefix)
143
- # `mkdir -p #{local_cache}` unless Dir.exist?(local_cache)
144
- # sns = selected_namespace_configuration
145
- # verify_state(sns[:state])
146
- #
147
- # # apply state configuration
148
- # unless synth[:terraform]
149
- # S3Renderer.synthesizer.synthesize do
150
- # terraform do
151
- # backend(
152
- # s3: {
153
- # key: prefix,
154
- # dynamodb_table: sns[:state][:config][:lock].to_s,
155
- # bucket: sns[:state][:config][:bucket].to_s,
156
- # region: sns[:state][:config][:region].to_s,
157
- # encrypt: true
158
- # }
159
- # )
160
- # end
161
- # end
162
- # end
163
- #
164
- # File.write(File.join(local_cache, 'main.tf.json'), JSON[S3Renderer.synthesizer.synthesis])
165
- # template = Pangea::Utils.symbolize(JSON[File.read(File.join(local_cache, 'main.tf.json'))])
166
- # system("cd #{local_cache} && #{bin} init -input=false")
167
- # system("cd #{local_cache} && #{bin} plan")
168
- # system("cd #{local_cache} && #{bin} apply -auto-approve")
169
- # # puts s3.list_objects_v2(bucket: sns[:state][:config][:bucket], prefix: prefix).contents.map(&:key)
170
- # { template: template }
171
- # end
172
-
173
- # def state_keys
174
- # sns = selected_namespace_configuration
175
- # end
176
-
177
- # def state; end
178
-
179
- # def render_component(template)
180
- # mod = 'stump'
181
- # sns = ''
182
- # config[:namespaces].each_key do |ns|
183
- # sns = config[:namespaces][ns] if ns.to_s.eql?(namespace.to_s)
184
- # end
185
- #
186
- # unless sns[:state][:type].to_s.eql?('s3')
187
- # raise ArgumentError,
188
- # 'state type must be s3 '
189
- # end
190
- #
191
- # if sns.nil? || sns.empty?
192
- # raise ArgumentError,
193
- # "namespace #{namespace} not found in #{Pangea::Utils.pretty(config)}"
194
- # end
195
- #
196
- # synthesizer.synthesize(template)
197
- # syn = Pangea::Utils.symbolize(synthesizer.synthesis)
198
- # raise ArgumentError, 'must provide at least one resource' if syn[:resource].nil?
199
- #
200
- # resource_name = syn[:resource].keys[0]
201
- # virtual_name = syn[:resource][syn[:resource].keys[0]].keys[0]
202
- #
203
- # synthesizer.synthesize do
204
- # provider do
205
- # aws(region: sns[:state][:config][:region].to_s)
206
- # end
207
- # variable do
208
- # name(type: 'string', description: 'the module name')
209
- # end
210
- # end
211
- #
212
- # synthesizer.synthesize do
213
- # terraform do
214
- # backend(
215
- # s3: {
216
- # key: "#{sns[:name]}/#{mod}/#{resource_name}/#{virtual_name}/module",
217
- # dynamodb_table: sns[:state][:config][:lock].to_s,
218
- # bucket: sns[:state][:config][:bucket].to_s,
219
- # region: sns[:state][:config][:region].to_s,
220
- # encrypt: true
221
- # }
222
- # )
223
- # end
224
- # end
225
- #
226
- # # modcache_address = "#{sns[:name]}/#{mod}/#{resource_name}/#{virtual_name}/module"
227
- #
228
- # # create the modcache directory
229
- # modcache = Pangea::ModCache.new(
230
- # sns[:name],
231
- # mod,
232
- # resource_name,
233
- # virtual_name
234
- # )
235
- # # place the internal module
236
- # modcache.place_internal_module(syn)
237
- # modcache.place_caller_template
238
- #
239
- # Pangea::Utils.symbolize(synthesizer.synthesis)
240
- # end
241
84
  end
242
85
  end
@@ -1,3 +1,3 @@
1
1
  module Pangea
2
- VERSION = %(0.0.55).freeze
2
+ VERSION = %(0.0.57).freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pangea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.55
4
+ version: 0.0.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - drzthslnt@gmail.com