Class: RubyTerraform::Commands::Base
- Inherits:
-
Object
- Object
- RubyTerraform::Commands::Base
show all
- Defined in:
- lib/ruby_terraform/commands/base.rb
Direct Known Subclasses
Apply, Destroy, Get, Init, Output, Plan, Refresh, RemoteConfig, Show, Validate, Workspace
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(binary: nil, logger: nil, stdin: nil, stdout: nil, stderr: nil) ⇒ Base
Returns a new instance of Base.
Instance Attribute Details
#binary ⇒ Object
Returns the value of attribute binary.
6
7
8
|
# File 'lib/ruby_terraform/commands/base.rb', line 6
def binary
@binary
end
|
Instance Method Details
53
54
|
# File 'lib/ruby_terraform/commands/base.rb', line 53
def configure_command(builder, opts)
end
|
#do_after(opts) ⇒ Object
56
57
|
# File 'lib/ruby_terraform/commands/base.rb', line 56
def do_after(opts)
end
|
#do_before(opts) ⇒ Object
50
51
|
# File 'lib/ruby_terraform/commands/base.rb', line 50
def do_before(opts)
end
|
#execute(opts = {}) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/ruby_terraform/commands/base.rb', line 28
def execute(opts = {})
builder = instantiate_builder
do_before(opts)
command = configure_command(builder, opts)
.build
@logger.debug "Running #{command.to_s}"
command.execute(
stdin: stdin,
stdout: stdout,
stderr: stderr
)
do_after(opts)
end
|
#instantiate_builder ⇒ Object
44
45
46
47
48
|
# File 'lib/ruby_terraform/commands/base.rb', line 44
def instantiate_builder
Lino::CommandLineBuilder
.for_command(binary)
.with_option_separator('=')
end
|
#stderr ⇒ Object
24
25
26
|
# File 'lib/ruby_terraform/commands/base.rb', line 24
def stderr
@stderr
end
|
#stdin ⇒ Object
16
17
18
|
# File 'lib/ruby_terraform/commands/base.rb', line 16
def stdin
@stdin
end
|
#stdout ⇒ Object
20
21
22
|
# File 'lib/ruby_terraform/commands/base.rb', line 20
def stdout
@stdout
end
|