Sha256: bc5064c91a71f2102faa96bc20551465cdf0751c12f935ecfe7f4afc2e1b091e

Contents?: true

Size: 585 Bytes

Versions: 3

Compression:

Stored size: 585 Bytes

Contents

require 'fileutils'

module RubyTerraform
  module Commands
    class Clean
      def initialize(directory: nil, logger: nil)
        @directory = directory ? directory : '.terraform'
        @logger = logger || RubyTerraform.configuration.logger
      end

      def execute(opts = {})
        directory = opts[:directory] || @directory
        @logger.info "Cleaning terraform directory '#{directory}'."
        FileUtils.rm_r(directory, :secure => true)
      rescue Errno::ENOENT => e
        @logger.error "Couldn't clean '#{directory}': #{e.message}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-terraform-0.39.0.pre.pre.1 lib/ruby_terraform/commands/clean.rb
ruby-terraform-0.38.0 lib/ruby_terraform/commands/clean.rb
ruby-terraform-0.37.0.pre.pre.1 lib/ruby_terraform/commands/clean.rb