hydra-works 0.3.0 → 0.4.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/hydra/works/characterization/schema/document_schema.rb +3 -3
- data/lib/hydra/works/models/concerns/collection_behavior.rb +0 -30
- data/lib/hydra/works/models/concerns/file_set/virus_check.rb +6 -2
- data/lib/hydra/works/models/concerns/file_set_behavior.rb +0 -10
- data/lib/hydra/works/models/concerns/work_behavior.rb +0 -25
- data/lib/hydra/works/version.rb +1 -1
- data/spec/hydra/works/models/collection_spec.rb +0 -16
- data/spec/hydra/works/models/generic_file_spec.rb +0 -14
- data/spec/hydra/works/models/generic_work_spec.rb +0 -17
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 5ebd42d5d4c7bf8bdd3b2dab8dfce732125c35ed
         | 
| 4 | 
            +
              data.tar.gz: 3bd2bc2c16daac53f092b7435218906b3f0fcb6d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b2eda186b0a5c27a5c6901e6f9be86079f47076035d485b01d6cebb31df724dc23ba3da8cd39296b66273796df2278e85f0cb222e2a25673bd9e2edf9f47f456
         | 
| 7 | 
            +
              data.tar.gz: b29ccf5e084c04bc7e51dda1e1c236a03a52f1a65de0f9cbc69894d72b449259e0d723239e55c079279cc32d1598f26553e9a3e2d06a969e8c70e9d51ec578a2
         | 
| @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            module Hydra::Works::Characterization
         | 
| 2 2 | 
             
              class DocumentSchema < ActiveTriples::Schema
         | 
| 3 | 
            -
                property :file_title, predicate: RDF::DC11.title
         | 
| 4 | 
            -
                property :file_author, predicate: RDF::DC11.creator
         | 
| 3 | 
            +
                property :file_title, predicate: RDF::Vocab::DC11.title
         | 
| 4 | 
            +
                property :file_author, predicate: RDF::Vocab::DC11.creator
         | 
| 5 5 | 
             
                property :page_count, predicate: RDF::Vocab::NFO.pageCount
         | 
| 6 | 
            -
                property :file_language, predicate: RDF::DC11.language
         | 
| 6 | 
            +
                property :file_language, predicate: RDF::Vocab::DC11.language
         | 
| 7 7 | 
             
                property :word_count, predicate: RDF::Vocab::NFO.wordCount
         | 
| 8 8 | 
             
                property :character_count, predicate: RDF::Vocab::NFO.characterCount
         | 
| 9 9 | 
             
                property :line_count, predicate: RDF::Vocab::NFO.lineCount
         | 
| @@ -65,35 +65,5 @@ module Hydra::Works | |
| 65 65 |  | 
| 66 66 | 
             
                alias_method :works_generic_file?, :file_set?
         | 
| 67 67 | 
             
                deprecation_deprecate :works_generic_file?
         | 
| 68 | 
            -
             | 
| 69 | 
            -
                def parents
         | 
| 70 | 
            -
                  Deprecation.warn CollectionBehavior, '`parents` is deprecated in Hydra::Works.  Please use `member_of` instead.  This has a target date for removal of 10-31-2015'
         | 
| 71 | 
            -
                  member_of
         | 
| 72 | 
            -
                end
         | 
| 73 | 
            -
             | 
| 74 | 
            -
                def parent_collections
         | 
| 75 | 
            -
                  Deprecation.warn CollectionBehavior, '`parent_collections` is deprecated in Hydra::Works.  Please use `in_collections` instead.  This has a target date for removal of 10-31-2015'
         | 
| 76 | 
            -
                  in_collections
         | 
| 77 | 
            -
                end
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                def child_collections
         | 
| 80 | 
            -
                  Deprecation.warn CollectionBehavior, '`child_collections` is deprecated in Hydra::Works.  Please use `collections` instead.  This has a target date for removal of 10-31-2015'
         | 
| 81 | 
            -
                  collections
         | 
| 82 | 
            -
                end
         | 
| 83 | 
            -
             | 
| 84 | 
            -
                def child_collection_ids
         | 
| 85 | 
            -
                  Deprecation.warn CollectionBehavior, '`child_collection_ids` is deprecated in Hydra::Works.  Please use `collection_ids` instead.  This has a target date for removal of 10-31-2015'
         | 
| 86 | 
            -
                  collection_ids
         | 
| 87 | 
            -
                end
         | 
| 88 | 
            -
             | 
| 89 | 
            -
                def child_generic_works
         | 
| 90 | 
            -
                  Deprecation.warn CollectionBehavior, '`child_generic_works` is deprecated in Hydra::Works.  Please use `works` instead.  This has a target date for removal of 10-31-2015'
         | 
| 91 | 
            -
                  works
         | 
| 92 | 
            -
                end
         | 
| 93 | 
            -
             | 
| 94 | 
            -
                def child_generic_work_ids
         | 
| 95 | 
            -
                  Deprecation.warn CollectionBehavior, '`child_generic_work_ids` is deprecated in Hydra::Works.  Please use `work_ids` instead.  This has a target date for removal of 10-31-2015'
         | 
| 96 | 
            -
                  work_ids
         | 
| 97 | 
            -
                end
         | 
| 98 68 | 
             
              end
         | 
| 99 69 | 
             
            end
         | 
| @@ -12,7 +12,7 @@ module Hydra::Works | |
| 12 12 |  | 
| 13 13 | 
             
                  path = original_file.is_a?(String) ? original_file : local_path_for_file(original_file)
         | 
| 14 14 | 
             
                  unless defined?(ClamAV)
         | 
| 15 | 
            -
                     | 
| 15 | 
            +
                    warning "Virus checking disabled, #{path} not checked"
         | 
| 16 16 | 
             
                    return
         | 
| 17 17 | 
             
                  end
         | 
| 18 18 |  | 
| @@ -21,7 +21,7 @@ module Hydra::Works | |
| 21 21 | 
             
                    true
         | 
| 22 22 | 
             
                  else
         | 
| 23 23 | 
             
                    virus_message = "A virus was found in #{path}: #{scan_result}"
         | 
| 24 | 
            -
                     | 
| 24 | 
            +
                    warning(virus_message)
         | 
| 25 25 | 
             
                    errors.add(:base, virus_message)
         | 
| 26 26 | 
             
                    false
         | 
| 27 27 | 
             
                  end
         | 
| @@ -29,6 +29,10 @@ module Hydra::Works | |
| 29 29 |  | 
| 30 30 | 
             
                private
         | 
| 31 31 |  | 
| 32 | 
            +
                  def warning(msg)
         | 
| 33 | 
            +
                    ActiveFedora::Base.logger.warn msg if ActiveFedora::Base.logger
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 32 36 | 
             
                  # Returns a path for reading the content of +file+
         | 
| 33 37 | 
             
                  # @param [File] file object to retrieve a path for
         | 
| 34 38 | 
             
                  def local_path_for_file(file)
         | 
| @@ -47,21 +47,11 @@ module Hydra::Works | |
| 47 47 | 
             
                alias_method :works_generic_file?, :file_set?
         | 
| 48 48 | 
             
                deprecation_deprecate :works_generic_file?
         | 
| 49 49 |  | 
| 50 | 
            -
                def parents
         | 
| 51 | 
            -
                  Deprecation.warn GenericFileBehavior, '`parents` is deprecated in Hydra::Works.  Please use `member_of` instead.  This has a target date for removal of 10-31-2015'
         | 
| 52 | 
            -
                  member_of
         | 
| 53 | 
            -
                end
         | 
| 54 | 
            -
             | 
| 55 50 | 
             
                def in_works
         | 
| 56 51 | 
             
                  ordered_by.select { |parent| parent.class.included_modules.include?(Hydra::Works::WorkBehavior) }.to_a
         | 
| 57 52 | 
             
                end
         | 
| 58 53 |  | 
| 59 54 | 
             
                alias_method :in_generic_works, :in_works
         | 
| 60 55 | 
             
                deprecation_deprecate :in_generic_works
         | 
| 61 | 
            -
             | 
| 62 | 
            -
                def generic_works
         | 
| 63 | 
            -
                  Deprecation.warn GenericFileBehavior, '`generic_works` is deprecated in Hydra::Works.  Please use `in_works` instead.  This has a target date for removal of 10-31-2015'
         | 
| 64 | 
            -
                  in_works
         | 
| 65 | 
            -
                end
         | 
| 66 56 | 
             
              end
         | 
| 67 57 | 
             
            end
         | 
| @@ -83,36 +83,11 @@ module Hydra::Works | |
| 83 83 | 
             
                alias_method :works_generic_file?, :file_set?
         | 
| 84 84 | 
             
                deprecation_deprecate :works_generic_file?
         | 
| 85 85 |  | 
| 86 | 
            -
                def parents
         | 
| 87 | 
            -
                  Deprecation.warn WorkBehavior, '`parents` is deprecated in Hydra::Works.  Please use `member_of` instead.  This has a target date for removal of 10-31-2015'
         | 
| 88 | 
            -
                  member_of
         | 
| 89 | 
            -
                end
         | 
| 90 | 
            -
             | 
| 91 86 | 
             
                def in_works
         | 
| 92 87 | 
             
                  ordered_by.select { |parent| parent.class.included_modules.include?(Hydra::Works::WorkBehavior) }.to_a
         | 
| 93 88 | 
             
                end
         | 
| 94 89 |  | 
| 95 90 | 
             
                alias_method :in_generic_works, :in_works
         | 
| 96 91 | 
             
                deprecation_deprecate :in_generic_works
         | 
| 97 | 
            -
             | 
| 98 | 
            -
                def parent_generic_works
         | 
| 99 | 
            -
                  Deprecation.warn WorkBehavior, '`parent_generic_works` is deprecated in Hydra::Works.  Please use `in_works` instead.  This has a target date for removal of 10-31-2015'
         | 
| 100 | 
            -
                  in_works
         | 
| 101 | 
            -
                end
         | 
| 102 | 
            -
             | 
| 103 | 
            -
                def parent_collections
         | 
| 104 | 
            -
                  Deprecation.warn WorkBehavior, '`parent_collections` is deprecated in Hydra::Works.  Please use `in_collections` instead.  This has a target date for removal of 10-31-2015'
         | 
| 105 | 
            -
                  in_collections
         | 
| 106 | 
            -
                end
         | 
| 107 | 
            -
             | 
| 108 | 
            -
                def child_generic_works
         | 
| 109 | 
            -
                  Deprecation.warn WorkBehavior, '`child_generic_works` is deprecated in Hydra::Works.  Please use `ordered_works` instead.  This has a target date for removal of 10-31-2015'
         | 
| 110 | 
            -
                  ordered_works
         | 
| 111 | 
            -
                end
         | 
| 112 | 
            -
             | 
| 113 | 
            -
                def child_generic_work_ids
         | 
| 114 | 
            -
                  Deprecation.warn WorkBehavior, '`child_generic_work_ids` is deprecated in Hydra::Works.  Please use `ordered_work_ids` instead.  This has a target date for removal of 10-31-2015'
         | 
| 115 | 
            -
                  ordered_work_ids
         | 
| 116 | 
            -
                end
         | 
| 117 92 | 
             
              end
         | 
| 118 93 | 
             
            end
         | 
    
        data/lib/hydra/works/version.rb
    CHANGED
    
    
| @@ -249,20 +249,4 @@ describe Hydra::Works::Collection do | |
| 249 249 | 
             
                  expect(collection2.in_collections).to eq [collection1]
         | 
| 250 250 | 
             
                end
         | 
| 251 251 | 
             
              end
         | 
| 252 | 
            -
             | 
| 253 | 
            -
              describe 'make sure deprecated methods still work' do
         | 
| 254 | 
            -
                it 'deprecated methods should pass' do
         | 
| 255 | 
            -
                  Deprecation.silence(Hydra::Works::CollectionBehavior) do
         | 
| 256 | 
            -
                    collection1.ordered_members << collection2
         | 
| 257 | 
            -
                    collection1.ordered_members << generic_work1
         | 
| 258 | 
            -
                    expect(collection1.child_collections).to eq [collection2]
         | 
| 259 | 
            -
                    expect(collection1.child_collection_ids).to eq [collection2.id]
         | 
| 260 | 
            -
                    expect(collection1.child_generic_works).to eq [generic_work1]
         | 
| 261 | 
            -
                    expect(collection1.child_generic_work_ids).to eq [generic_work1.id]
         | 
| 262 | 
            -
                    collection1.save # required until issue AF-Agg-75 is fixed
         | 
| 263 | 
            -
                    expect(collection2.parent_collections).to eq [collection1]
         | 
| 264 | 
            -
                    expect(collection2.parents).to eq [collection1]
         | 
| 265 | 
            -
                  end
         | 
| 266 | 
            -
                end
         | 
| 267 | 
            -
              end
         | 
| 268 252 | 
             
            end
         | 
| @@ -220,18 +220,4 @@ describe Hydra::Works::FileSet do | |
| 220 220 | 
             
                  expect(generic_file1.in_works).to eq [generic_work1]
         | 
| 221 221 | 
             
                end
         | 
| 222 222 | 
             
              end
         | 
| 223 | 
            -
             | 
| 224 | 
            -
              describe 'make sure deprecated methods still work' do
         | 
| 225 | 
            -
                let(:generic_work1) { Hydra::Works::GenericWork.create }
         | 
| 226 | 
            -
                before do
         | 
| 227 | 
            -
                  generic_work1.ordered_members << generic_file1
         | 
| 228 | 
            -
                  generic_work1.save # required until issue AF-Agg-75 is fixed
         | 
| 229 | 
            -
                end
         | 
| 230 | 
            -
                it 'deprecated methods should pass' do
         | 
| 231 | 
            -
                  Deprecation.silence(Hydra::Works::GenericFileBehavior) do
         | 
| 232 | 
            -
                    expect(generic_file1.generic_works).to eq [generic_work1]
         | 
| 233 | 
            -
                    expect(generic_file1.parents).to eq [generic_work1]
         | 
| 234 | 
            -
                  end
         | 
| 235 | 
            -
                end
         | 
| 236 | 
            -
              end
         | 
| 237 223 | 
             
            end
         | 
| @@ -374,21 +374,4 @@ describe Hydra::Works::GenericWork do | |
| 374 374 | 
             
                  expect(generic_work2.in_works).to eq [generic_work1]
         | 
| 375 375 | 
             
                end
         | 
| 376 376 | 
             
              end
         | 
| 377 | 
            -
             | 
| 378 | 
            -
              describe 'make sure deprecated methods still work' do
         | 
| 379 | 
            -
                let(:collection1) { Hydra::Works::Collection.new }
         | 
| 380 | 
            -
                it 'deprecated methods should pass' do
         | 
| 381 | 
            -
                  Deprecation.silence(Hydra::Works::WorkBehavior) do
         | 
| 382 | 
            -
                    collection1.ordered_members << generic_work1
         | 
| 383 | 
            -
                    generic_work1.ordered_members << generic_work2
         | 
| 384 | 
            -
                    expect(generic_work1.child_generic_works).to eq [generic_work2]
         | 
| 385 | 
            -
                    expect(generic_work1.child_generic_work_ids).to eq [generic_work2.id]
         | 
| 386 | 
            -
                    generic_work1.save # required until issue AF-Agg-75 is fixed
         | 
| 387 | 
            -
                    collection1.save
         | 
| 388 | 
            -
                    expect(generic_work2.parent_generic_works).to eq [generic_work1]
         | 
| 389 | 
            -
                    expect(generic_work1.parent_collections).to eq [collection1]
         | 
| 390 | 
            -
                    expect(generic_work2.parents).to eq [generic_work1]
         | 
| 391 | 
            -
                  end
         | 
| 392 | 
            -
                end
         | 
| 393 | 
            -
              end
         | 
| 394 377 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: hydra-works
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.4.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Justin Coyne
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015- | 
| 11 | 
            +
            date: 2015-11-04 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: hydra-pcdm
         |