terraform-synthesizer 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f50786c1639887e0775bcaa7c31060ac2aa8bbd3b5d31f0265671294f8b8a9d6
4
- data.tar.gz: 6d990987d5b7eb33109bac60ee3ecf489e5390d05efde071fad51c11bbd63cd1
3
+ metadata.gz: 4e143fcb38eea65856239f4ced9c2c4d64810a658ecb570d925f05bfa19aaf08
4
+ data.tar.gz: 9c1ab4e1ee2de99348e47a65edec733326ea9859cef33c10878b2bc1e644cc47
5
5
  SHA512:
6
- metadata.gz: 21590006be096774dfdcbc7621cc1a6aa8d25496f663e7e100f7cd4f4228e669dffc5a9ea8c82744165eb03f10b21f231e6143423891703b39b34c96309132ce
7
- data.tar.gz: 992956bbff976070436355896212d88075f6458fdd8c836329f51d885a1c79095e5063ab4b4eb87d1d697091995b4c6a2904472c7cacf8709c7ee41307cbf05a
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.20).freeze
2
+ VERSION = %(0.0.21).freeze
3
3
  end
@@ -2,57 +2,19 @@ require %(abstract-synthesizer)
2
2
 
3
3
  class TerraformSynthesizer < AbstractSynthesizer
4
4
  RESOURCE_KEYS = %i[
5
+ terraform
5
6
  resource
6
7
  variable
8
+ locals
7
9
  output
8
10
  data
9
11
  ].freeze
10
12
 
11
- # if there are additional block keys
12
- # add them here and they should be processed
13
- # accordingly
14
- BLOCK_KEYS = %i[locals terraform].freeze
15
-
16
- ##############################################################################
17
- # notes:
18
- #
19
- # locals are processed as a direct block like
20
- # locals do
21
- # key value
22
- # end
23
- # while resources are processed as resource like blocks
24
- # resource :aws_vpc, :virtual_name do
25
- # key value
26
- # end
27
- ##############################################################################
28
- def method_missing(method_name, *args, &)
29
- BLOCK_KEYS.each do |block_key|
30
- if @in_block_key
31
- if args[0].nil? || args[0].empty?
32
- raise ArgumentError,
33
- %(not assigning anything to this #{block_key})
34
- end
35
-
36
- @in_block_key = false
37
- @translation[:template][block_key.to_sym][method_name.to_sym] = args[0]
38
-
39
- elsif method_name.to_s.eql?(block_key.to_s)
40
-
41
- @translation = {} if @translation.nil?
42
- @translation[:template] = {} if @translation[:template].nil?
43
- @translation[:template][block_key.to_sym] = {} \
44
- if @translation[:template][block_key.to_sym].nil?
45
- @in_block_key = true
46
-
47
- yield
48
- else
49
- abstract_method_missing(
50
- method_name.to_sym,
51
- RESOURCE_KEYS,
52
- *args,
53
- &
54
- )
55
- end
56
- end
13
+ def method_missing(method_name, ...)
14
+ abstract_method_missing(
15
+ method_name.to_sym,
16
+ RESOURCE_KEYS,
17
+ ...
18
+ )
57
19
  end
58
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.20
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