moab-versioning 6.1.0 → 6.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ac9a723ffc977aa08ff80ac3222a5edac9007f34516b269e53323119a129646
4
- data.tar.gz: df5e62f7a0c6b1a328676063f08da78977465505bcafa933273f4964dab7f239
3
+ metadata.gz: 0fb403abc29dd5b88bd2a34f29717876e846ebf9cf90bc2129534794c499e472
4
+ data.tar.gz: ef320be8188580b0502e343b86bd0f39213e29aa53f8eeb25b0aa722b3273ace
5
5
  SHA512:
6
- metadata.gz: 188bdd57026ac1bcdc431ce8266927414dcb4b3539ddc8b0f733240adb888bbd564f3469d6346c8948af5fcf072fb3ebde5a0cc894d65539acddfe104522e43b
7
- data.tar.gz: c00a2aa7923f9138b34afd7d2a212dc0c9a9cd4b70a953217771fe46c4cbb2f6013d9ba4632e121a95c6238c1242fedfeba2ba8a4883775afab2558e86ad3fdd
6
+ metadata.gz: 381b7705b914b10714249571e0eca3ac4ac67496b3ee15995dc7c58dbbbfe92085c6b4bd17b386424c6d75889e4f3313b90a55fa20ea5293f733106d4ae1f510
7
+ data.tar.gz: f845dab613e3addc79f5b9e34270a40174b95fbe6435dc0013cedfeb1ad6bebcf3390c9f5077d1063a58e3281b0a2330f68ba9d8a63a9624f8c0b55e4b86a379
data/lib/moab/bagger.rb CHANGED
@@ -67,14 +67,7 @@ module Moab
67
67
  # @return [NilClass] Delete the bagit files
68
68
  def delete_bag
69
69
  # make sure this looks like a bag before deleting
70
- if bag_pathname.join('bagit.txt').exist?
71
- if bag_pathname.join('data').exist?
72
- bag_pathname.rmtree
73
- else
74
- bag_pathname.children.each(&:delete)
75
- bag_pathname.rmdir
76
- end
77
- end
70
+ bag_pathname.rmtree if bag_pathname.join('bagit.txt').exist?
78
71
  nil
79
72
  end
80
73
 
data/lib/moab/config.rb CHANGED
@@ -8,8 +8,8 @@ module Moab
8
8
  @checksum_algos = [:md5, :sha1, :sha256]
9
9
  end
10
10
 
11
- def configure(&block)
12
- instance_eval(&block)
11
+ def configure(...)
12
+ instance_eval(...)
13
13
  end
14
14
 
15
15
  def storage_roots(new_value = nil)
@@ -38,7 +38,7 @@ module Moab
38
38
 
39
39
  # @attribute
40
40
  # @return [Integer] The total number of data files (dynamically calculated)
41
- attribute :file_count, Integer, tag: 'fileCount', on_save: proc { |i| i.to_s }
41
+ attribute :file_count, Integer, tag: 'fileCount', on_save: proc(&:to_s)
42
42
 
43
43
  def file_count
44
44
  files.inject(0) { |sum, manifestation| sum + manifestation.file_count }
@@ -46,7 +46,7 @@ module Moab
46
46
 
47
47
  # @attribute
48
48
  # @return [Integer] The total size (in bytes) of all data files (dynamically calculated)
49
- attribute :byte_count, Integer, tag: 'byteCount', on_save: proc { |i| i.to_s }
49
+ attribute :byte_count, Integer, tag: 'byteCount', on_save: proc(&:to_s)
50
50
 
51
51
  def byte_count
52
52
  files.inject(0) { |sum, manifestation| sum + manifestation.byte_count }
@@ -54,7 +54,7 @@ module Moab
54
54
 
55
55
  # @attribute
56
56
  # @return [Integer] The total disk usage (in 1 kB blocks) of all data files (estimating du -k result) (dynamically calculated)
57
- attribute :block_count, Integer, tag: 'blockCount', on_save: proc { |i| i.to_s }
57
+ attribute :block_count, Integer, tag: 'blockCount', on_save: proc(&:to_s)
58
58
 
59
59
  def block_count
60
60
  files.inject(0) { |sum, manifestation| sum + manifestation.block_count }
@@ -64,7 +64,7 @@ module Moab
64
64
  # @attribute
65
65
  # @return [Integer] the total number of differences found between the two inventories that were
66
66
  # compared (dynamically calculated)
67
- attribute :difference_count, Integer, tag: 'differenceCount', on_save: proc { |i| i.to_s }
67
+ attribute :difference_count, Integer, tag: 'differenceCount', on_save: proc(&:to_s)
68
68
 
69
69
  def difference_count
70
70
  count = 0
@@ -76,49 +76,49 @@ module Moab
76
76
 
77
77
  # @attribute
78
78
  # @return [Integer] How many files were unchanged
79
- attribute :identical, Integer, on_save: proc { |n| n.to_s }
79
+ attribute :identical, Integer, on_save: proc(&:to_s)
80
80
  def identical
81
81
  subset_hash[:identical].count
82
82
  end
83
83
 
84
84
  # @attribute
85
85
  # @return [Integer] How many duplicate copies of files were added
86
- attribute :copyadded, Integer, on_save: proc { |n| n.to_s }
86
+ attribute :copyadded, Integer, on_save: proc(&:to_s)
87
87
  def copyadded
88
88
  subset_hash[:copyadded].count
89
89
  end
90
90
 
91
91
  # @attribute
92
92
  # @return [Integer] How many duplicate copies of files were deleted
93
- attribute :copydeleted, Integer, on_save: proc { |n| n.to_s }
93
+ attribute :copydeleted, Integer, on_save: proc(&:to_s)
94
94
  def copydeleted
95
95
  subset_hash[:copydeleted].count
96
96
  end
97
97
 
98
98
  # @attribute
99
99
  # @return [Integer] How many files were renamed
100
- attribute :renamed, Integer, on_save: proc { |n| n.to_s }
100
+ attribute :renamed, Integer, on_save: proc(&:to_s)
101
101
  def renamed
102
102
  subset_hash[:renamed].count
103
103
  end
104
104
 
105
105
  # @attribute
106
106
  # @return [Integer] How many files were modified
107
- attribute :modified, Integer, on_save: proc { |n| n.to_s }
107
+ attribute :modified, Integer, on_save: proc(&:to_s)
108
108
  def modified
109
109
  subset_hash[:modified].count
110
110
  end
111
111
 
112
112
  # @attribute
113
113
  # @return [Integer] How many files were added
114
- attribute :added, Integer, on_save: proc { |n| n.to_s }
114
+ attribute :added, Integer, on_save: proc(&:to_s)
115
115
  def added
116
116
  subset_hash[:added].count
117
117
  end
118
118
 
119
119
  # @attribute
120
120
  # @return [Integer] How many files were deleted
121
- attribute :deleted, Integer, on_save: proc { |n| n.to_s }
121
+ attribute :deleted, Integer, on_save: proc(&:to_s)
122
122
  def deleted
123
123
  subset_hash[:deleted].count
124
124
  end
@@ -256,7 +256,7 @@ module Moab
256
256
  basis_only_paths = basis_paths - other_paths
257
257
  other_only_paths = other_paths - basis_paths
258
258
  maxsize = [basis_only_paths.size, other_only_paths.size].max
259
- (0..maxsize - 1).each do |n|
259
+ (0..maxsize - 1).each do |n| # rubocop:disable Lint/AmbiguousRange
260
260
  fid = FileInstanceDifference.new
261
261
  fid.basis_path = basis_only_paths[n]
262
262
  fid.other_path = other_only_paths[n]
@@ -30,7 +30,7 @@ module Moab
30
30
 
31
31
  # @attribute
32
32
  # @return [Integer] How many files were changed
33
- attribute :count, Integer, on_save: proc { |n| n.to_s }
33
+ attribute :count, Integer, on_save: proc(&:to_s)
34
34
 
35
35
  def count
36
36
  files.size
@@ -38,11 +38,11 @@ module Moab
38
38
 
39
39
  # @attribute
40
40
  # @return [String] The file's path in the basis inventory (usually for an old version)
41
- attribute :basis_path, String, tag: 'basisPath', on_save: proc { |s| s.to_s }
41
+ attribute :basis_path, String, tag: 'basisPath', on_save: proc(&:to_s)
42
42
 
43
43
  # @attribute
44
44
  # @return [String] The file's path in the other inventory (usually for an new version) compared against the basis
45
- attribute :other_path, String, tag: 'otherPath', on_save: proc { |s| s.to_s }
45
+ attribute :other_path, String, tag: 'otherPath', on_save: proc(&:to_s)
46
46
 
47
47
  # @attribute
48
48
  # @return [Array<FileSignature>] The fixity data of the file manifestation(s) (plural if change was a content modification)
@@ -50,7 +50,7 @@ module Moab
50
50
 
51
51
  # @attribute
52
52
  # @return [Integer] The ordinal version number
53
- attribute :version_id, Integer, tag: 'versionId', key: true, on_save: proc { |n| n.to_s }
53
+ attribute :version_id, Integer, tag: 'versionId', key: true, on_save: proc(&:to_s)
54
54
 
55
55
  # @return [String] The unique identifier concatenating digital object id with version id
56
56
  def composite_key
@@ -71,7 +71,7 @@ module Moab
71
71
 
72
72
  # @attribute
73
73
  # @return [Integer] The total number of data files in the inventory (dynamically calculated)
74
- attribute :file_count, Integer, tag: 'fileCount', on_save: proc { |t| t.to_s }
74
+ attribute :file_count, Integer, tag: 'fileCount', on_save: proc(&:to_s)
75
75
 
76
76
  def file_count
77
77
  groups.inject(0) { |sum, group| sum + group.file_count }
@@ -79,7 +79,7 @@ module Moab
79
79
 
80
80
  # @attribute
81
81
  # @return [Integer] The total size (in bytes) in all files of all files in the inventory (dynamically calculated)
82
- attribute :byte_count, Integer, tag: 'byteCount', on_save: proc { |t| t.to_s }
82
+ attribute :byte_count, Integer, tag: 'byteCount', on_save: proc(&:to_s)
83
83
 
84
84
  def byte_count
85
85
  groups.inject(0) { |sum, group| sum + group.byte_count }
@@ -87,7 +87,7 @@ module Moab
87
87
 
88
88
  # @attribute
89
89
  # @return [Integer] The total disk usage (in 1 kB blocks) of all data files (estimating du -k result) (dynamically calculated)
90
- attribute :block_count, Integer, tag: 'blockCount', on_save: proc { |t| t.to_s }
90
+ attribute :block_count, Integer, tag: 'blockCount', on_save: proc(&:to_s)
91
91
 
92
92
  def block_count
93
93
  groups.inject(0) { |sum, group| sum + group.block_count }
@@ -34,7 +34,7 @@ module Moab
34
34
 
35
35
  # @attribute
36
36
  # @return [Integer] the number of differences found between the two inventories that were compared (dynamically calculated)
37
- attribute :difference_count, Integer, tag: 'differenceCount', on_save: proc { |i| i.to_s }
37
+ attribute :difference_count, Integer, tag: 'differenceCount', on_save: proc(&:to_s)
38
38
 
39
39
  def difference_count
40
40
  @group_differences.inject(0) { |sum, group| sum + group.difference_count }
@@ -46,19 +46,19 @@ module Moab
46
46
 
47
47
  # @attribute
48
48
  # @return [String] The size of the file in bytes (can be empty)
49
- attribute :size, Integer, on_save: proc { |n| n.to_s }
49
+ attribute :size, Integer, on_save: proc(&:to_s)
50
50
 
51
51
  # @attribute
52
52
  # @return [String] The MD5 checksum value of the file (can be empty)
53
- attribute :md5, String, on_save: proc { |n| n.to_s }
53
+ attribute :md5, String, on_save: proc(&:to_s)
54
54
 
55
55
  # @attribute
56
56
  # @return [String] The SHA1 checksum value of the file (can be empty)
57
- attribute :sha1, String, on_save: proc { |n| n.to_s }
57
+ attribute :sha1, String, on_save: proc(&:to_s)
58
58
 
59
59
  # @attribute
60
60
  # @return [String] The SHA256 checksum value of the file (can be empty)
61
- attribute :sha256, String, on_save: proc { |n| n.to_s }
61
+ attribute :sha256, String, on_save: proc(&:to_s)
62
62
 
63
63
  KNOWN_ALGOS = {
64
64
  md5: proc { Digest::MD5.new },
@@ -43,7 +43,7 @@ module Moab
43
43
 
44
44
  # @attribute
45
45
  # @return [Integer] The ordinal version number
46
- attribute :version_id, Integer, tag: 'versionId', key: true, on_save: proc { |n| n.to_s }
46
+ attribute :version_id, Integer, tag: 'versionId', key: true, on_save: proc(&:to_s)
47
47
 
48
48
  # @return [String] The unique identifier concatenating digital object id with version id
49
49
  def composite_key
@@ -64,7 +64,7 @@ module Moab
64
64
 
65
65
  # @attribute
66
66
  # @return [Integer] The total number of data files (dynamically calculated)
67
- attribute :file_count, Integer, tag: 'fileCount', on_save: proc { |t| t.to_s }
67
+ attribute :file_count, Integer, tag: 'fileCount', on_save: proc(&:to_s)
68
68
 
69
69
  def file_count
70
70
  entries.size
@@ -72,7 +72,7 @@ module Moab
72
72
 
73
73
  # @attribute
74
74
  # @return [Integer] The total size (in bytes) of all data files (dynamically calculated)
75
- attribute :byte_count, Integer, tag: 'byteCount', on_save: proc { |t| t.to_s }
75
+ attribute :byte_count, Integer, tag: 'byteCount', on_save: proc(&:to_s)
76
76
 
77
77
  def byte_count
78
78
  entries.inject(0) { |sum, entry| sum + entry.signature.size.to_i }
@@ -80,7 +80,7 @@ module Moab
80
80
 
81
81
  # @attribute
82
82
  # @return [Integer] The total disk usage (in 1 kB blocks) of all data files (estimating du -k result) (dynamically calculated)
83
- attribute :block_count, Integer, tag: 'blockCount', on_save: proc { |t| t.to_s }
83
+ attribute :block_count, Integer, tag: 'blockCount', on_save: proc(&:to_s)
84
84
 
85
85
  def block_count
86
86
  block_size = 1024
@@ -25,7 +25,7 @@ module Moab
25
25
 
26
26
  # @attribute
27
27
  # @return [Integer] The ordinal version number
28
- attribute :version_id, Integer, tag: 'originalVersion', key: true, on_save: proc { |n| n.to_s }
28
+ attribute :version_id, Integer, tag: 'originalVersion', key: true, on_save: proc(&:to_s)
29
29
 
30
30
  # @attribute
31
31
  # @return [String] The name of the file group
@@ -31,7 +31,7 @@ module Moab
31
31
  # @return [VerificationResult] The result of comparing the expected and found values
32
32
  def self.verify_value(entity, expected, found)
33
33
  details = { 'expected' => expected, 'found' => found }
34
- new(entity, (expected == found), details)
34
+ new(entity, (expected == found), details) # rubocop:disable Style/RedundantParentheses
35
35
  end
36
36
 
37
37
  # @deprecated Just use the constructor
@@ -24,7 +24,7 @@ module Moab
24
24
 
25
25
  # @attribute
26
26
  # @return [Integer] The object version number (A sequential integer)
27
- attribute :version_id, Integer, tag: 'versionId', key: true, on_save: proc { |n| n.to_s }
27
+ attribute :version_id, Integer, tag: 'versionId', key: true, on_save: proc(&:to_s)
28
28
 
29
29
  # @attribute
30
30
  # @return [String] "an external version label that increments the most significant digit for major revisions,
@@ -19,6 +19,10 @@ module Stanford
19
19
  @@repository
20
20
  end
21
21
 
22
+ # NOTE: `ShelvingService.content_diff` in dor-services-app implements similar logic, but in a way that
23
+ # uses XML retrieved via preservation-client instead of reading the XML from disk. This allows DSA to
24
+ # perform the potentially time expensive diff without requiring access to preservation disk mounts.
25
+ # See https://github.com/sul-dlss/dor-services-app/pull/4492 and https://github.com/sul-dlss/dor-services-app/issues/4359
22
26
  # @param new_content_metadata [String] The content metadata to be compared to the base
23
27
  # @param object_id [String] The digital object identifier of the object whose version inventory is the basis of the
24
28
  # comparison
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: 6.1.0
4
+ version: 6.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay
@@ -9,10 +9,9 @@ authors:
9
9
  - Tony Zanella
10
10
  - Mike Giarlo
11
11
  - John Martin
12
- autorequire:
13
12
  bindir: bin
14
13
  cert_chain: []
15
- date: 2023-02-03 00:00:00.000000000 Z
14
+ date: 2025-07-09 00:00:00.000000000 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: druid-tools
@@ -144,16 +143,16 @@ dependencies:
144
143
  name: rubocop-rspec
145
144
  requirement: !ruby/object:Gem::Requirement
146
145
  requirements:
147
- - - "~>"
146
+ - - ">="
148
147
  - !ruby/object:Gem::Version
149
- version: '2.1'
148
+ version: '0'
150
149
  type: :development
151
150
  prerelease: false
152
151
  version_requirements: !ruby/object:Gem::Requirement
153
152
  requirements:
154
- - - "~>"
153
+ - - ">="
155
154
  - !ruby/object:Gem::Version
156
- version: '2.1'
155
+ version: '0'
157
156
  - !ruby/object:Gem::Dependency
158
157
  name: simplecov
159
158
  requirement: !ruby/object:Gem::Requirement
@@ -215,7 +214,6 @@ licenses:
215
214
  - Apache-2.0
216
215
  metadata:
217
216
  rubygems_mfa_required: 'true'
218
- post_install_message:
219
217
  rdoc_options: []
220
218
  require_paths:
221
219
  - lib
@@ -230,8 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
228
  - !ruby/object:Gem::Version
231
229
  version: '0'
232
230
  requirements: []
233
- rubygems_version: 3.3.7
234
- signing_key:
231
+ rubygems_version: 3.6.2
235
232
  specification_version: 4
236
233
  summary: Ruby implementation of digital object versioning toolkit used by Stanford
237
234
  University Libraries