hydra-works 0.11.0 → 0.12.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.rb +1 -1
- data/lib/hydra/works/characterization/schema/base_schema.rb +0 -1
- data/lib/hydra/works/services/characterization_service.rb +3 -2
- data/lib/hydra/works/version.rb +1 -1
- data/spec/hydra/works/characterization_spec.rb +1 -2
- data/spec/hydra/works/services/characterization_service_spec.rb +6 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e77105c445c81cd7873a54cad597eadb5a198fe0
|
4
|
+
data.tar.gz: 7d44f5ff84c003281edbc1bddc215990d82fdd6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64a1886d82a60a5924ca47df852189f02018d2c258385a0a537394946974291d0e09a3c54c4cadda75c1fadc94b74b1a3b1e0b8278d13d48aeb11c2270f362f6
|
7
|
+
data.tar.gz: 9de36d3c3e4c1c60a8f257f15794bbe6f5494adff7a6e6b1c466cea7796dae3a8d3fbd02e0981abb2786205f0e62134dfb7d91dd0fa139bf14c8014fcd38bf31
|
@@ -10,7 +10,7 @@ module Hydra::Works
|
|
10
10
|
|
11
11
|
def mapper_defaults
|
12
12
|
{ audio_duration: :duration, audio_sample_rate: :sample_rate, exif_tool_version: :exif_version,
|
13
|
-
file_author: :creator, file_language: :language, file_mime_type: :
|
13
|
+
file_author: :creator, file_language: :language, file_mime_type: :mime_type,
|
14
14
|
video_audio_sample_rate: :sample_rate, video_duration: :duration, video_height: :height,
|
15
15
|
video_sample_rate: :sample_rate, video_width: :width }
|
16
16
|
end
|
@@ -8,6 +8,5 @@ module Hydra::Works::Characterization
|
|
8
8
|
property :fits_version, predicate: RDF::Vocab::PREMIS.hasCreatingApplicationVersion
|
9
9
|
property :exif_version, predicate: RDF::Vocab::EXIF.exifVersion
|
10
10
|
property :original_checksum, predicate: RDF::Vocab::NFO.hashValue
|
11
|
-
property :mime_type, predicate: RDF::Vocab::EBUCore.hasMimeType
|
12
11
|
end
|
13
12
|
end
|
@@ -37,6 +37,7 @@ module Hydra::Works
|
|
37
37
|
def source_to_content
|
38
38
|
return object.content if source.nil?
|
39
39
|
return File.open(source).read if source.is_a? String
|
40
|
+
source.rewind
|
40
41
|
source.read
|
41
42
|
end
|
42
43
|
|
@@ -99,8 +100,8 @@ module Hydra::Works
|
|
99
100
|
end
|
100
101
|
|
101
102
|
def append_property_value(property, value)
|
102
|
-
value = object.send(property) + [value]
|
103
|
-
object.send("#{property}=", value
|
103
|
+
value = object.send(property) + [value] unless property == :mime_type
|
104
|
+
object.send("#{property}=", value)
|
104
105
|
end
|
105
106
|
end
|
106
107
|
end
|
data/lib/hydra/works/version.rb
CHANGED
@@ -10,7 +10,7 @@ describe Hydra::Works::Characterization do
|
|
10
10
|
it { is_expected.to respond_to(:file_name) }
|
11
11
|
it { is_expected.to respond_to(:file_size) }
|
12
12
|
it { is_expected.to respond_to(:date_created) }
|
13
|
-
it { is_expected.to respond_to(:
|
13
|
+
it { is_expected.to respond_to(:mime_type) }
|
14
14
|
it { is_expected.to respond_to(:date_modified) }
|
15
15
|
it { is_expected.to respond_to(:byte_order) }
|
16
16
|
end
|
@@ -23,7 +23,6 @@ describe Hydra::Works::Characterization do
|
|
23
23
|
it { is_expected.to respond_to(:fits_version) }
|
24
24
|
it { is_expected.to respond_to(:exif_version) }
|
25
25
|
it { is_expected.to respond_to(:original_checksum) }
|
26
|
-
it { is_expected.to respond_to(:mime_type) }
|
27
26
|
end
|
28
27
|
context "with Image schema" do
|
29
28
|
it { is_expected.to respond_to(:byte_order) }
|
@@ -16,9 +16,10 @@ describe Hydra::Works::CharacterizationService do
|
|
16
16
|
expect(file.file_size).to eq(["7618"])
|
17
17
|
expect(file.file_title).to eq(["sample-file"])
|
18
18
|
expect(file.page_count).to eq(["1"])
|
19
|
-
# Persist
|
20
|
-
|
21
|
-
expect(file.
|
19
|
+
# Persist our file with some content and reload
|
20
|
+
file.content = "junk"
|
21
|
+
expect(file.save).to be true
|
22
|
+
expect(file.reload).to eq({})
|
22
23
|
# Re-check property values
|
23
24
|
expect(file.file_size).to eq(["7618"])
|
24
25
|
expect(file.file_title).to eq(["sample-file"])
|
@@ -73,6 +74,7 @@ describe Hydra::Works::CharacterizationService do
|
|
73
74
|
it 'passes the File to FileCharacterization.' do
|
74
75
|
file_inst = File.new(File.join(fixture_path, filename))
|
75
76
|
expect(Hydra::FileCharacterization).to receive(:characterize).with(file_content, filename, :fits)
|
77
|
+
expect(file_inst).to receive(:rewind)
|
76
78
|
described_class.run(file, file_inst)
|
77
79
|
end
|
78
80
|
end
|
@@ -151,7 +153,7 @@ describe Hydra::Works::CharacterizationService do
|
|
151
153
|
let(:fits_response) { IO.read(File.join(fixture_path, fits_filename)) }
|
152
154
|
|
153
155
|
it 'assigns expected values to audio properties.' do
|
154
|
-
expect(file.
|
156
|
+
expect(file.mime_type).to eq("audio/mpeg")
|
155
157
|
expect(file.duration).to eq(["0:0:15:261"])
|
156
158
|
expect(file.sample_rate).to eq(["44100"])
|
157
159
|
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.12.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-05-
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hydra-pcdm
|
@@ -304,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
304
304
|
version: '0'
|
305
305
|
requirements: []
|
306
306
|
rubyforge_project:
|
307
|
-
rubygems_version: 2.4
|
307
|
+
rubygems_version: 2.6.4
|
308
308
|
signing_key:
|
309
309
|
specification_version: 4
|
310
310
|
summary: Fundamental repository data model for hydra
|