Sha256: aa89c9c0a69ba39f41101e19488c410f004c4762a18771e87d14518acba6e128

Contents?: true

Size: 913 Bytes

Versions: 34

Compression:

Stored size: 913 Bytes

Contents

require 'lino'

module RubyTerraform
  module Commands
    class Base
      attr_reader :binary

      def initialize(binary: nil)
        @binary = binary || RubyTerraform.configuration.binary
      end

      def stdin
        ''
      end

      def stdout
        $stdout
      end

      def stderr
        $stderr
      end

      def execute(opts = {})
        builder = instantiate_builder

        do_before(opts)
        configure_command(builder, opts)
          .build
          .execute(
              stdin: stdin,
              stdout: stdout,
              stderr: stderr)
        do_after(opts)
      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
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
ruby-terraform-0.13.2.pre40 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.14.0 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.2.pre39 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.2.pre38 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.2.pre37 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.2.pre36 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.2.pre35 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.2.pre34 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.2.pre33 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.2.pre32 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.2.pre31 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.1 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.13.0 lib/ruby_terraform/commands/base.rb
ruby-terraform-0.12.1 lib/ruby_terraform/commands/base.rb