rspec-terraform 0.1.0.pre.20 → 0.1.0.pre.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rspec/terraform/configuration/merger.rb +47 -0
- data/lib/rspec/terraform/configuration/providers/identity.rb +1 -1
- data/lib/rspec/terraform/configuration/providers/in_memory.rb +3 -11
- data/lib/rspec/terraform/configuration.rb +1 -0
- data/lib/rspec/terraform/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3a1d7d419c7e13ea95d8cf7b04ffe5183aa1cfce3d48e3027609b061416e640
|
4
|
+
data.tar.gz: 1f33098b03b9cba5294b2894f691d55d26f666185d1d6e9a748345a0fc383080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3dedee60ba29285bc292f263791cd117cff0adff0b092042f6774d321a9eba268431d601ce2cf7d39688c50777c342cde6ab4b20f6ac5603ad7eb3bbe665afa
|
7
|
+
data.tar.gz: 52fe2ac848e6e1d0d5e4677731dcd51db1483d2119966157d7d854ab73f1d2acd676f5412c4bb051ab740d77e9927c3d3e5bbf14bd756dc331853e1a93b13e09
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Terraform
|
5
|
+
module Configuration
|
6
|
+
class Merger
|
7
|
+
def merge(left, right)
|
8
|
+
merge_top_level(left, right)
|
9
|
+
.merge(merge_accumulating_maps(left, right))
|
10
|
+
.merge(merge_accumulating_lists(left, right))
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def merge_top_level(left, right)
|
16
|
+
left.merge(right)
|
17
|
+
end
|
18
|
+
|
19
|
+
def merge_accumulating_maps(left, right)
|
20
|
+
left_vars = left[:vars] || {}
|
21
|
+
right_vars = right[:vars] || {}
|
22
|
+
vars = left_vars.merge(right_vars)
|
23
|
+
|
24
|
+
merged = {}
|
25
|
+
unless left_vars == {} && right_vars == {}
|
26
|
+
merged = merged.merge(vars: vars)
|
27
|
+
end
|
28
|
+
|
29
|
+
merged
|
30
|
+
end
|
31
|
+
|
32
|
+
def merge_accumulating_lists(left, right)
|
33
|
+
left_var_files = left[:var_files] || []
|
34
|
+
right_var_files = right[:var_files] || []
|
35
|
+
var_files = left_var_files + right_var_files
|
36
|
+
|
37
|
+
merged = {}
|
38
|
+
unless left_var_files == [] && right_var_files == []
|
39
|
+
merged = merged.merge(var_files: var_files)
|
40
|
+
end
|
41
|
+
|
42
|
+
merged
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'ruby_terraform'
|
4
|
+
require_relative '../merger'
|
4
5
|
|
5
6
|
module RSpec
|
6
7
|
module Terraform
|
@@ -11,20 +12,11 @@ module RSpec
|
|
11
12
|
|
12
13
|
def initialize(configuration = {})
|
13
14
|
@configuration = configuration
|
15
|
+
@merger = Merger.new
|
14
16
|
end
|
15
17
|
|
16
18
|
def resolve(overrides = {})
|
17
|
-
|
18
|
-
right_vars = overrides[:vars] || {}
|
19
|
-
vars = left_vars.merge(right_vars)
|
20
|
-
|
21
|
-
top_level_merge = configuration.merge(overrides)
|
22
|
-
|
23
|
-
if left_vars == {} && right_vars == {}
|
24
|
-
top_level_merge
|
25
|
-
else
|
26
|
-
top_level_merge.merge(vars: vars)
|
27
|
-
end
|
19
|
+
@merger.merge(configuration, overrides)
|
28
20
|
end
|
29
21
|
end
|
30
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-terraform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.
|
4
|
+
version: 0.1.0.pre.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- InfraBlocks Maintainers
|
@@ -280,6 +280,7 @@ files:
|
|
280
280
|
- bin/setup
|
281
281
|
- lib/rspec/terraform.rb
|
282
282
|
- lib/rspec/terraform/configuration.rb
|
283
|
+
- lib/rspec/terraform/configuration/merger.rb
|
283
284
|
- lib/rspec/terraform/configuration/providers.rb
|
284
285
|
- lib/rspec/terraform/configuration/providers/identity.rb
|
285
286
|
- lib/rspec/terraform/configuration/providers/in_memory.rb
|