hydra-works 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +1 -0
- data/README.md +4 -5
- data/hydra-works.gemspec +1 -1
- data/lib/hydra/works/characterization/{fits_datastream.rb → fits_document.rb} +4 -2
- data/lib/hydra/works/characterization.rb +1 -1
- data/lib/hydra/works/models/concerns/file_set/virus_check.rb +9 -4
- data/lib/hydra/works/services/characterization_service.rb +8 -8
- data/lib/hydra/works/version.rb +1 -1
- data/lib/hydra/works.rb +1 -0
- data/spec/hydra/works/models/characterization/{fits_datastream_spec.rb → fits_document_spec.rb} +1 -1
- data/spec/hydra/works/models/concerns/file_set/virus_check_spec.rb +1 -1
- data/spec/hydra/works/models/file_set_spec.rb +2 -2
- data/spec/hydra/works/services/characterization_service_spec.rb +1 -1
- metadata +20 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5992ee7b9f7184fd70053978e0604cd9ed10ccc
|
4
|
+
data.tar.gz: 20f024bb82a6b76da36d5197dc7709879d44c690
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76b34210f7d2fbb513108ed8637d0d7b302ee35f205ed9a2333dd479f34d576caf7bc8c3c399724de9100980ebe2a2e18efc6500e437924f41d657735ab9c593
|
7
|
+
data.tar.gz: 3a213fa47a3feafd53474ede6e5b2211ee9706e647694e393655b3744e1b0f8b062a37adc461731561300876b123702ab6a65cf709aafe5f630dc9999187ce1e
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
# Hydra::Works
|
2
2
|
|
3
3
|
[![Version](https://badge.fury.io/rb/hydra-works.png)](http://badge.fury.io/rb/hydra-works)
|
4
|
-
[![Build Status](https://travis-ci.org/projecthydra
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/projecthydra
|
6
|
-
[![Code Climate](https://codeclimate.com/github/projecthydra
|
4
|
+
[![Build Status](https://travis-ci.org/projecthydra/hydra-works.svg?branch=master)](https://travis-ci.org/projecthydra/hydra-works)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/projecthydra/hydra-works/badge.svg?branch=master)](https://coveralls.io/r/projecthydra/hydra-works?branch=master)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/projecthydra/hydra-works/badges/gpa.svg)](https://codeclimate.com/github/projecthydra/hydra-works)
|
7
7
|
[![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
|
8
8
|
[![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
|
9
9
|
[![API Docs](http://img.shields.io/badge/API-docs-blue.svg)](http://rubydoc.info/gems/hydra-works)
|
10
|
-
[![Stories in Ready](https://badge.waffle.io/projecthydra-labs/hydra-works.png?source=projecthydra-labs%2Fhydra-works&label=ready&title=Ready)](https://waffle.io/projecthydra-labs/hydra-works?source=projecthydra-labs%2Fhydra-works)
|
11
10
|
|
12
|
-
The Hydra::Works gem implements the [PCDM](https://github.com/duraspace/pcdm/wiki) [Works](https://github.com/duraspace/pcdm/blob/master/pcdm-ext/works.rdf) data model using ActiveFedora-based models. In addition to the models, Hydra::Works includes associated behaviors around the broad concept of describable "works" or intellectual entities, the need for which was expressed by a variety of [Hydra community use cases](https://github.com/projecthydra
|
11
|
+
The Hydra::Works gem implements the [PCDM](https://github.com/duraspace/pcdm/wiki) [Works](https://github.com/duraspace/pcdm/blob/master/pcdm-ext/works.rdf) data model using ActiveFedora-based models. In addition to the models, Hydra::Works includes associated behaviors around the broad concept of describable "works" or intellectual entities, the need for which was expressed by a variety of [Hydra community use cases](https://github.com/projecthydra/hydra-works/tree/master/use-cases). The PCDM Works domain model includes the following high-level entities:
|
13
12
|
|
14
13
|
* **Collection**: a *pcdm:Collection* that indirectly contains zero or more **Works** and zero or more **Collection**s
|
15
14
|
* **Work**: a *pcdm:Object* that holds zero or more **FileSets** and zero or more **Works**
|
data/hydra-works.gemspec
CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'active-fedora', '>= 9', '< 11.a'
|
22
21
|
spec.add_dependency 'hydra-pcdm', '>= 0.8'
|
23
22
|
spec.add_dependency 'hydra-derivatives', '~> 3.0'
|
24
23
|
spec.add_dependency 'hydra-file_characterization', '~> 0.3', '>= 0.3.3'
|
24
|
+
spec.add_dependency 'om', '~> 3.1'
|
25
25
|
|
26
26
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
27
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
@@ -1,5 +1,7 @@
|
|
1
|
+
require 'om'
|
2
|
+
|
1
3
|
module Hydra::Works::Characterization
|
2
|
-
class
|
4
|
+
class FitsDocument
|
3
5
|
include OM::XML::Document
|
4
6
|
|
5
7
|
set_terminology do |t|
|
@@ -87,7 +89,7 @@ module Hydra::Works::Characterization
|
|
87
89
|
# fits_version needs a different name than it's target node since they're at the same level
|
88
90
|
t.fits_version(proxy: [:fits, :fits_v])
|
89
91
|
t.format_label(proxy: [:identification, :identity, :format_label])
|
90
|
-
# Can't use .mime_type because it's already defined for
|
92
|
+
# Can't use .mime_type because it's already defined for this dcoument so method missing won't work.
|
91
93
|
t.file_mime_type(proxy: [:identification, :identity, :mime_type])
|
92
94
|
t.exif_tool_version(proxy: [:identification, :identity, :tool, :exif_tool_version])
|
93
95
|
t.file_size(proxy: [:fileinfo, :file_size])
|
@@ -3,10 +3,15 @@ module Hydra::Works
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
validate :
|
7
|
-
|
8
|
-
|
9
|
-
return
|
6
|
+
validate :must_not_detect_viruses
|
7
|
+
|
8
|
+
def viruses?
|
9
|
+
return false unless original_file && original_file.new_record? # We have a new file to check
|
10
|
+
VirusCheckerService.file_has_virus?(original_file)
|
11
|
+
end
|
12
|
+
|
13
|
+
def must_not_detect_viruses
|
14
|
+
return true unless viruses?
|
10
15
|
errors.add(:base, "Failed to verify uploaded file is not a virus")
|
11
16
|
false
|
12
17
|
end
|
@@ -16,12 +16,12 @@ module Hydra::Works
|
|
16
16
|
@object = object
|
17
17
|
@source = source
|
18
18
|
@mapping = options.fetch(:parser_mapping, Hydra::Works::Characterization.mapper)
|
19
|
-
@parser_class = options.fetch(:parser_class, Hydra::Works::Characterization::
|
19
|
+
@parser_class = options.fetch(:parser_class, Hydra::Works::Characterization::FitsDocument)
|
20
20
|
@tools = options.fetch(:ch12n_tool, :fits)
|
21
21
|
end
|
22
22
|
|
23
23
|
# Get given source into form that can be passed to Hydra::FileCharacterization
|
24
|
-
# Use Hydra::FileCharacterization to extract metadata (an OM
|
24
|
+
# Use Hydra::FileCharacterization to extract metadata (an OM XML document)
|
25
25
|
# Get the terms (and their values) from the extracted metadata
|
26
26
|
# Assign the values of the terms to the properties of the object
|
27
27
|
def characterize
|
@@ -59,19 +59,19 @@ module Hydra::Works
|
|
59
59
|
|
60
60
|
# Use OM to parse metadata
|
61
61
|
def parse_metadata(metadata)
|
62
|
-
|
63
|
-
|
64
|
-
characterization_terms(
|
62
|
+
omdoc = parser_class.new
|
63
|
+
omdoc.ng_xml = Nokogiri::XML(metadata) if metadata.present?
|
64
|
+
characterization_terms(omdoc)
|
65
65
|
end
|
66
66
|
|
67
67
|
# Get proxy terms and values from the parser
|
68
|
-
def characterization_terms(
|
68
|
+
def characterization_terms(omdoc)
|
69
69
|
h = {}
|
70
|
-
|
70
|
+
omdoc.class.terminology.terms.each_pair do |key, target|
|
71
71
|
# a key is a proxy if its target responds to proxied_term
|
72
72
|
next unless target.respond_to? :proxied_term
|
73
73
|
begin
|
74
|
-
h[key] =
|
74
|
+
h[key] = omdoc.send(key)
|
75
75
|
rescue NoMethodError
|
76
76
|
next
|
77
77
|
end
|
data/lib/hydra/works/version.rb
CHANGED
data/lib/hydra/works.rb
CHANGED
data/spec/hydra/works/models/characterization/{fits_datastream_spec.rb → fits_document_spec.rb}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Hydra::Works::Characterization::
|
3
|
+
describe Hydra::Works::Characterization::FitsDocument do
|
4
4
|
it 'defines an xml template' do
|
5
5
|
templ = described_class.xml_template.remove_namespaces!
|
6
6
|
expect(templ.xpath('/fits/identification/identity/@toolname').first.value).to eq('FITS')
|
@@ -17,7 +17,7 @@ describe Hydra::Works::FileSet do
|
|
17
17
|
|
18
18
|
describe "#type" do
|
19
19
|
it "returns Object and FileSet" do
|
20
|
-
expect(subject.type).to
|
20
|
+
expect(subject.type).to contain_exactly(Hydra::PCDM::Vocab::PCDMTerms.Object, Hydra::Works::Vocab::WorksTerms.FileSet)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -34,7 +34,7 @@ describe Hydra::Works::FileSet do
|
|
34
34
|
|
35
35
|
subject { described_class.find(file_set.id).files }
|
36
36
|
|
37
|
-
it { is_expected.to
|
37
|
+
it { is_expected.to contain_exactly(file1, file2) }
|
38
38
|
end
|
39
39
|
|
40
40
|
describe '#in_works' do
|
@@ -130,7 +130,7 @@ describe Hydra::Works::CharacterizationService do
|
|
130
130
|
it 'assigns expected values to image properties.' do
|
131
131
|
expect(file.file_size).to eq(["11043"])
|
132
132
|
expect(file.byte_order).to eq(["big endian"])
|
133
|
-
expect(file.compression).to
|
133
|
+
expect(file.compression).to contain_exactly("JPEG 2000 Lossless", "JPEG 2000")
|
134
134
|
expect(file.width).to eq(["512"])
|
135
135
|
expect(file.height).to eq(["465"])
|
136
136
|
expect(file.color_space).to eq(["sRGB"])
|
metadata
CHANGED
@@ -1,35 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-works
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.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: 2016-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: active-fedora
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '9'
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 11.a
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '9'
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 11.a
|
33
13
|
- !ruby/object:Gem::Dependency
|
34
14
|
name: hydra-pcdm
|
35
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,6 +58,20 @@ dependencies:
|
|
78
58
|
- - ">="
|
79
59
|
- !ruby/object:Gem::Version
|
80
60
|
version: 0.3.3
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: om
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.1'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.1'
|
81
75
|
- !ruby/object:Gem::Dependency
|
82
76
|
name: bundler
|
83
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,7 +205,7 @@ files:
|
|
211
205
|
- hydra-works.gemspec
|
212
206
|
- lib/hydra/works.rb
|
213
207
|
- lib/hydra/works/characterization.rb
|
214
|
-
- lib/hydra/works/characterization/
|
208
|
+
- lib/hydra/works/characterization/fits_document.rb
|
215
209
|
- lib/hydra/works/characterization/fits_mapper.rb
|
216
210
|
- lib/hydra/works/characterization/schema/audio_schema.rb
|
217
211
|
- lib/hydra/works/characterization/schema/base_schema.rb
|
@@ -277,7 +271,7 @@ files:
|
|
277
271
|
- spec/fixtures/updated-file.txt
|
278
272
|
- spec/fixtures/world.png
|
279
273
|
- spec/hydra/works/characterization_spec.rb
|
280
|
-
- spec/hydra/works/models/characterization/
|
274
|
+
- spec/hydra/works/models/characterization/fits_document_spec.rb
|
281
275
|
- spec/hydra/works/models/collection_spec.rb
|
282
276
|
- spec/hydra/works/models/concerns/file_set/contained_files_spec.rb
|
283
277
|
- spec/hydra/works/models/concerns/file_set/mime_types_spec.rb
|
@@ -324,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
324
318
|
version: '0'
|
325
319
|
requirements: []
|
326
320
|
rubyforge_project:
|
327
|
-
rubygems_version: 2.5
|
321
|
+
rubygems_version: 2.4.5
|
328
322
|
signing_key:
|
329
323
|
specification_version: 4
|
330
324
|
summary: Fundamental repository data model for hydra
|
@@ -351,7 +345,7 @@ test_files:
|
|
351
345
|
- spec/fixtures/updated-file.txt
|
352
346
|
- spec/fixtures/world.png
|
353
347
|
- spec/hydra/works/characterization_spec.rb
|
354
|
-
- spec/hydra/works/models/characterization/
|
348
|
+
- spec/hydra/works/models/characterization/fits_document_spec.rb
|
355
349
|
- spec/hydra/works/models/collection_spec.rb
|
356
350
|
- spec/hydra/works/models/concerns/file_set/contained_files_spec.rb
|
357
351
|
- spec/hydra/works/models/concerns/file_set/mime_types_spec.rb
|