module ResourceClean

Constants

DELETE_FILES
VERSION

Public Class Methods

run(path) click to toggle source
# File lib/resource_clean.rb, line 20
def run(path)
  Find.find path do |entry|
    name = File.basename entry
    if DELETE_FILES.index {|item| item.casecmp(name) == 0 } || name =~ /^\._/
      FileUtils.remove_entry entry
      puts "Delete file: #{entry}"
    else
      xattr = Xattr.new entry
      list = xattr.list
      unless list.empty?
        list.each {|key| xattr.remove key }
        puts "Delete xattr: #{entry}\n  #{list}"
      end
    end
  end
end