moab-versioning 5.0.0 → 5.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/file_inventory_difference.rb +3 -3
- data/lib/moab/file_signature.rb +1 -1
- data/lib/moab/signature_catalog.rb +1 -1
- data/lib/moab/storage_object.rb +3 -2
- data/lib/moab/storage_object_version.rb +8 -7
- data/lib/moab/utc_time.rb +1 -3
- data/lib/moab/verification_result.rb +1 -1
- data/lib/serializer/serializable.rb +1 -1
- metadata +23 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e9810b925a8e475771162b8f367bea2555e1a9e663993040f84256d1897a1bc
|
4
|
+
data.tar.gz: b329ea89a3b4ba5705cb63a5201d35125772d2dc872942b0df7cf62fc3c260c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 399fdfdef956fbec356495e4346b7a4114c921bf84df1f24bb1595795d045c6ef2ad5618b148c53364375ef7178fd99ac1be57a9aac4c9a2e184334387031d57
|
7
|
+
data.tar.gz: 29610e9c9a72e57ca5340e5685d6582897bda53f79904bdeccc0bc62f485827eb72eff4afb86ca2258bce47052f56f204c8ec987b94bef55579002fa045caa3c
|
@@ -100,10 +100,10 @@ module Moab
|
|
100
100
|
# @param (see #compare)
|
101
101
|
# @return [String] Returns either the common digitial object ID, or a concatenation of both inventory's IDs
|
102
102
|
def common_object_id(basis_inventory, other_inventory)
|
103
|
-
if basis_inventory.digital_object_id
|
104
|
-
"#{basis_inventory.digital_object_id}|#{other_inventory.digital_object_id}"
|
105
|
-
else
|
103
|
+
if basis_inventory.digital_object_id == other_inventory.digital_object_id
|
106
104
|
basis_inventory.digital_object_id.to_s
|
105
|
+
else
|
106
|
+
"#{basis_inventory.digital_object_id}|#{other_inventory.digital_object_id}"
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
data/lib/moab/file_signature.rb
CHANGED
@@ -77,7 +77,7 @@ module Moab
|
|
77
77
|
def self.from_file(pathname, algos_to_use = active_algos)
|
78
78
|
raise(MoabRuntimeError, 'Unrecognized algorithm requested') unless algos_to_use.all? { |a| KNOWN_ALGOS.include?(a) }
|
79
79
|
|
80
|
-
signatures = algos_to_use.
|
80
|
+
signatures = algos_to_use.to_h { |k| [k, KNOWN_ALGOS[k].call] }
|
81
81
|
|
82
82
|
pathname.open("r") do |stream|
|
83
83
|
while (buffer = stream.read(8192))
|
@@ -84,7 +84,7 @@ module Moab
|
|
84
84
|
|
85
85
|
def block_count
|
86
86
|
block_size = 1024
|
87
|
-
entries.inject(0) { |sum, entry| sum + (entry.signature.size.to_i + block_size - 1) / block_size }
|
87
|
+
entries.inject(0) { |sum, entry| sum + ((entry.signature.size.to_i + block_size - 1) / block_size) }
|
88
88
|
end
|
89
89
|
|
90
90
|
# @return [Array<String>] The data fields to include in summary reports
|
data/lib/moab/storage_object.rb
CHANGED
@@ -57,9 +57,10 @@ module Moab
|
|
57
57
|
|
58
58
|
# @api external
|
59
59
|
# @param bag_dir [Pathname,String] The location of the bag to be ingested
|
60
|
+
# @param use_links [Boolean] If true, use hard links; if false, make copies
|
60
61
|
# @return [void] Ingest a new object version contained in a bag into this objects storage area
|
61
62
|
# @example {include:file:spec/features/storage/ingest_spec.rb}
|
62
|
-
def ingest_bag(bag_dir = deposit_bag_pathname)
|
63
|
+
def ingest_bag(bag_dir = deposit_bag_pathname, use_links: true)
|
63
64
|
bag_dir = Pathname(bag_dir)
|
64
65
|
current_version = StorageObjectVersion.new(self, current_version_id)
|
65
66
|
current_inventory = current_version.file_inventory('version')
|
@@ -70,7 +71,7 @@ module Moab
|
|
70
71
|
new_inventory = versionize_bag(bag_dir, current_version, new_version)
|
71
72
|
end
|
72
73
|
validate_new_inventory(new_inventory)
|
73
|
-
new_version.ingest_bag_data(bag_dir)
|
74
|
+
new_version.ingest_bag_data(bag_dir, use_links: use_links)
|
74
75
|
new_version.update_catalog(current_version.signature_catalog, new_inventory)
|
75
76
|
new_version.generate_differences_report(current_inventory, new_inventory)
|
76
77
|
new_version.generate_manifest_inventory
|
@@ -137,15 +137,16 @@ module Moab
|
|
137
137
|
|
138
138
|
# @api internal
|
139
139
|
# @param bag_dir [Pathname,String] The location of the bag to be ingested
|
140
|
+
# @param use_links [Boolean] If true, use hard links; if false, make copies
|
140
141
|
# @return [void] Create the version subdirectory and move files into it
|
141
|
-
def ingest_bag_data(bag_dir)
|
142
|
+
def ingest_bag_data(bag_dir, use_links: true)
|
142
143
|
raise(MoabRuntimeError, "Version already exists: #{@version_pathname}") if @version_pathname.exist?
|
143
144
|
|
144
145
|
@version_pathname.join('manifests').mkpath
|
145
146
|
bag_dir = Pathname(bag_dir)
|
146
|
-
ingest_dir(bag_dir.join('data'), @version_pathname.join('data'))
|
147
|
-
ingest_file(bag_dir.join(FileInventory.xml_filename('version')), @version_pathname.join('manifests'))
|
148
|
-
ingest_file(bag_dir.join(FileInventory.xml_filename('additions')), @version_pathname.join('manifests'))
|
147
|
+
ingest_dir(bag_dir.join('data'), @version_pathname.join('data'), use_links)
|
148
|
+
ingest_file(bag_dir.join(FileInventory.xml_filename('version')), @version_pathname.join('manifests'), use_links)
|
149
|
+
ingest_file(bag_dir.join(FileInventory.xml_filename('additions')), @version_pathname.join('manifests'), use_links)
|
149
150
|
end
|
150
151
|
|
151
152
|
# @api internal
|
@@ -286,10 +287,10 @@ module Moab
|
|
286
287
|
file.instances.each do |instance|
|
287
288
|
relative_path = File.join(group.group_id, instance.path)
|
288
289
|
catalog_entry = signature_catalog.signature_hash[file.signature]
|
289
|
-
if
|
290
|
-
found += 1
|
291
|
-
else
|
290
|
+
if catalog_entry.nil?
|
292
291
|
missing << relative_path.to_s
|
292
|
+
else
|
293
|
+
found += 1
|
293
294
|
end
|
294
295
|
end
|
295
296
|
end
|
data/lib/moab/utc_time.rb
CHANGED
@@ -66,7 +66,7 @@ module Moab
|
|
66
66
|
# @param level [Integer] Used to increment the depth of recursion
|
67
67
|
# @return [Hash] The verification result of subentities serialized to a hash
|
68
68
|
def subentities_to_hash(verbose, level)
|
69
|
-
subentities.
|
69
|
+
subentities.to_h { |s| [s.entity, s.to_hash(verbose, level + 1)] }
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moab-versioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Weber
|
8
8
|
- Richard Anderson
|
9
9
|
- Lynn McRae
|
10
10
|
- Hannah Frost
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2022-07-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: druid-tools
|
@@ -69,20 +69,6 @@ dependencies:
|
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
name: coveralls
|
74
|
-
requirement: !ruby/object:Gem::Requirement
|
75
|
-
requirements:
|
76
|
-
- - ">="
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: '0'
|
79
|
-
type: :development
|
80
|
-
prerelease: false
|
81
|
-
version_requirements: !ruby/object:Gem::Requirement
|
82
|
-
requirements:
|
83
|
-
- - ">="
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
72
|
- !ruby/object:Gem::Dependency
|
87
73
|
name: equivalent-xml
|
88
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,6 +153,20 @@ dependencies:
|
|
167
153
|
- - "~>"
|
168
154
|
- !ruby/object:Gem::Version
|
169
155
|
version: '2.1'
|
156
|
+
- !ruby/object:Gem::Dependency
|
157
|
+
name: simplecov
|
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'
|
170
170
|
description: Contains classes to process digital object version content and metadata
|
171
171
|
email:
|
172
172
|
- darren.weber@stanford.edu
|
@@ -208,8 +208,9 @@ files:
|
|
208
208
|
homepage: https://github.com/sul-dlss/moab-versioning
|
209
209
|
licenses:
|
210
210
|
- Apache-2.0
|
211
|
-
metadata:
|
212
|
-
|
211
|
+
metadata:
|
212
|
+
rubygems_mfa_required: 'true'
|
213
|
+
post_install_message:
|
213
214
|
rdoc_options: []
|
214
215
|
require_paths:
|
215
216
|
- lib
|
@@ -217,15 +218,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
217
218
|
requirements:
|
218
219
|
- - ">="
|
219
220
|
- !ruby/object:Gem::Version
|
220
|
-
version: '2.
|
221
|
+
version: '2.7'
|
221
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
223
|
requirements:
|
223
224
|
- - ">="
|
224
225
|
- !ruby/object:Gem::Version
|
225
226
|
version: '0'
|
226
227
|
requirements: []
|
227
|
-
rubygems_version: 3.
|
228
|
-
signing_key:
|
228
|
+
rubygems_version: 3.2.32
|
229
|
+
signing_key:
|
229
230
|
specification_version: 4
|
230
231
|
summary: Ruby implementation of digital object versioning toolkit used by the SULAIR
|
231
232
|
Digital Library
|