moab-versioning 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/moab/bagger.rb +4 -2
- data/lib/moab/file_inventory.rb +2 -1
- data/lib/moab/signature_catalog.rb +4 -1
- data/lib/moab/storage_object_version.rb +4 -1
- data/lib/moab/storage_repository.rb +16 -0
- data/lib/moab/storage_services.rb +7 -0
- data/lib/stanford/storage_services.rb +5 -3
- metadata +45 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 314bede5bec369d49b3173b4cb6ca49b67dad86c
|
4
|
+
data.tar.gz: 2efefdc7fa3a28b69e45778fd1a373be555d4a4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26daf2d5fa9f5a859676313a180ba5c73acb2e441b73cdfb6cdafc847e043521764e469512f364dead19fb0ea5d3d095f5e666d97f3362112ca08cb8b5d93685
|
7
|
+
data.tar.gz: 9638f3dcec4715d837abde7bc3c7f28713553692482b1ea3b93c3d654000bd6fb0cc6100af01266bc0aec94863c3f006ae9177117b4d3667af38accc67dd4925
|
data/lib/moab/bagger.rb
CHANGED
@@ -6,8 +6,10 @@ module Moab
|
|
6
6
|
# A class used to create a BagIt package from a version inventory and a set of source files.
|
7
7
|
# The {#fill_bag} method is called with a package_mode parameter that specifies
|
8
8
|
# whether the bag is being created for deposit into the repository or is to contain the output of a version reconstruction.
|
9
|
-
# * In <b>:depositor</b> mode, the version inventory is filtered using the digital object's signature catalog so that only
|
10
|
-
#
|
9
|
+
# * In <b>:depositor</b> mode, the version inventory is filtered using the digital object's signature catalog so that only
|
10
|
+
# new files are included
|
11
|
+
# * In <b>:reconstructor</b> mode, the version inventory and signature catalog are used together to regenerate the complete
|
12
|
+
# set of files for the version.
|
11
13
|
#
|
12
14
|
# ====Data Model
|
13
15
|
# * {StorageRepository} = represents a digital object repository storage node
|
data/lib/moab/file_inventory.rb
CHANGED
@@ -156,7 +156,8 @@ module Moab
|
|
156
156
|
end
|
157
157
|
|
158
158
|
# @api internal
|
159
|
-
# @return [String] Returns either the version ID (if inventory is a version manifest) or the name of the directory
|
159
|
+
# @return [String] Returns either the version ID (if inventory is a version manifest) or the name of the directory
|
160
|
+
# that was harvested to create the inventory
|
160
161
|
def data_source
|
161
162
|
data_source = (groups.collect { |g| g.data_source.to_s }).join('|')
|
162
163
|
if data_source.start_with?('contentMetadata')
|
@@ -118,7 +118,10 @@ module Moab
|
|
118
118
|
# @return [String] The object-relative path of the file having the specified signature
|
119
119
|
def catalog_filepath(file_signature)
|
120
120
|
catalog_entry = @signature_hash[file_signature]
|
121
|
-
|
121
|
+
if catalog_entry.nil?
|
122
|
+
msg = "catalog entry not found for #{file_signature.fixity.inspect} in #{@digital_object_id} - #{@version_id}"
|
123
|
+
raise FileNotFoundException, msg
|
124
|
+
end
|
122
125
|
catalog_entry.storage_path
|
123
126
|
end
|
124
127
|
|
@@ -73,7 +73,10 @@ module Moab
|
|
73
73
|
def find_filepath(file_category, file_id)
|
74
74
|
this_version_filepath = file_pathname(file_category, file_id)
|
75
75
|
return this_version_filepath if this_version_filepath.exist?
|
76
|
-
|
76
|
+
if file_category == 'manifest'
|
77
|
+
msg = "manifest file #{file_id} not found for #{@storage_object.digital_object_id} - #{@version_id}"
|
78
|
+
raise FileNotFoundException, msg
|
79
|
+
end
|
77
80
|
file_signature = file_inventory('version').file_signature(file_category, file_id)
|
78
81
|
catalog_filepath = signature_catalog.catalog_filepath(file_signature)
|
79
82
|
@storage_object.storage_filepath(catalog_filepath)
|
@@ -102,6 +102,22 @@ module Moab
|
|
102
102
|
storage_object
|
103
103
|
end
|
104
104
|
|
105
|
+
# @param object_id [String] The identifier of the digital object whose size is desired
|
106
|
+
# @param include_deposit [Boolean] specifies whether to look in deposit areas for objects in process of initial ingest
|
107
|
+
# @return [Integer] the size occupied on disk by the storage object, in bytes. this is the entire moab (all versions).
|
108
|
+
def object_size(object_id, include_deposit=false)
|
109
|
+
storage_pathname = find_storage_object(object_id, include_deposit).object_pathname
|
110
|
+
size = 0
|
111
|
+
Find.find(storage_pathname) do |path|
|
112
|
+
if FileTest.directory?(path)
|
113
|
+
Find.prune if File.basename(path)[0] == '.'
|
114
|
+
else
|
115
|
+
size += FileTest.size(path)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
size
|
119
|
+
end
|
120
|
+
|
105
121
|
# @param object_id [String] The identifier of the digital object whose version is desired
|
106
122
|
# @param create [Boolean] If true, the object home directory should be created if it does not exist
|
107
123
|
# @return [StorageObject] The representation of a digitial object's storage directory, which must exist.
|
@@ -45,6 +45,13 @@ module Moab
|
|
45
45
|
@@repository.find_storage_object(object_id, include_deposit)
|
46
46
|
end
|
47
47
|
|
48
|
+
# @param object_id [String] The identifier of the digital object whose size is desired
|
49
|
+
# @param include_deposit [Boolean] specifies whether to look in deposit areas for objects in process of initial ingest
|
50
|
+
# @return [Integer] the size occupied on disk by the storage object, in bytes. this is the entire moab (all versions).
|
51
|
+
def self.object_size(object_id, include_deposit=false)
|
52
|
+
@@repository.object_size(object_id, include_deposit)
|
53
|
+
end
|
54
|
+
|
48
55
|
# @param object_id [String] The identifier of the digital object whose version is desired
|
49
56
|
# @param create [Boolean] If true, the object home directory should be created if it does not exist
|
50
57
|
# @return [StorageObject] The representation of a digitial object's storage directory, which must exist.
|
@@ -9,8 +9,10 @@ module Stanford
|
|
9
9
|
@@repository = Stanford::StorageRepository.new
|
10
10
|
|
11
11
|
# @param new_content_metadata [String] The content metadata to be compared to the base
|
12
|
-
# @param object_id [String] The digital object identifier of the object whose version inventory is the basis of the
|
13
|
-
#
|
12
|
+
# @param object_id [String] The digital object identifier of the object whose version inventory is the basis of the
|
13
|
+
# comparison
|
14
|
+
# @param subset [String] Speciifes which subset of files to list in the inventories extracted from the
|
15
|
+
# contentMetadata (all|preserve|publish|shelve)
|
14
16
|
# @param base_version [Integer] The ID of the version whose inventory is the basis of, if nil use latest version
|
15
17
|
# @return [FileInventoryDifference] The report of differences between the content metadata and the specified version
|
16
18
|
def self.compare_cm_to_version(new_content_metadata, object_id, subset, base_version=nil)
|
@@ -63,4 +65,4 @@ module Stanford
|
|
63
65
|
|
64
66
|
end
|
65
67
|
|
66
|
-
end
|
68
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moab-versioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Weber
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2017-09-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: confstruct
|
@@ -153,6 +153,20 @@ dependencies:
|
|
153
153
|
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
|
+
- !ruby/object:Gem::Dependency
|
157
|
+
name: coveralls
|
158
|
+
requirement: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
type: :development
|
164
|
+
prerelease: false
|
165
|
+
version_requirements: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
156
170
|
- !ruby/object:Gem::Dependency
|
157
171
|
name: yard
|
158
172
|
requirement: !ruby/object:Gem::Requirement
|
@@ -181,6 +195,34 @@ dependencies:
|
|
181
195
|
- - ">="
|
182
196
|
- !ruby/object:Gem::Version
|
183
197
|
version: '0'
|
198
|
+
- !ruby/object:Gem::Dependency
|
199
|
+
name: rubocop
|
200
|
+
requirement: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - "~>"
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: 0.49.1
|
205
|
+
type: :development
|
206
|
+
prerelease: false
|
207
|
+
version_requirements: !ruby/object:Gem::Requirement
|
208
|
+
requirements:
|
209
|
+
- - "~>"
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: 0.49.1
|
212
|
+
- !ruby/object:Gem::Dependency
|
213
|
+
name: rubocop-rspec
|
214
|
+
requirement: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - "~>"
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: 1.16.0
|
219
|
+
type: :development
|
220
|
+
prerelease: false
|
221
|
+
version_requirements: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - "~>"
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: 1.16.0
|
184
226
|
description: Contains classes to process digital object version content and metadata
|
185
227
|
email:
|
186
228
|
- darren.weber@stanford.edu
|
@@ -245,10 +287,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
287
|
version: 1.3.6
|
246
288
|
requirements: []
|
247
289
|
rubyforge_project:
|
248
|
-
rubygems_version: 2.
|
290
|
+
rubygems_version: 2.5.1
|
249
291
|
signing_key:
|
250
292
|
specification_version: 4
|
251
293
|
summary: Ruby implementation of digital object versioning toolkit used by the SULAIR
|
252
294
|
Digital Library
|
253
295
|
test_files: []
|
254
|
-
has_rdoc:
|