Class: Koch::DeleteFile

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

Overview

Deletes a file 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



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/koch/delete_file.rb', line 6

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

  @changed = true
  maybe("Delete file #{name}") do
    File.delete name
  end
end