Sha256: d52da9b371b4968aee2c88cfa2ff630a6f530f880c0d07ce7d1083ea3effc6fa

Contents?: true

Size: 1.18 KB

Versions: 39

Compression:

Stored size: 1.18 KB

Contents

require 'lino'
require_relative 'base'

module RubyTerraform
  module Commands
    class Destroy < Base
      def configure_command(builder, opts)
        directory = opts[:directory]
        vars = opts[:vars] || {}
        var_file = opts[:var_file]
        var_files = opts[:var_files] || []
        state = opts[:state]
        force = opts[:force]
        no_backup = opts[:no_backup]
        backup = no_backup ? '-' : opts[:backup]
        no_color = opts[:no_color]

        builder
            .with_subcommand('destroy') do |sub|
              vars.each do |key, value|
                sub = sub.with_option('-var', "'#{key}=#{value}'", separator: ' ')
              end
              sub = sub.with_option('-var-file', var_file) if var_file
              var_files.each do |file|
                sub = sub.with_option('-var-file', file)
              end
              sub = sub.with_option('-state', state) if state
              sub = sub.with_option('-backup', backup) if backup
              sub = sub.with_flag('-no-color') if no_color
              sub = sub.with_flag('-force') if force
              sub
            end
            .with_argument(directory)
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
ruby-terraform-0.15.1.pre2 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.15.1.pre1 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.15.0 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.14.1.pre1 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre42 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre41 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre40 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.14.0 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre39 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre38 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre37 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre36 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre35 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre34 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre33 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre32 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.2.pre31 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.1 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.13.0 lib/ruby_terraform/commands/destroy.rb