Sha256: cee349f57510b23b36da175f4d290e7e0ddc5e83b60cb491c2f5ce19f7638270
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require 'lino' module RubyTerraform module Commands class Base attr_reader :binary def initialize(binary: nil, logger: nil, stdin: nil, stdout: nil, stderr: nil) @binary = binary || RubyTerraform.configuration.binary @logger = logger || RubyTerraform.configuration.logger @stdin = stdin || RubyTerraform.configuration.stdin @stdout = stdout || RubyTerraform.configuration.stdout @stderr = stderr || RubyTerraform.configuration.stderr end def stdin @stdin end def stdout @stdout end def stderr @stderr end 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) rescue Open4::SpawnError @logger.error "Terraform has failed while running '#{command_name}'." end def instantiate_builder Lino::CommandLineBuilder .for_command(binary) .with_option_separator('=') end def do_before(opts) end def configure_command(builder, opts) end def do_after(opts) end def command_name self.class.to_s.split("::")[-1].downcase end protected :command_name end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-terraform-0.39.0.pre.pre.1 | lib/ruby_terraform/commands/base.rb |