Class: Dor::ShelvingService
- Inherits:
-
Object
- Object
- Dor::ShelvingService
- Defined in:
- lib/dor/services/shelving_service.rb
Overview
Push file changes for shelve-able files into the stacks
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(work) ⇒ ShelvingService
constructor
A new instance of ShelvingService.
- #shelve ⇒ Object
Constructor Details
#initialize(work) ⇒ ShelvingService
Returns a new instance of ShelvingService.
10 11 12 |
# File 'lib/dor/services/shelving_service.rb', line 10 def initialize(work) @work = work end |
Class Method Details
.shelve(work) ⇒ Object
6 7 8 |
# File 'lib/dor/services/shelving_service.rb', line 6 def self.shelve(work) new(work).shelve end |
Instance Method Details
#shelve ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dor/services/shelving_service.rb', line 14 def shelve # retrieve the differences between the current contentMetadata and the previously ingested version diff = shelve_diff stacks_object_pathname = stacks_location # determine the location of the object's files in the stacks area stacks_druid = DruidTools::StacksDruid.new work.id, stacks_object_pathname stacks_object_pathname = Pathname(stacks_druid.path) # determine the location of the object's content files in the workspace area workspace_druid = DruidTools::Druid.new(work.id, Config.stacks.local_workspace_root) workspace_content_pathname = workspace_content_dir(diff, workspace_druid) # delete, rename, or copy files to the stacks area DigitalStacksService.remove_from_stacks(stacks_object_pathname, diff) DigitalStacksService.rename_in_stacks(stacks_object_pathname, diff) DigitalStacksService.shelve_to_stacks(workspace_content_pathname, stacks_object_pathname, diff) end |