moab-versioning 4.4.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcb99d73bd625e8cbba0201f1dea7f6ae4925806df623e2a1e52198827f5b1c7
4
- data.tar.gz: cb53aea7e39eabf83f8f80e0d05b70fe4a73e4376e0a6e054fb912b1225460f1
3
+ metadata.gz: a921589cd50c4c0ae21c1a46321cc48c66fa9ed9c0add1dce9b2d7f3888cf362
4
+ data.tar.gz: 2d4e565dcab2a901c618641784fc3d83d65fa23ac47fddcd09352d13386a5faf
5
5
  SHA512:
6
- metadata.gz: af674dbff0e829b11da52850800fd2b3365e4ebc27d6629cefe7a71de0961bab884e7fb406be515a93a6387e48c5eb90a170144177fef9655331b9517732c298
7
- data.tar.gz: d858888aad9e8557b33471f02c600e94217eba5ac213f27469fd7cc745f79752c9699e53c58d007f9c6fd39202d17f5e14da1a5761994309b2e5047ca76e0731
6
+ metadata.gz: 0f77277e725f7a3ac543e2d14b06721658c02808067bce87e0e314e7544537d9c20064de4a8febcbe495131655661ae4fa59fcb418dc5d992df00750cd7a5d85
7
+ data.tar.gz: 7e223db6e02a215899ebee8a8aa805282dd333c12038cff2431539d50f07d10608b40edb7046e3eedf3b066e66905cd5a4cd521fdab28f8ce2904899db3357bb
data/lib/moab/bagger.rb CHANGED
@@ -169,7 +169,7 @@ module Moab
169
169
  file.instances.each do |instance|
170
170
  target = target_dir.join(instance.path)
171
171
  target.parent.mkpath
172
- FileUtils.symlink source, target
172
+ FileUtils.symlink source, target unless target.exist?
173
173
  end
174
174
  end
175
175
  true
@@ -2,10 +2,14 @@
2
2
 
3
3
  module Moab
4
4
  class MoabRuntimeError < RuntimeError; end
5
+
5
6
  class MoabStandardError < StandardError; end
6
7
 
7
8
  class FileNotFoundException < MoabRuntimeError; end
9
+
8
10
  class InvalidMetadataException < MoabRuntimeError; end
11
+
9
12
  class InvalidSuriSyntaxError < MoabRuntimeError; end
13
+
10
14
  class ObjectNotFoundException < MoabRuntimeError; end
11
15
  end
@@ -30,15 +30,15 @@ module Moab
30
30
 
31
31
  # @attribute
32
32
  # @return [String] The name of the file group
33
- attribute :group_id, String, :tag => 'groupId', :key => true
33
+ attribute :group_id, String, tag: 'groupId', key: true
34
34
 
35
35
  # @attribute
36
36
  # @return [String] The directory location or other source of this groups file data
37
- attribute :data_source, String, :tag => 'dataSource'
37
+ attribute :data_source, String, tag: 'dataSource'
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 { |i| i.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 { |i| i.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 { |i| i.to_s }
58
58
 
59
59
  def block_count
60
60
  files.inject(0) { |sum, manifestation| sum + manifestation.block_count }
@@ -67,7 +67,7 @@ module Moab
67
67
 
68
68
  # @attribute
69
69
  # @return [Array<FileManifestation>] The set of files comprising the group
70
- has_many :files, FileManifestation, :tag => 'file'
70
+ has_many :files, FileManifestation, tag: 'file'
71
71
 
72
72
  def files
73
73
  signature_hash.values
@@ -53,18 +53,18 @@ module Moab
53
53
 
54
54
  # (see Serializable#initialize)
55
55
  def initialize(opts = {})
56
- @subset_hash = Hash.new { |hash, key| hash[key] = FileGroupDifferenceSubset.new(:change => key.to_s) }
56
+ @subset_hash = Hash.new { |hash, key| hash[key] = FileGroupDifferenceSubset.new(change: key.to_s) }
57
57
  super(opts)
58
58
  end
59
59
 
60
60
  # @attribute
61
61
  # @return [String] The name of the file group
62
- attribute :group_id, String, :tag => 'groupId', :key => true
62
+ attribute :group_id, String, tag: 'groupId', key: true
63
63
 
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 { |i| i.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 { |n| n.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 { |n| n.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 { |n| n.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 { |n| n.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 { |n| n.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 { |n| n.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 { |n| n.to_s }
122
122
  def deleted
123
123
  subset_hash[:deleted].count
124
124
  end
@@ -126,7 +126,7 @@ module Moab
126
126
  # @attribute
127
127
  # @return [Array<FileGroupDifferenceSubset>] A set of Arrays (one for each change type),
128
128
  # each of which contains an collection of file-level differences having that change type.
129
- has_many :subsets, FileGroupDifferenceSubset, :tag => 'subset'
129
+ has_many :subsets, FileGroupDifferenceSubset, tag: 'subset'
130
130
 
131
131
  def subsets
132
132
  subset_hash.values
@@ -147,14 +147,14 @@ module Moab
147
147
  # @return [FileGroupDifference] Clone just this element for inclusion in a versionMetadata structure
148
148
  def summary
149
149
  FileGroupDifference.new(
150
- :group_id => group_id,
151
- :identical => identical,
152
- :copyadded => copyadded,
153
- :copydeleted => copydeleted,
154
- :renamed => renamed,
155
- :modified => modified,
156
- :added => added,
157
- :deleted => deleted
150
+ group_id: group_id,
151
+ identical: identical,
152
+ copyadded: copyadded,
153
+ copydeleted: copydeleted,
154
+ renamed: renamed,
155
+ modified: modified,
156
+ added: added,
157
+ deleted: deleted
158
158
  )
159
159
  end
160
160
 
@@ -231,7 +231,7 @@ module Moab
231
231
  other_paths = other_signature_hash[signature].paths
232
232
  matching_paths = basis_paths & other_paths
233
233
  matching_paths.each do |path|
234
- fid = FileInstanceDifference.new(:change => 'identical')
234
+ fid = FileInstanceDifference.new(change: 'identical')
235
235
  fid.basis_path = path
236
236
  fid.other_path = "same"
237
237
  fid.signatures << signature
@@ -284,7 +284,7 @@ module Moab
284
284
  # Container for reporting the set of file-level differences of type 'modified'
285
285
  def tabulate_modified_files(basis_path_hash, other_path_hash)
286
286
  matching_keys(basis_path_hash, other_path_hash).each do |path|
287
- fid = FileInstanceDifference.new(:change => 'modified')
287
+ fid = FileInstanceDifference.new(change: 'modified')
288
288
  fid.basis_path = path
289
289
  fid.other_path = "same"
290
290
  fid.signatures << basis_path_hash[path]
@@ -303,7 +303,7 @@ module Moab
303
303
  # Container for reporting the set of file-level differences of type 'added'
304
304
  def tabulate_added_files(basis_path_hash, other_path_hash)
305
305
  other_only_keys(basis_path_hash, other_path_hash).each do |path|
306
- fid = FileInstanceDifference.new(:change => 'added')
306
+ fid = FileInstanceDifference.new(change: 'added')
307
307
  fid.basis_path = ""
308
308
  fid.other_path = path
309
309
  fid.signatures << other_path_hash[path]
@@ -321,7 +321,7 @@ module Moab
321
321
  # Container for reporting the set of file-level differences of type 'deleted'
322
322
  def tabulate_deleted_files(basis_path_hash, other_path_hash)
323
323
  basis_only_keys(basis_path_hash, other_path_hash).each do |path|
324
- fid = FileInstanceDifference.new(:change => 'deleted')
324
+ fid = FileInstanceDifference.new(change: 'deleted')
325
325
  fid.basis_path = path
326
326
  fid.other_path = ""
327
327
  fid.signatures << basis_path_hash[path]
@@ -26,11 +26,11 @@ module Moab
26
26
 
27
27
  # @attribute
28
28
  # @return [String] The type of change (identical|renamed|modified|deleted|added)
29
- attribute :change, String, :key => true
29
+ attribute :change, String, key: true
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 { |n| n.to_s }
34
34
 
35
35
  def count
36
36
  files.size
@@ -38,6 +38,6 @@ module Moab
38
38
 
39
39
  # @attribute
40
40
  # @return [Array<FileInstanceDifference>] The set of file instances having this type of change
41
- has_many :files, FileInstanceDifference, :tag => 'file'
41
+ has_many :files, FileInstanceDifference, tag: 'file'
42
42
  end
43
43
  end
@@ -25,7 +25,7 @@ module Moab
25
25
 
26
26
  # @attribute
27
27
  # @return [String] The id is the filename path, relative to the file group's base directory
28
- attribute :path, String, :key => true
28
+ attribute :path, String, key: true
29
29
 
30
30
  # @attribute
31
31
  # @return [String] gsub(/\n/,' ')
@@ -38,14 +38,14 @@ 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 { |s| s.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 { |s| s.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)
49
- has_many :signatures, FileSignature, :tag => 'fileSignature'
49
+ has_many :signatures, FileSignature, tag: 'fileSignature'
50
50
  end
51
51
  end
@@ -46,20 +46,20 @@ module Moab
46
46
 
47
47
  # @attribute
48
48
  # @return [String] The digital object identifier (druid)
49
- attribute :digital_object_id, String, :tag => 'objectId'
49
+ attribute :digital_object_id, String, tag: 'objectId'
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 { |n| n.to_s }
54
54
 
55
55
  # @return [String] The unique identifier concatenating digital object id with version id
56
56
  def composite_key
57
- digital_object_id + '-' + StorageObject.version_dirname(version_id)
57
+ "#{digital_object_id}-#{StorageObject.version_dirname(version_id)}"
58
58
  end
59
59
 
60
60
  # @attribute
61
61
  # @return [String] The datetime at which the inventory was created
62
- attribute :inventory_datetime, String, :tag => 'inventoryDatetime'
62
+ attribute :inventory_datetime, String, tag: 'inventoryDatetime'
63
63
 
64
64
  def inventory_datetime=(datetime)
65
65
  @inventory_datetime = Moab::UtcTime.input(datetime)
@@ -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 { |t| t.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 { |t| t.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 { |t| t.to_s }
91
91
 
92
92
  def block_count
93
93
  groups.inject(0) { |sum, group| sum + group.block_count }
@@ -95,7 +95,7 @@ module Moab
95
95
 
96
96
  # @attribute
97
97
  # @return [Array<FileGroup>] The set of data groups comprising the version
98
- has_many :groups, FileGroup, :tag => 'fileGroup'
98
+ has_many :groups, FileGroup, tag: 'fileGroup'
99
99
 
100
100
  # @return [Array<FileGroup] The set of data groups that contain files
101
101
  def non_empty_groups
@@ -194,7 +194,7 @@ module Moab
194
194
  signatures_from_bag = signatures_from_bagit_manifests(bag_pathname)
195
195
  bag_data_subdirs = bag_pathname.join('data').children
196
196
  bag_data_subdirs.each do |subdir|
197
- groups << FileGroup.new(:group_id => subdir.basename.to_s).group_from_bagit_subdir(subdir, signatures_from_bag)
197
+ groups << FileGroup.new(group_id: subdir.basename.to_s).group_from_bagit_subdir(subdir, signatures_from_bag)
198
198
  end
199
199
  self
200
200
  end
@@ -30,11 +30,11 @@ module Moab
30
30
 
31
31
  # @attribute
32
32
  # @return [String] The digital object ID (druid)
33
- attribute :digital_object_id, String, :tag => 'objectId'
33
+ attribute :digital_object_id, String, tag: 'objectId'
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 { |i| i.to_s }
38
38
 
39
39
  def difference_count
40
40
  @group_differences.inject(0) { |sum, group| sum + group.difference_count }
@@ -50,7 +50,7 @@ module Moab
50
50
 
51
51
  # @attribute
52
52
  # @return [String] The datetime at which the report was run
53
- attribute :report_datetime, String, :tag => 'reportDatetime'
53
+ attribute :report_datetime, String, tag: 'reportDatetime'
54
54
 
55
55
  def report_datetime=(datetime)
56
56
  @report_datetime = Moab::UtcTime.input(datetime)
@@ -62,7 +62,7 @@ module Moab
62
62
 
63
63
  # @attribute
64
64
  # @return [Array<FileGroupDifference>] The set of data groups comprising the version
65
- has_many :group_differences, FileGroupDifference, :tag => 'fileGroupDifference'
65
+ has_many :group_differences, FileGroupDifference, tag: 'fileGroupDifference'
66
66
 
67
67
  # @return [Array<String>] The data fields to include in summary reports
68
68
  def summary_fields
@@ -89,8 +89,8 @@ module Moab
89
89
  group_ids = basis_inventory.group_ids | other_inventory.group_ids
90
90
  group_ids.each do |group_id|
91
91
  # get a pair of groups to compare, creating a empty group if not present in the inventory
92
- basis_group = basis_inventory.group(group_id) || FileGroup.new(:group_id => group_id)
93
- other_group = other_inventory.group(group_id) || FileGroup.new(:group_id => group_id)
92
+ basis_group = basis_inventory.group(group_id) || FileGroup.new(group_id: group_id)
93
+ other_group = other_inventory.group(group_id) || FileGroup.new(group_id: group_id)
94
94
  @group_differences << FileGroupDifference.new.compare_file_groups(basis_group, other_group)
95
95
  end
96
96
  self
@@ -30,7 +30,7 @@ module Moab
30
30
 
31
31
  # @attribute
32
32
  # @return [FileSignature] The fixity data of the file instance
33
- element :signature, FileSignature, :tag => 'fileSignature'
33
+ element :signature, FileSignature, tag: 'fileSignature'
34
34
 
35
35
  def signature
36
36
  @signature.is_a?(Array) ? @signature[0] : @signature
@@ -42,7 +42,7 @@ module Moab
42
42
 
43
43
  # @attribute
44
44
  # @return [Array<FileInstance>] The location(s) of the file manifestation's file instances
45
- has_many :instances, FileInstance, :tag => 'fileInstance'
45
+ has_many :instances, FileInstance, tag: 'fileInstance'
46
46
 
47
47
  # @api internal
48
48
  # @return [Array<String>] Create an array from all the file paths of the child {FileInstance} objects
@@ -46,19 +46,19 @@ module Moab
46
46
 
47
47
  # @attribute
48
48
  # @return [Integer] The size of the file in bytes
49
- attribute :size, Integer, :on_save => proc { |n| n.to_s }
49
+ attribute :size, Integer, on_save: proc { |n| n.to_s }
50
50
 
51
51
  # @attribute
52
52
  # @return [String] The MD5 checksum value of the file
53
- attribute :md5, String, :on_save => proc { |n| n.nil? ? "" : n.to_s }
53
+ attribute :md5, String, on_save: proc { |n| n.nil? ? "" : n.to_s }
54
54
 
55
55
  # @attribute
56
56
  # @return [String] The SHA1 checksum value of the file
57
- attribute :sha1, String, :on_save => proc { |n| n.nil? ? "" : n.to_s }
57
+ attribute :sha1, String, on_save: proc { |n| n.nil? ? "" : n.to_s }
58
58
 
59
59
  # @attribute
60
60
  # @return [String] The SHA256 checksum value of the file
61
- attribute :sha256, String, :on_save => proc { |n| n.nil? ? "" : n.to_s }
61
+ attribute :sha256, String, on_save: proc { |n| n.nil? ? "" : n.to_s }
62
62
 
63
63
  KNOWN_ALGOS = {
64
64
  md5: proc { Digest::MD5.new },
@@ -85,7 +85,7 @@ module Moab
85
85
  end
86
86
  end
87
87
 
88
- new(signatures.map { |k, digest| [k, digest.hexdigest] }.to_h.merge(size: pathname.size))
88
+ new(signatures.transform_values(&:hexdigest).merge(size: pathname.size))
89
89
  end
90
90
 
91
91
  # @param type [Symbol,String] The type of checksum
@@ -39,20 +39,20 @@ module Moab
39
39
 
40
40
  # @attribute
41
41
  # @return [String] The object ID (druid)
42
- attribute :digital_object_id, String, :tag => 'objectId'
42
+ attribute :digital_object_id, String, tag: 'objectId'
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 { |n| n.to_s }
47
47
 
48
48
  # @return [String] The unique identifier concatenating digital object id with version id
49
49
  def composite_key
50
- @digital_object_id + '-' + StorageObject.version_dirname(@version_id)
50
+ "#{@digital_object_id}-#{StorageObject.version_dirname(@version_id)}"
51
51
  end
52
52
 
53
53
  # @attribute
54
54
  # @return [String] The datetime at which the catalog was updated
55
- attribute :catalog_datetime, Time, :tag => 'catalogDatetime'
55
+ attribute :catalog_datetime, Time, tag: 'catalogDatetime'
56
56
 
57
57
  def catalog_datetime=(datetime)
58
58
  @catalog_datetime = Moab::UtcTime.input(datetime)
@@ -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 { |t| t.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 { |t| t.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 { |t| t.to_s }
84
84
 
85
85
  def block_count
86
86
  block_size = 1024
@@ -94,7 +94,7 @@ module Moab
94
94
 
95
95
  # @attribute
96
96
  # @return [Array<SignatureCatalogEntry>] The set of data groups comprising the version
97
- has_many :entries, SignatureCatalogEntry, :tag => 'entry'
97
+ has_many :entries, SignatureCatalogEntry, tag: 'entry'
98
98
 
99
99
  def entries=(entry_array)
100
100
  entry_array.each do |entry|
@@ -178,10 +178,10 @@ module Moab
178
178
  # containing only those files that were added in this version
179
179
  # @example {include:file:spec/features/catalog/version_additions_spec.rb}
180
180
  def version_additions(version_inventory)
181
- version_additions = FileInventory.new(:type => 'additions')
181
+ version_additions = FileInventory.new(type: 'additions')
182
182
  version_additions.copy_ids(version_inventory)
183
183
  version_inventory.groups.each do |group|
184
- group_addtions = FileGroup.new(:group_id => group.group_id)
184
+ group_addtions = FileGroup.new(group_id: group.group_id)
185
185
  group.files.each do |file|
186
186
  group_addtions.add_file_instance(file.signature, file.instances[0]) unless @signature_hash.key?(file.signature)
187
187
  end
@@ -25,19 +25,19 @@ 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 { |n| n.to_s }
29
29
 
30
30
  # @attribute
31
31
  # @return [String] The name of the file group
32
- attribute :group_id, String, :tag => 'groupId', :key => true
32
+ attribute :group_id, String, tag: 'groupId', key: true
33
33
 
34
34
  # @attribute
35
35
  # @return [String] The id is the filename path, relative to the file group's base directory
36
- attribute :path, String, :key => true, :tag => 'storagePath'
36
+ attribute :path, String, key: true, tag: 'storagePath'
37
37
 
38
38
  # @attribute
39
39
  # @return [FileSignature] The fixity data of the file instance
40
- element :signature, FileSignature, :tag => 'fileSignature'
40
+ element :signature, FileSignature, tag: 'fileSignature'
41
41
 
42
42
  def signature
43
43
  # HappyMapper's parser tries to put an array of signatures in the signature field
data/lib/moab/stanford.rb CHANGED
@@ -2,20 +2,10 @@
2
2
 
3
3
  require 'moab'
4
4
  require 'stanford/content_inventory'
5
- require 'stanford/dor_metadata'
6
5
  require 'stanford/storage_repository'
7
6
  require 'stanford/storage_services'
8
- require 'stanford/active_fedora_object'
9
- require 'stanford/moab_storage_directory'
10
7
  require 'stanford/storage_object_validator'
11
8
 
12
9
  # Stanford is a module that isolates classes specific to the Stanford Digital Repository
13
- #
14
- # ====Data Model
15
- # * <b>{DorMetadata} = utility methods for interfacing with Stanford metadata files (esp contentMetadata)</b>
16
- # * {ActiveFedoraObject} [1..*] = utility for extracting content or other information from a Fedora Instance
17
- #
18
- # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
19
- # All rights reserved. See {file:LICENSE.rdoc} for details.
20
10
  module Stanford
21
11
  end
@@ -84,10 +84,10 @@ module Moab
84
84
  # @return [FileInventory] The file inventory of the specified type for this version
85
85
  def versionize_bag(bag_dir, current_version, new_version)
86
86
  new_inventory = FileInventory.new(
87
- :type => 'version',
88
- :digital_object_id => @digital_object_id,
89
- :version_id => new_version.version_id,
90
- :inventory_datetime => Time.now
87
+ type: 'version',
88
+ digital_object_id: @digital_object_id,
89
+ version_id: new_version.version_id,
90
+ inventory_datetime: Time.now
91
91
  )
92
92
  new_inventory.inventory_from_bagit_bag(bag_dir)
93
93
  new_inventory.write_xml_file(bag_dir)
@@ -133,7 +133,7 @@ module Moab
133
133
 
134
134
  @object_pathname.children.each do |dirname|
135
135
  vnum = dirname.basename.to_s
136
- list << vnum[1..-1].to_i if vnum =~ /^v(\d+)$/
136
+ list << vnum[1..].to_i if vnum =~ /^v(\d+)$/
137
137
  end
138
138
  list.sort
139
139
  end
@@ -85,13 +85,13 @@ module Moab
85
85
  end
86
86
 
87
87
  def version_dir_format?(dirname)
88
- dirname =~ /^[v]\d{4}$/
88
+ dirname =~ /^v\d{4}$/
89
89
  end
90
90
 
91
91
  # call only if the version directories are "correctly named" vdddd
92
92
  def check_sequential_version_dirs
93
93
  version_directories.each_with_index do |dir_name, index|
94
- next if dir_name[1..-1].to_i == index + 1 # version numbering starts at 1, array indexing at 0
94
+ next if dir_name[1..].to_i == index + 1 # version numbering starts at 1, array indexing at 0
95
95
 
96
96
  return [result_hash(VERSIONS_NOT_IN_ORDER, version_directories)]
97
97
  end