rspec-terraform 0.1.0.pre.40 → 0.1.0.pre.43

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: 12e11f477f99fd41080131cf322d8d6dedf40645e04bb41b66de3b5cee3128b5
4
- data.tar.gz: 47ccbe633464a8a414b9ea950a27c664bae5bef3e60155463b9a979f398900ac
3
+ metadata.gz: 8d338f5e02d75bdf58441300199c8902f712adf6582abff8b9e5021230c2d344
4
+ data.tar.gz: 16844e10dec62df8e57c1b84216c0f95742586be4fcca7792195d680e526200e
5
5
  SHA512:
6
- metadata.gz: 19aa8f5adeedf3bc1a71129205363f7eca9a843d47462345c34ee8a36358ee35e9d4ad2ea9bf1ac63bb8846c789181c88039428cc1514bfbd1f500ce3ca7b145
7
- data.tar.gz: 3c338a356d1ad4ff0264f1bcef7e756ea743c0f3582865bb62cfaadcc6bb539b4467a7c239836cb0c5f285362d313d9f1ab22aca62203d55816cdc8855c69287
6
+ metadata.gz: 49b0bc41cde756000e9e74218ab4b2c9ab451e19b8dbdf6f84a3d1d0329c7d6a1bb94ea801bfd15caaa374c512173b62dd137b610c942efafb5401180bc970ea
7
+ data.tar.gz: 0631d0581d8f6c6f9a13d8e6edcd9a714b44b6487803c95c0d4a3a5ec5650b129a80fe70054162121b0330e7430cdcf35171727eb406a7da6f964a247f676b43
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-terraform (0.1.0.pre.40)
4
+ rspec-terraform (0.1.0.pre.43)
5
5
  confidante (>= 0.27)
6
6
  rspec (>= 3.0)
7
- ruby-terraform (= 1.7.0.pre.16)
7
+ ruby-terraform (= 1.7.0.pre.17)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -148,7 +148,7 @@ GEM
148
148
  rubocop-rspec (2.12.1)
149
149
  rubocop (~> 1.31)
150
150
  ruby-progressbar (1.11.0)
151
- ruby-terraform (1.7.0.pre.16)
151
+ ruby-terraform (1.7.0.pre.17)
152
152
  immutable-struct (~> 2.4)
153
153
  lino (~> 3.0)
154
154
  ruby2_keywords (0.0.5)
@@ -7,15 +7,26 @@ require_relative '../configuration/var_captor'
7
7
  module RSpec
8
8
  module Terraform
9
9
  module Helpers
10
+ # rubocop:disable Metrics/ClassLength
10
11
  class Apply
11
12
  attr_reader(
12
- :configuration_provider, :binary, :execution_mode
13
+ :configuration_provider,
14
+ :binary,
15
+ :logger,
16
+ :stdin,
17
+ :stdout,
18
+ :stderr,
19
+ :execution_mode
13
20
  )
14
21
 
15
22
  def initialize(opts = {})
16
23
  @configuration_provider =
17
24
  opts[:configuration_provider] || Configuration.identity_provider
18
25
  @binary = opts[:binary] || 'terraform'
26
+ @logger = opts[:logger]
27
+ @stdin = opts[:stdin]
28
+ @stdout = opts[:stdout]
29
+ @stderr = opts[:stderr]
19
30
  @execution_mode = opts[:execution_mode] || :in_place
20
31
  end
21
32
 
@@ -97,11 +108,11 @@ module RSpec
97
108
  end
98
109
 
99
110
  def init_command
100
- RubyTerraform::Commands::Init.new(binary: binary)
111
+ RubyTerraform::Commands::Init.new(command_options)
101
112
  end
102
113
 
103
114
  def apply_command
104
- RubyTerraform::Commands::Apply.new(binary: binary)
115
+ RubyTerraform::Commands::Apply.new(command_options)
105
116
  end
106
117
 
107
118
  def init_parameters(parameters)
@@ -134,7 +145,18 @@ module RSpec
134
145
  apply_parameters
135
146
  end
136
147
  # rubocop:enable Metrics/MethodLength
148
+
149
+ def command_options
150
+ {
151
+ binary: binary,
152
+ logger: logger,
153
+ stdin: stdin,
154
+ stdout: stdout,
155
+ stderr: stderr
156
+ }
157
+ end
137
158
  end
159
+ # rubocop:enable Metrics/ClassLength
138
160
  end
139
161
  end
140
162
  end
@@ -7,15 +7,26 @@ require_relative '../configuration/var_captor'
7
7
  module RSpec
8
8
  module Terraform
9
9
  module Helpers
10
+ # rubocop:disable Metrics/ClassLength
10
11
  class Destroy
11
12
  attr_reader(
12
- :configuration_provider, :binary, :execution_mode
13
+ :configuration_provider,
14
+ :binary,
15
+ :logger,
16
+ :stdin,
17
+ :stdout,
18
+ :stderr,
19
+ :execution_mode
13
20
  )
14
21
 
15
22
  def initialize(opts = {})
16
23
  @configuration_provider =
17
24
  opts[:configuration_provider] || Configuration.identity_provider
18
25
  @binary = opts[:binary] || 'terraform'
26
+ @logger = opts[:logger]
27
+ @stdin = opts[:stdin]
28
+ @stdout = opts[:stdout]
29
+ @stderr = opts[:stderr]
19
30
  @execution_mode = opts[:execution_mode] || :in_place
20
31
  end
21
32
 
@@ -89,19 +100,18 @@ module RSpec
89
100
  end
90
101
 
91
102
  def init_command
92
- RubyTerraform::Commands::Init.new(binary: binary)
103
+ RubyTerraform::Commands::Init.new(command_options)
93
104
  end
94
105
 
95
106
  def destroy_command
96
- RubyTerraform::Commands::Destroy.new(binary: binary)
107
+ RubyTerraform::Commands::Destroy.new(command_options)
97
108
  end
98
109
 
99
110
  def init_parameters(parameters)
100
- init_parameters =
101
- parameters.merge(
102
- chdir: parameters[:configuration_directory],
103
- input: false
104
- )
111
+ init_parameters = parameters.merge(
112
+ chdir: parameters[:configuration_directory],
113
+ input: false
114
+ )
105
115
  if execution_mode == :isolated
106
116
  init_parameters =
107
117
  init_parameters.merge(from_module: parameters[:source_directory])
@@ -127,7 +137,18 @@ module RSpec
127
137
  destroy_parameters
128
138
  end
129
139
  # rubocop:enable Metrics/MethodLength
140
+
141
+ def command_options
142
+ {
143
+ binary: binary,
144
+ logger: logger,
145
+ stdin: stdin,
146
+ stdout: stdout,
147
+ stderr: stderr
148
+ }
149
+ end
130
150
  end
151
+ # rubocop:enable Metrics/ClassLength
131
152
  end
132
153
  end
133
154
  end
@@ -5,15 +5,26 @@ require 'ruby_terraform'
5
5
  module RSpec
6
6
  module Terraform
7
7
  module Helpers
8
+ # rubocop:disable Metrics/ClassLength
8
9
  class Output
9
10
  attr_reader(
10
- :configuration_provider, :binary, :execution_mode
11
+ :configuration_provider,
12
+ :binary,
13
+ :logger,
14
+ :stdin,
15
+ :stdout,
16
+ :stderr,
17
+ :execution_mode
11
18
  )
12
19
 
13
20
  def initialize(opts = {})
14
21
  @configuration_provider =
15
22
  opts[:configuration_provider] || Configuration.identity_provider
16
23
  @binary = opts[:binary] || 'terraform'
24
+ @logger = opts[:logger]
25
+ @stdin = opts[:stdin]
26
+ @stdout = opts[:stdout]
27
+ @stderr = opts[:stderr]
17
28
  @execution_mode = opts[:execution_mode] || :in_place
18
29
  end
19
30
 
@@ -90,11 +101,11 @@ module RSpec
90
101
  end
91
102
 
92
103
  def init_command
93
- RubyTerraform::Commands::Init.new(binary: binary)
104
+ RubyTerraform::Commands::Init.new(command_options)
94
105
  end
95
106
 
96
107
  def output_command(opts = {})
97
- RubyTerraform::Commands::Output.new(opts.merge(binary: binary))
108
+ RubyTerraform::Commands::Output.new(command_options.merge(opts))
98
109
  end
99
110
 
100
111
  def init_parameters(parameters)
@@ -123,7 +134,18 @@ module RSpec
123
134
 
124
135
  output_parameters
125
136
  end
137
+
138
+ def command_options
139
+ {
140
+ binary: binary,
141
+ logger: logger,
142
+ stdin: stdin,
143
+ stdout: stdout,
144
+ stderr: stderr
145
+ }
146
+ end
126
147
  end
127
148
  end
149
+ # rubocop:enable Metrics/ClassLength
128
150
  end
129
151
  end
@@ -12,13 +12,23 @@ module RSpec
12
12
  # rubocop:disable Metrics/ClassLength
13
13
  class Plan
14
14
  attr_reader(
15
- :configuration_provider, :binary, :execution_mode
15
+ :configuration_provider,
16
+ :binary,
17
+ :logger,
18
+ :stdin,
19
+ :stdout,
20
+ :stderr,
21
+ :execution_mode
16
22
  )
17
23
 
18
24
  def initialize(opts = {})
19
25
  @configuration_provider =
20
26
  opts[:configuration_provider] || Configuration.identity_provider
21
27
  @binary = opts[:binary] || 'terraform'
28
+ @logger = opts[:logger]
29
+ @stdin = opts[:stdin]
30
+ @stdout = opts[:stdout]
31
+ @stderr = opts[:stderr]
22
32
  @execution_mode = opts[:execution_mode] || :in_place
23
33
  end
24
34
 
@@ -116,15 +126,15 @@ module RSpec
116
126
  end
117
127
 
118
128
  def init_command
119
- RubyTerraform::Commands::Init.new(binary: binary)
129
+ RubyTerraform::Commands::Init.new(command_options)
120
130
  end
121
131
 
122
132
  def plan_command
123
- RubyTerraform::Commands::Plan.new(binary: binary)
133
+ RubyTerraform::Commands::Plan.new(command_options)
124
134
  end
125
135
 
126
136
  def show_command(opts = {})
127
- RubyTerraform::Commands::Show.new(opts.merge(binary: binary))
137
+ RubyTerraform::Commands::Show.new(command_options.merge(opts))
128
138
  end
129
139
 
130
140
  def init_parameters(parameters)
@@ -167,6 +177,16 @@ module RSpec
167
177
  json: true
168
178
  )
169
179
  end
180
+
181
+ def command_options
182
+ {
183
+ binary: binary,
184
+ logger: logger,
185
+ stdin: stdin,
186
+ stdout: stdout,
187
+ stderr: stderr
188
+ }
189
+ end
170
190
  end
171
191
  # rubocop:enable Metrics/ClassLength
172
192
  end
@@ -46,6 +46,10 @@ module RSpec
46
46
 
47
47
  {
48
48
  binary: config.terraform_binary,
49
+ logger: config.terraform_logger,
50
+ stdin: config.terraform_stdin,
51
+ stdout: config.terraform_stdout,
52
+ stderr: config.terraform_stderr,
49
53
  execution_mode: config.terraform_execution_mode,
50
54
  configuration_provider: config.terraform_configuration_provider
51
55
  }
@@ -66,13 +66,34 @@ module RSpec
66
66
  end
67
67
 
68
68
  def devices(opts)
69
+ streams = opts[:streams]
70
+ file_path = opts[:file_path]
71
+ stdout = opts[:stdout]
72
+
69
73
  {
70
- file: log_device(opts[:file_path] || File::NULL),
71
- stdout: log_device(opts[:stdout] || $stdout),
72
- stderr: log_device($stderr)
74
+ file: log_device(resolve_file_path(file_path, streams)),
75
+ stdout: log_device(resolved_stdout(stdout)),
76
+ stderr: log_device(resolved_stderr)
73
77
  }
74
78
  end
75
79
 
80
+ def resolve_file_path(file_path, streams)
81
+ resolved_file_path = File::NULL
82
+ if streams.include?(:file) && file_path
83
+ FileUtils.mkdir_p(File.dirname(file_path))
84
+ resolved_file_path = file_path
85
+ end
86
+ resolved_file_path
87
+ end
88
+
89
+ def resolved_stdout(stdout)
90
+ stdout || $stdout
91
+ end
92
+
93
+ def resolved_stderr
94
+ $stderr
95
+ end
96
+
76
97
  def log_device(io)
77
98
  Logger::LogDevice.new(io)
78
99
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Terraform
5
- VERSION = '0.1.0.pre.40'
5
+ VERSION = '0.1.0.pre.43'
6
6
  end
7
7
  end
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
 
40
40
  spec.add_dependency 'confidante', '>= 0.27'
41
41
  spec.add_dependency 'rspec', '>= 3.0'
42
- spec.add_dependency 'ruby-terraform', '1.7.0.pre.16'
42
+ spec.add_dependency 'ruby-terraform', '1.7.0.pre.17'
43
43
 
44
44
  spec.add_development_dependency 'bundler'
45
45
  spec.add_development_dependency 'faker'
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.40
4
+ version: 0.1.0.pre.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfraBlocks Maintainers
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 1.7.0.pre.16
47
+ version: 1.7.0.pre.17
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.7.0.pre.16
54
+ version: 1.7.0.pre.17
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement