active-fedora 9.10.2 → 9.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +6 -0
- data/active-fedora.gemspec +2 -1
- data/lib/active_fedora/file.rb +1 -16
- data/lib/active_fedora/file/attributes.rb +6 -6
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/with_metadata/metadata_node.rb +1 -2
- data/spec/integration/attached_files_spec.rb +4 -4
- data/spec/integration/file_spec.rb +1 -1
- data/spec/integration/om_datastream_spec.rb +6 -6
- data/spec/unit/file_spec.rb +0 -19
- 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: 5cc40ed1e9090196b8eda7d8d01842dfc3bcea31
|
4
|
+
data.tar.gz: 64beb6b92e85434dacfeb17ac85b5d82c3c2d387
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1f0cc15317a6daa6c03691dd9ea6741f0b57c6034c44cd574a3b3ad5022721fa334e259d1bdbe7da334696c98fc0a27b3075140160f6df1b30d4f15d7cce01b
|
7
|
+
data.tar.gz: b2ed142ebf13b8f7dc6b13a9ce7dd304c6adfadb509fd2f3740d7d0cf313784a5d467162279fe6418dc8c9a3f421192e74593087a358ba17660defe3874600c4
|
data/History.txt
CHANGED
data/active-fedora.gemspec
CHANGED
@@ -36,7 +36,8 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_development_dependency "rspec-its"
|
37
37
|
s.add_development_dependency "equivalent-xml"
|
38
38
|
s.add_development_dependency "simplecov", '~> 0.8'
|
39
|
-
|
39
|
+
# Pin to rubocop 0.38.0 due to https://github.com/nevir/rubocop-rspec/issues/78
|
40
|
+
s.add_development_dependency "rubocop", '~> 0.38.0'
|
40
41
|
s.add_development_dependency "rubocop-rspec", '~> 1.4'
|
41
42
|
|
42
43
|
s.files = `git ls-files`.split("\n")
|
data/lib/active_fedora/file.rb
CHANGED
@@ -63,12 +63,6 @@ module ActiveFedora
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
def save
|
67
|
-
super.tap do
|
68
|
-
metadata.save if metadata.changed?
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
66
|
def described_by
|
73
67
|
raise "#{self} isn't persisted yet" if new_record?
|
74
68
|
links['describedby'].first
|
@@ -120,7 +114,6 @@ module ActiveFedora
|
|
120
114
|
def attribute_will_change!(attr)
|
121
115
|
if attr == 'content'
|
122
116
|
changed_attributes['content'] = true
|
123
|
-
elsif attr == 'type'
|
124
117
|
else
|
125
118
|
super
|
126
119
|
end
|
@@ -145,15 +138,7 @@ module ActiveFedora
|
|
145
138
|
end
|
146
139
|
|
147
140
|
def changed?
|
148
|
-
super || content_changed?
|
149
|
-
end
|
150
|
-
|
151
|
-
def metadata_changed?
|
152
|
-
if new_record? || links['describedby'].blank?
|
153
|
-
false
|
154
|
-
else
|
155
|
-
metadata.changed?
|
156
|
-
end
|
141
|
+
super || content_changed?
|
157
142
|
end
|
158
143
|
|
159
144
|
def inspect
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module ActiveFedora::File::Attributes
|
2
|
+
attr_writer :mime_type
|
3
|
+
|
2
4
|
def mime_type
|
3
|
-
fetch_mime_type
|
5
|
+
@mime_type ||= fetch_mime_type
|
4
6
|
end
|
5
7
|
|
6
|
-
delegate :mime_type=, to: :metadata
|
7
|
-
|
8
8
|
def original_name
|
9
9
|
@original_name ||= fetch_original_name
|
10
10
|
end
|
@@ -25,7 +25,7 @@ module ActiveFedora::File::Attributes
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def dirty_size
|
28
|
-
content.size if
|
28
|
+
content.size if changed? && content.respond_to?(:size)
|
29
29
|
end
|
30
30
|
|
31
31
|
def size
|
@@ -68,8 +68,8 @@ module ActiveFedora::File::Attributes
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def fetch_mime_type
|
71
|
-
return default_mime_type if new_record?
|
72
|
-
|
71
|
+
return default_mime_type if new_record?
|
72
|
+
ldp_source.head.content_type
|
73
73
|
end
|
74
74
|
|
75
75
|
def fetch_original_name
|
@@ -2,7 +2,6 @@ module ActiveFedora
|
|
2
2
|
module WithMetadata
|
3
3
|
class MetadataNode < ActiveTriples::Resource
|
4
4
|
include ActiveModel::Dirty
|
5
|
-
property :mime_type, predicate: ::RDF::URI("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasMimeType")
|
6
5
|
attr_reader :file
|
7
6
|
|
8
7
|
def initialize(file)
|
@@ -46,7 +45,7 @@ module ActiveFedora
|
|
46
45
|
|
47
46
|
def changed_attributes
|
48
47
|
super.tap do |changed|
|
49
|
-
changed['type'] = true if type.present?
|
48
|
+
changed['type'] = true if type.present?
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
@@ -63,13 +63,13 @@ describe ActiveFedora::AttachedFiles do
|
|
63
63
|
|
64
64
|
it "creates datastreams from the spec on new objects" do
|
65
65
|
has_file.file_ds.content = "blah blah blah"
|
66
|
-
expect(has_file.file_ds).to
|
67
|
-
expect(has_file.file_ds2).to_not
|
66
|
+
expect(has_file.file_ds).to be_changed
|
67
|
+
expect(has_file.file_ds2).to_not be_changed # no autocreate
|
68
68
|
expect(has_file.file_ds2).to be_new_record
|
69
69
|
has_file.save
|
70
70
|
has_file.reload
|
71
|
-
expect(has_file.file_ds).to_not
|
72
|
-
expect(has_file.file_ds2).to_not
|
71
|
+
expect(has_file.file_ds).to_not be_changed
|
72
|
+
expect(has_file.file_ds2).to_not be_changed # no autocreate
|
73
73
|
expect(has_file.file_ds2).to be_new_record
|
74
74
|
end
|
75
75
|
end
|
@@ -109,7 +109,7 @@ describe ActiveFedora::File do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it "is not changed" do
|
112
|
-
expect(test_object.attached_files[path]).to_not
|
112
|
+
expect(test_object.attached_files[path]).to_not be_changed
|
113
113
|
end
|
114
114
|
|
115
115
|
it "is able to read the content from fedora" do
|
@@ -30,15 +30,15 @@ describe ActiveFedora::OmDatastream do
|
|
30
30
|
end
|
31
31
|
it "does not be changed if the new xml matches the old xml" do
|
32
32
|
subject.content = subject.content
|
33
|
-
expect(subject).to_not
|
33
|
+
expect(subject).to_not be_changed
|
34
34
|
end
|
35
35
|
|
36
36
|
it "is changed if there are minor differences in whitespace" do
|
37
37
|
subject.content = "<a><b>1</b></a>"
|
38
38
|
obj.save
|
39
|
-
expect(subject).to_not
|
39
|
+
expect(subject).to_not be_changed
|
40
40
|
subject.content = "<a>\n<b>1</b>\n</a>"
|
41
|
-
expect(subject).to
|
41
|
+
expect(subject).to be_changed
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -56,11 +56,11 @@ describe ActiveFedora::OmDatastream do
|
|
56
56
|
obj.reload
|
57
57
|
end
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "does not be dirty after .update_values is saved" do
|
60
60
|
obj.descMetadata.update_values([{ name: 0 }, { role: 0 }, :text] => "Funder")
|
61
|
-
expect(obj.descMetadata).to
|
61
|
+
expect(obj.descMetadata).to be_changed
|
62
62
|
obj.save
|
63
|
-
expect(obj.descMetadata).to_not
|
63
|
+
expect(obj.descMetadata).to_not be_changed
|
64
64
|
expect(obj.descMetadata.term_values({ name: 0 }, { role: 0 }, :text)).to eq ["Funder"]
|
65
65
|
end
|
66
66
|
end
|
data/spec/unit/file_spec.rb
CHANGED
@@ -185,25 +185,6 @@ describe ActiveFedora::File do
|
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
188
|
-
describe "#mime_type" do
|
189
|
-
let(:parent) { ActiveFedora::Base.create }
|
190
|
-
before do
|
191
|
-
parent.add_file('banana', path: 'apple', mime_type: 'video/webm')
|
192
|
-
parent.save!
|
193
|
-
end
|
194
|
-
it "persists" do
|
195
|
-
expect(parent.reload.apple.mime_type).to eq "video/webm"
|
196
|
-
end
|
197
|
-
it "can be updated" do
|
198
|
-
parent.reload
|
199
|
-
parent.apple.mime_type = "text/awesome"
|
200
|
-
expect(parent.apple.mime_type).to eq "text/awesome"
|
201
|
-
parent.save
|
202
|
-
|
203
|
-
expect(parent.reload.apple.mime_type).to eq "text/awesome"
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
188
|
context "original_name" do
|
208
189
|
subject { file.original_name }
|
209
190
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fedora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.10.
|
4
|
+
version: 9.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt
|
@@ -316,14 +316,14 @@ dependencies:
|
|
316
316
|
requirements:
|
317
317
|
- - "~>"
|
318
318
|
- !ruby/object:Gem::Version
|
319
|
-
version:
|
319
|
+
version: 0.38.0
|
320
320
|
type: :development
|
321
321
|
prerelease: false
|
322
322
|
version_requirements: !ruby/object:Gem::Requirement
|
323
323
|
requirements:
|
324
324
|
- - "~>"
|
325
325
|
- !ruby/object:Gem::Version
|
326
|
-
version:
|
326
|
+
version: 0.38.0
|
327
327
|
- !ruby/object:Gem::Dependency
|
328
328
|
name: rubocop-rspec
|
329
329
|
requirement: !ruby/object:Gem::Requirement
|