moab-versioning 1.5.0 → 2.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
  SHA1:
3
- metadata.gz: fc968b3f2a7ec6e2062d2deb950cf760201ed978
4
- data.tar.gz: 78964058caf89d2cda709cb61fdab039dfff3fac
3
+ metadata.gz: 29bcc835c352dfeebb39b066f380e14bd37cb1ca
4
+ data.tar.gz: 31912b340a667715ae00a76cfaa657962ceb73fb
5
5
  SHA512:
6
- metadata.gz: 125858b5eeb23be2f7e1d0fd4eea84bf7d864d91f223db916a1d8f7ea4832b3ceaf58c013da0a5e2afe175382f5ccbce43a5980087b43fb06e5d2806b5f79808
7
- data.tar.gz: 9a3af9b77af753dddc5c82a8f8a51d74eb9e053656c7b91d43e1de2cbcf7d76528e110dac58dfa9a5740c04874733a04c6b26b284795c50b7c5f8144d75408a0
6
+ metadata.gz: f468a3db4861d818ac143289f0a83372f23174bd0c1ff7122a69167406d8e566c049bb80a591f0b4876d50596b083e9de20913ff0ecc6f878611dcbd3d23d1e3
7
+ data.tar.gz: d906f907c719f412e7572d659b6ea22b2a4afa9d216f1960f437fd79774406285fae3d813c2abed36cc188a35a897495010351defa8122cd44f38e17143e4b3c
data/lib/moab.rb CHANGED
@@ -32,7 +32,6 @@ module Moab
32
32
  end
33
33
 
34
34
  require 'serializer'
35
- include Serializer
36
35
  require 'confstruct/configuration'
37
36
  require 'moab/config'
38
37
  require 'moab/utc_time'
@@ -15,7 +15,7 @@ module Moab
15
15
  #
16
16
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
17
17
  # All rights reserved. See {file:LICENSE.rdoc} for details.
18
- class FileGroup < Serializable
18
+ class FileGroup < Serializer::Serializable
19
19
 
20
20
  include HappyMapper
21
21
 
@@ -36,7 +36,7 @@ module Moab
36
36
  #
37
37
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
38
38
  # All rights reserved. See {file:LICENSE.rdoc} for details.
39
- class FileGroupDifference < Serializable
39
+ class FileGroupDifference < Serializer::Serializable
40
40
  include HappyMapper
41
41
 
42
42
  # The name of the XML element used to serialize this objects data
@@ -13,7 +13,7 @@ module Moab
13
13
  #
14
14
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
15
15
  # All rights reserved. See {file:LICENSE.rdoc} for details.
16
- class FileGroupDifferenceSubset < Serializable
16
+ class FileGroupDifferenceSubset < Serializer::Serializable
17
17
  include HappyMapper
18
18
 
19
19
  # The name of the XML element used to serialize this objects data
@@ -13,7 +13,7 @@ module Moab
13
13
  #
14
14
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
15
15
  # All rights reserved. See {file:LICENSE.rdoc} for details.
16
- class FileInstance < Serializable
16
+ class FileInstance < Serializer::Serializable
17
17
 
18
18
  include HappyMapper
19
19
 
@@ -20,7 +20,7 @@ module Moab
20
20
  #
21
21
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
22
22
  # All rights reserved. See {file:LICENSE.rdoc} for details.
23
- class FileInstanceDifference < Serializable
23
+ class FileInstanceDifference < Serializer::Serializable
24
24
 
25
25
  include HappyMapper
26
26
 
@@ -28,7 +28,7 @@ module Moab
28
28
  # @example {include:file:spec/fixtures/derivatives/manifests/v3/versionInventory.xml}
29
29
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
30
30
  # All rights reserved. See {file:LICENSE.rdoc} for details.
31
- class FileInventory < Manifest
31
+ class FileInventory < Serializer::Manifest
32
32
 
33
33
  include HappyMapper
34
34
 
@@ -17,7 +17,7 @@ module Moab
17
17
  # @example {include:file:spec/fixtures/derivatives/manifests/all/fileInventoryDifference.xml}
18
18
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
19
19
  # All rights reserved. See {file:LICENSE.rdoc} for details.
20
- class FileInventoryDifference < Manifest
20
+ class FileInventoryDifference < Serializer::Manifest
21
21
 
22
22
  include HappyMapper
23
23
 
@@ -17,7 +17,7 @@ module Moab
17
17
  #
18
18
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
19
19
  # All rights reserved. See {file:LICENSE.rdoc} for details.
20
- class FileManifestation < Serializable
20
+ class FileManifestation < Serializer::Serializable
21
21
  include HappyMapper
22
22
 
23
23
  # The name of the XML element used to serialize this objects data
@@ -39,7 +39,7 @@ module Moab
39
39
  #
40
40
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
41
41
  # All rights reserved. See {file:LICENSE.rdoc} for details.
42
- class FileSignature < Serializable
42
+ class FileSignature < Serializer::Serializable
43
43
 
44
44
  include HappyMapper
45
45
 
@@ -25,7 +25,7 @@ module Moab
25
25
  # @see Bagger
26
26
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
27
27
  # All rights reserved. See {file:LICENSE.rdoc} for details.
28
- class SignatureCatalog < Manifest
28
+ class SignatureCatalog < Serializer::Manifest
29
29
  include HappyMapper
30
30
 
31
31
  # The name of the XML element used to serialize this objects data
@@ -13,7 +13,7 @@ module Moab
13
13
  #
14
14
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
15
15
  # All rights reserved. See {file:LICENSE.rdoc} for details.
16
- class SignatureCatalogEntry < Serializable
16
+ class SignatureCatalogEntry < Serializer::Serializable
17
17
 
18
18
  include HappyMapper
19
19
 
@@ -1,5 +1,4 @@
1
1
  require 'moab'
2
- include Moab
3
2
  require 'stanford/content_inventory'
4
3
  require 'stanford/dor_metadata'
5
4
  require 'stanford/storage_repository'
@@ -12,7 +12,7 @@ module Moab
12
12
  # @example {include:file:spec/fixtures/data/jq937jp0017/v3/metadata/versionMetadata.xml}
13
13
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
14
14
  # All rights reserved. See {file:LICENSE.rdoc} for details.
15
- class VersionMetadata < Manifest
15
+ class VersionMetadata < Serializer::Manifest
16
16
 
17
17
  include HappyMapper
18
18
 
@@ -11,7 +11,7 @@ module Moab
11
11
  #
12
12
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
13
13
  # All rights reserved. See {file:LICENSE.rdoc} for details.
14
- class VersionMetadataEntry < Serializable
14
+ class VersionMetadataEntry < Serializer::Serializable
15
15
 
16
16
  include HappyMapper
17
17
 
@@ -13,7 +13,7 @@ module Moab
13
13
  # @see VersionMetadataEntry
14
14
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
15
15
  # All rights reserved. See {file:LICENSE.rdoc} for details.
16
- class VersionMetadataEvent < Serializable
16
+ class VersionMetadataEvent < Serializer::Serializable
17
17
 
18
18
  include HappyMapper
19
19
 
@@ -10,7 +10,7 @@ module Serializer
10
10
  # @see Serializable
11
11
  # @note Copyright (c) 2012 by The Board of Trustees of the Leland Stanford Junior University.
12
12
  # All rights reserved. See {file:LICENSE.rdoc} for details.
13
- class Manifest < Serializable
13
+ class Manifest < Serializer::Serializable
14
14
 
15
15
  include HappyMapper
16
16
 
@@ -146,7 +146,7 @@ module Serializer
146
146
  when 2
147
147
  ltag, left, rtag, right = :left, hashes[0], :right, hashes[1]
148
148
  else
149
- raise "wrong number of arguments (expected 2 or 4)"
149
+ raise ArgumentError, "wrong number of arguments (#{hashes.length} for 2 or 4)"
150
150
  end
151
151
  (left.keys | right.keys).each do |k|
152
152
  if left[k] != right[k]
@@ -1,4 +1,4 @@
1
- require 'moab_stanford'
1
+ require 'moab/stanford'
2
2
 
3
3
  module Stanford
4
4
 
@@ -1,4 +1,4 @@
1
- require 'moab_stanford'
1
+ require 'moab/stanford'
2
2
 
3
3
  module Stanford
4
4
 
@@ -24,7 +24,7 @@ module Stanford
24
24
  # Many of these objects have contentMetadata with no child elements, such as this:
25
25
  # <contentMetadata objectId="bd608mj3166" type="file"/>
26
26
  # but there are also objects that have no datasteam of this name at all
27
- cm_inventory = FileInventory.new(:type=>"version",:digital_object_id=>object_id, :version_id=>version_id)
27
+ cm_inventory = Moab::FileInventory.new(:type=>"version",:digital_object_id=>object_id, :version_id=>version_id)
28
28
  content_group = group_from_cm(content_metadata, subset)
29
29
  cm_inventory.groups << content_group
30
30
  cm_inventory
@@ -50,7 +50,7 @@ module Stanford
50
50
  else
51
51
  raise "Unknown disposition subset (#{subset})"
52
52
  end
53
- content_group = FileGroup.new(:group_id=>'content', :data_source => "contentMetadata-#{subset}")
53
+ content_group = Moab::FileGroup.new(:group_id=>'content', :data_source => "contentMetadata-#{subset}")
54
54
  nodeset.each do |file_node|
55
55
  signature = generate_signature(file_node)
56
56
  instance = generate_instance(file_node)
@@ -63,7 +63,7 @@ module Stanford
63
63
  # @param node [Nokogiri::XML::Node] The XML node containing file information
64
64
  # @return [FileSignature] The {FileSignature} object generated from the XML data
65
65
  def generate_signature(node)
66
- signature = FileSignature.new()
66
+ signature = Moab::FileSignature.new()
67
67
  signature.size = node.attributes['size'].content
68
68
  checksum_nodes = node.xpath('checksum')
69
69
  checksum_nodes.each do |checksum_node|
@@ -83,7 +83,7 @@ module Stanford
83
83
  # @param node (see #generate_signature)
84
84
  # @return [FileInstance] The {FileInstance} object generated from the XML data
85
85
  def generate_instance(node)
86
- instance = FileInstance.new()
86
+ instance = Moab::FileInstance.new()
87
87
  instance.path = node.attributes['id'].content
88
88
  instance.datetime = node.attributes['datetime'].content rescue nil
89
89
  instance
@@ -175,8 +175,8 @@ module Stanford
175
175
  return nil if content_metadata.nil?
176
176
  return content_metadata if content_group.nil? or content_group.files.size < 1
177
177
  signature_for_path = content_group.path_hash
178
- @type_for_name = FileSignature.checksum_type_for_name
179
- @names_for_type = FileSignature.checksum_names_for_type
178
+ @type_for_name = Moab::FileSignature.checksum_type_for_name
179
+ @names_for_type = Moab::FileSignature.checksum_names_for_type
180
180
  ng_doc = Nokogiri::XML(content_metadata) { |x| x.noblanks }
181
181
  nodeset = ng_doc.xpath("//file")
182
182
  nodeset.each do |file_node|
@@ -1,4 +1,4 @@
1
- require 'moab_stanford'
1
+ require 'moab/stanford'
2
2
 
3
3
  module Stanford
4
4
 
@@ -33,11 +33,11 @@ module Stanford
33
33
  # @return [FileInventory] Inventory of the files under the specified directory
34
34
  def inventory_from_directory(directory, version_id=nil)
35
35
  version_id ||= @version_id
36
- version_inventory = FileInventory.new(:type=>'version',:digital_object_id=>@digital_object_id, :version_id=>version_id)
36
+ version_inventory = Moab::FileInventory.new(:type=>'version',:digital_object_id=>@digital_object_id, :version_id=>version_id)
37
37
  content_metadata = IO.read(File.join(directory,'contentMetadata.xml'))
38
- content_group = ContentInventory.new.group_from_cm(content_metadata, 'preserve' )
38
+ content_group = Stanford::ContentInventory.new.group_from_cm(content_metadata, 'preserve' )
39
39
  version_inventory.groups << content_group
40
- metadata_group = FileGroup.new(:group_id=>'metadata').group_from_directory(directory)
40
+ metadata_group = Moab::FileGroup.new(:group_id=>'metadata').group_from_directory(directory)
41
41
  version_inventory.groups << metadata_group
42
42
  version_inventory
43
43
  end
@@ -1,4 +1,4 @@
1
- require 'moab_stanford'
1
+ require 'moab/stanford'
2
2
 
3
3
  module Stanford
4
4
 
@@ -1,4 +1,4 @@
1
- require 'moab_stanford'
1
+ require 'moab/stanford'
2
2
 
3
3
  module Stanford
4
4
 
@@ -14,20 +14,20 @@ module Stanford
14
14
  # @param base_version [Integer] The ID of the version whose inventory is the basis of, if nil use latest version
15
15
  # @return [FileInventoryDifference] The report of differences between the content metadata and the specified version
16
16
  def self.compare_cm_to_version(new_content_metadata, object_id, subset, base_version=nil)
17
- new_inventory = ContentInventory.new.inventory_from_cm(new_content_metadata, object_id, subset)
17
+ new_inventory = Stanford::ContentInventory.new.inventory_from_cm(new_content_metadata, object_id, subset)
18
18
  begin
19
19
  # ObjectNotFoundException is raised if the object does not exist in storage
20
20
  base_version ||= self.current_version(object_id)
21
21
  # FileNotFoundException is raised if object exists but has no contentMetadata file
22
22
  base_cm_pathname = self.retrieve_file('metadata', 'contentMetadata.xml', object_id, base_version)
23
- base_inventory = ContentInventory.new.inventory_from_cm(base_cm_pathname.read, object_id, subset, base_version)
23
+ base_inventory = Stanford::ContentInventory.new.inventory_from_cm(base_cm_pathname.read, object_id, subset, base_version)
24
24
  rescue Moab::ObjectNotFoundException, Moab::FileNotFoundException
25
25
  # Create a skeletal FileInventory object, containing no file entries
26
- storage_object = StorageObject.new(object_id, 'dummy')
27
- base_version = StorageObjectVersion.new(storage_object,0)
26
+ storage_object = Moab::StorageObject.new(object_id, 'dummy')
27
+ base_version = Moab::StorageObjectVersion.new(storage_object,0)
28
28
  base_inventory = base_version.file_inventory('version')
29
29
  end
30
- diff = FileInventoryDifference.new.compare(base_inventory, new_inventory)
30
+ diff = Moab::FileInventoryDifference.new.compare(base_inventory, new_inventory)
31
31
  metadata_diff = diff.group_difference('metadata')
32
32
  diff.group_differences.delete(metadata_diff) if metadata_diff
33
33
  diff
@@ -38,15 +38,15 @@ module Stanford
38
38
  # @param version_id [Integer] The ID of the version whose signature catalog is to be used, if nil use latest version
39
39
  # @return [FileInventory] The versionAddtions report showing which files are new or modified in the content metadata
40
40
  def self.cm_version_additions(new_content_metadata, object_id, version_id=nil)
41
- new_inventory = ContentInventory.new.inventory_from_cm(new_content_metadata, object_id, 'preserve')
41
+ new_inventory = Stanford::ContentInventory.new.inventory_from_cm(new_content_metadata, object_id, 'preserve')
42
42
  begin
43
43
  # ObjectNotFoundException is raised if the object does not exist in storage
44
44
  version_id ||= self.current_version(object_id)
45
45
  storage_object_version = @@repository.storage_object(object_id).find_object_version(version_id)
46
46
  signature_catalog = storage_object_version.signature_catalog
47
47
  rescue Moab::ObjectNotFoundException
48
- storage_object = StorageObject.new(object_id, 'dummy')
49
- base_version = StorageObjectVersion.new(storage_object,0)
48
+ storage_object = Moab::StorageObject.new(object_id, 'dummy')
49
+ base_version = Moab::StorageObjectVersion.new(storage_object,0)
50
50
  signature_catalog = base_version.signature_catalog
51
51
  end
52
52
  signature_catalog.version_additions(new_inventory)
@@ -58,7 +58,7 @@ module Stanford
58
58
  def self.cm_remediate(object_id, version_id=nil)
59
59
  cm = self.retrieve_file('metadata', 'contentMetadata.xml', object_id, version_id)
60
60
  group = self.retrieve_file_group('content', object_id, version_id)
61
- ContentInventory.new.remediate_content_metadata(cm,group)
61
+ Stanford::ContentInventory.new.remediate_content_metadata(cm,group)
62
62
  end
63
63
 
64
64
  end
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'pathname'
4
4
  require 'yard'
5
5
  include YARD
6
- require 'moab_stanford'
6
+ require 'moab/stanford'
7
7
  include Serializer
8
8
  include Moab
9
9
  include Stanford
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: 1.5.0
4
+ version: 2.0.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: 2017-07-19 00:00:00.000000000 Z
14
+ date: 2016-02-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: confstruct
@@ -203,6 +203,7 @@ files:
203
203
  - lib/moab/file_signature.rb
204
204
  - lib/moab/signature_catalog.rb
205
205
  - lib/moab/signature_catalog_entry.rb
206
+ - lib/moab/stanford.rb
206
207
  - lib/moab/storage_object.rb
207
208
  - lib/moab/storage_object_version.rb
208
209
  - lib/moab/storage_repository.rb
@@ -212,7 +213,6 @@ files:
212
213
  - lib/moab/version_metadata.rb
213
214
  - lib/moab/version_metadata_entry.rb
214
215
  - lib/moab/version_metadata_event.rb
215
- - lib/moab_stanford.rb
216
216
  - lib/serializer.rb
217
217
  - lib/serializer/manifest.rb
218
218
  - lib/serializer/serializable.rb
@@ -235,9 +235,9 @@ require_paths:
235
235
  - lib
236
236
  required_ruby_version: !ruby/object:Gem::Requirement
237
237
  requirements:
238
- - - ">="
238
+ - - "~>"
239
239
  - !ruby/object:Gem::Version
240
- version: '0'
240
+ version: '2.1'
241
241
  required_rubygems_version: !ruby/object:Gem::Requirement
242
242
  requirements:
243
243
  - - ">="
@@ -245,9 +245,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  version: 1.3.6
246
246
  requirements: []
247
247
  rubyforge_project:
248
- rubygems_version: 2.6.12
248
+ rubygems_version: 2.4.5.1
249
249
  signing_key:
250
250
  specification_version: 4
251
251
  summary: Ruby implementation of digital object versioning toolkit used by the SULAIR
252
252
  Digital Library
253
253
  test_files: []
254
+ has_rdoc: