terraform-synthesizer 0.0.19 → 0.0.21

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: 807b4c88d54ee98534840da643a704ca78f84327be4803ea25654ad34e799d32
4
- data.tar.gz: acedad3d477df680649f2e27efaa8fbd29e3b688d1542ac5f2d0bbba51dfdf98
3
+ metadata.gz: 4e143fcb38eea65856239f4ced9c2c4d64810a658ecb570d925f05bfa19aaf08
4
+ data.tar.gz: 9c1ab4e1ee2de99348e47a65edec733326ea9859cef33c10878b2bc1e644cc47
5
5
  SHA512:
6
- metadata.gz: f3b0193de45c09eecec12e597fff20534b8875ed479cba08707ebd125ec859c410334e0937ad7444993fa759879281517af2c8a5bf5569c750e9bef17ef985fc
7
- data.tar.gz: 3974ec03a5f3df9c72042b01efd30a6bcab499c1036c2644c36ea5ab8ce9017903ba5fe2c25060430e3b57f04e715c60ac577a9617c3efecc9041ddd05959e92
6
+ metadata.gz: de6d35a3c316e81e3e00646710c682d3d5e983a7189174fa15109836a77d3bc8ea85905391d222e11fe777c1a3c97f7c0cb35b1eefc638dbefe2719e99c1e47e
7
+ data.tar.gz: 210483b473c35eac0ddb3341f7bbd11a458afa66780187287568e288dd53c614b07c146c566548bed5e97cb6a00c1bba4b77f7c1b16bfd457740c3335d45a338
data/Gemfile.lock CHANGED
@@ -44,7 +44,7 @@ GEM
44
44
  diff-lcs (>= 1.2.0, < 2.0)
45
45
  rspec-support (~> 3.12.0)
46
46
  rspec-support (3.12.1)
47
- rubocop (1.57.2)
47
+ rubocop (1.58.0)
48
48
  json (~> 2.3)
49
49
  language_server-protocol (>= 3.17.0)
50
50
  parallel (~> 1.10)
@@ -52,7 +52,7 @@ GEM
52
52
  rainbow (>= 2.2.2, < 4.0)
53
53
  regexp_parser (>= 1.8, < 3.0)
54
54
  rexml (>= 3.2.5, < 4.0)
55
- rubocop-ast (>= 1.28.1, < 2.0)
55
+ rubocop-ast (>= 1.30.0, < 2.0)
56
56
  ruby-progressbar (~> 1.7)
57
57
  unicode-display_width (>= 2.4.0, < 3.0)
58
58
  rubocop-ast (1.30.0)
@@ -1,3 +1,3 @@
1
1
  module TerraformSynthesizer
2
- VERSION = %(0.0.19).freeze
2
+ VERSION = %(0.0.21).freeze
3
3
  end
@@ -5,55 +5,16 @@ class TerraformSynthesizer < AbstractSynthesizer
5
5
  terraform
6
6
  resource
7
7
  variable
8
+ locals
8
9
  output
9
10
  data
10
11
  ].freeze
11
12
 
12
- # if there are additional block keys
13
- # add them here and they should be processed
14
- # accordingly
15
- BLOCK_KEYS = %i[locals].freeze
16
-
17
- ##############################################################################
18
- # notes:
19
- #
20
- # locals are processed as a direct block like
21
- # locals do
22
- # key value
23
- # end
24
- # while resources are processed as resource like blocks
25
- # resource :aws_vpc, :virtual_name do
26
- # key value
27
- # end
28
- ##############################################################################
29
- def method_missing(method_name, *args, &)
30
- BLOCK_KEYS.each do |block_key|
31
- if @in_block_key
32
- if args[0].nil? || args[0].empty?
33
- raise ArgumentError,
34
- %(not assigning anything to this #{block_key})
35
- end
36
-
37
- @in_block_key = false
38
- @translation[:template][block_key.to_sym][method_name.to_sym] = args[0]
39
-
40
- elsif method_name.to_s.eql?(block_key.to_s)
41
-
42
- @translation = {} if @translation.nil?
43
- @translation[:template] = {} if @translation[:template].nil?
44
- @translation[:template][block_key.to_sym] = {} \
45
- if @translation[:template][block_key.to_sym].nil?
46
- @in_block_key = true
47
-
48
- yield
49
- else
50
- abstract_method_missing(
51
- method_name.to_sym,
52
- RESOURCE_KEYS,
53
- *args,
54
- &
55
- )
56
- end
57
- end
13
+ def method_missing(method_name, ...)
14
+ abstract_method_missing(
15
+ method_name.to_sym,
16
+ RESOURCE_KEYS,
17
+ ...
18
+ )
58
19
  end
59
20
  end
@@ -6,43 +6,37 @@ describe TerraformSynthesizer do
6
6
  described_class.new
7
7
  end
8
8
 
9
- it %(should compile small declaration and be hash) do
9
+ it %(should contain resource thing) do
10
10
  synth.synthesize do
11
11
  resource :aws_vpc, :thing do
12
12
  cidr_block %(10.0.0.0/16)
13
- end
14
- locals do
15
- special_var %(special_value)
13
+ stuff do
14
+ other_stuff %(whoa)
15
+ end
16
16
  end
17
17
  resource :aws_vpc, :thang do
18
18
  cidr_block %(10.0.0.0/16)
19
19
  end
20
20
  end
21
- expect(synth.synthesis).to be_kind_of(Hash)
21
+ expect(synth.synthesis[:resource][:aws_vpc][:thing]).to be_kind_of(Hash)
22
22
  end
23
23
 
24
- it %(should contain locals) do
24
+ it %(should compile small declaration and be hash) do
25
25
  synth.synthesize do
26
26
  resource :aws_vpc, :thing do
27
27
  cidr_block %(10.0.0.0/16)
28
28
  end
29
- locals do
30
- special_var %(special_value)
31
- end
32
29
  resource :aws_vpc, :thang do
33
30
  cidr_block %(10.0.0.0/16)
34
31
  end
35
32
  end
36
- expect(synth.synthesis[:locals][:special_var]).to be_kind_of(String)
33
+ expect(synth.synthesis).to be_kind_of(Hash)
37
34
  end
38
35
 
39
- it %(should contain resource thing) do
36
+ it %(should contain locals) do
40
37
  synth.synthesize do
41
38
  resource :aws_vpc, :thing do
42
39
  cidr_block %(10.0.0.0/16)
43
- stuff do
44
- other_stuff %(whoa)
45
- end
46
40
  end
47
41
  locals do
48
42
  special_var %(special_value)
@@ -51,7 +45,7 @@ describe TerraformSynthesizer do
51
45
  cidr_block %(10.0.0.0/16)
52
46
  end
53
47
  end
54
- expect(synth.synthesis[:resource][:aws_vpc][:thing]).to be_kind_of(Hash)
48
+ expect(synth.synthesis[:locals][:special_var]).to be_kind_of(String)
55
49
  end
56
50
 
57
51
  it %(should contain resource thang) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraform-synthesizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.21
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-12-01 00:00:00.000000000 Z
11
+ date: 2023-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: abstract-synthesizer