Class: DeleteDerivedData::Delete

Inherits:
Object
  • Object
show all
Defined in:
lib/delete_derived_data/delete.rb

Class Method Summary collapse

Class Method Details

.run(paths, options) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/delete_derived_data/delete.rb', line 12

def self.run(paths, options)
  if paths == nil || paths.length <= 0
    puts "No Data to be cleaning!"
    return nil
  end

  paths.each {|d| Trash.move_to_trash(d)}

  prompt = TTY::Prompt.new(enable_color: false, interrupt: :signal)
  answer = options[:trash] || prompt.yes?("Are you sure you want to empty the trash (this cannot be undone)?")
  return if !answer

  if options[:sempty]
    Trash.empty_securely_trash()
  else
    Trash.empty_trash()
  end
end