Class: Koch::DeleteDirectory

Inherits:
Resource show all
Defined in:
lib/koch/delete_directory.rb

Overview

Deletes a directory if it exists

Instance Attribute Summary

Attributes inherited from Resource

#changed, #name

Instance Method Summary collapse

Methods inherited from Resource

dsl_writer, #initialize

Constructor Details

This class inherits a constructor from Koch::Resource

Instance Method Details

#apply!Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/koch/delete_directory.rb', line 8

def apply!
  unless Dir.exist? name
    debug "Not deleting directory #{name}, it does not exist"
    return
  end

  @changed = true
  maybe("Delete directory #{name}") do
    FileUtils.remove_entry_secure name
  end
end