module Maid::TrashMigration
Public Class Methods
correct_trash()
click to toggle source
# File lib/maid/trash_migration.rb, line 12 def correct_trash Maid.new.trash_path end
incorrect_trash()
click to toggle source
# File lib/maid/trash_migration.rb, line 8 def incorrect_trash File.expand_path('~/.Trash') + '/' end
needed?()
click to toggle source
# File lib/maid/trash_migration.rb, line 16 def needed? Platform.linux? && File.directory?(incorrect_trash) && !ENV['MAID_NO_MIGRATE_TRASH'] end
perform()
click to toggle source
# File lib/maid/trash_migration.rb, line 22 def perform maid = ::Maid::Maid.new(:trash_path => correct_trash) # Use local variable so it's available in the closure used by `instance_eval` path = incorrect_trash # Might as well use Maid itself for this :) maid.instance_eval do rule 'Migrate Linux trash to correct path' do trash(dir("#{ path }/*")) trash(path) end end maid.clean end