Class: Dor::CleanupService

Inherits:
Object
  • Object
show all
Defined in:
lib/dor/cleanup_service.rb

Class Method Summary collapse

Class Method Details

.cleanup(dor_item) ⇒ Object

Delete all workspace and export entities for the druid

Parameters:

  • (LyberCore::Robots::WorkItem)


13
14
15
16
17
18
19
20
21
# File 'lib/dor/cleanup_service.rb', line 13

def self.cleanup(dor_item)
  druid = dor_item.pid
  workspace_dir = Druid.new(druid).path(Config.cleanup.local_workspace_root)
  self.remove_entry(workspace_dir)
  bag_dir = File.join(Config.cleanup.local_export_home, druid)
  self.remove_entry(bag_dir)
  tarfile = "#{bag_dir}.tar"
  self.remove_entry(tarfile)
end

.remove_entry(entry) ⇒ Object

Deleta a filesystem entry

Parameters:

  • (String)


25
26
27
# File 'lib/dor/cleanup_service.rb', line 25

def self.remove_entry(entry)
  FileUtils.remove_entry(entry) if File.exist?(entry)
end