active-fedora 9.2.0.rc2 → 9.2.0
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/lib/active_fedora/fedora_attributes.rb +2 -0
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/versionable.rb +6 -5
- data/spec/integration/directly_contains_one_association_spec.rb +8 -9
- data/spec/integration/versionable_spec.rb +37 -43
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d06c266076a65780ab8db396bf9940d5c2350be2
|
4
|
+
data.tar.gz: dc1ce79ba0ef5591a8fa580a77e70caa2785bbc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54d49974e1ac5efc17a321e51455d0778e2712055acec83bd1efbf424f8c9302d98e8d4186d8cb1fb095d225e1a5075ac9549f0172fd13669423e170d0d6eb11
|
7
|
+
data.tar.gz: 89731055f7e3b7f50873d26e9905926a4bd86f2da837a5e2903f017a52099750857de5a2ec3692641febc648023d3eb0299bd6281ff35f604276ba517702e952
|
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
v9.2.0
|
2
|
+
2015-07-08: Add comments to FedoraAttributes [ci skip] [Justin Coyne]
|
3
|
+
|
4
|
+
2015-07-01: Remove has_many_versions This no longer does anything meaninful, so
|
5
|
+
it has been removed to prevent confusion. [Justin Coyne]
|
6
|
+
|
1
7
|
v9.2.0.rc2
|
2
8
|
2015-06-30: Allow the FixityService to accept an RDF::URI [Justin Coyne]
|
3
9
|
|
@@ -6,6 +6,8 @@ module ActiveFedora
|
|
6
6
|
included do
|
7
7
|
include ActiveTriples::Properties
|
8
8
|
include ActiveTriples::Reflection
|
9
|
+
|
10
|
+
# get_values() is called by ActiveTriples in the PropertyBuilder
|
9
11
|
delegate :rdf_subject, :get_values, :type, to: :resource
|
10
12
|
|
11
13
|
property :has_model, predicate: ActiveFedora::RDF::Fcrepo::Model.hasModel
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module ActiveFedora
|
2
2
|
module Versionable
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
extend Deprecation
|
4
5
|
|
5
6
|
included do
|
6
7
|
class_attribute :versionable
|
@@ -8,7 +9,8 @@ module ActiveFedora
|
|
8
9
|
|
9
10
|
module ClassMethods
|
10
11
|
def has_many_versions
|
11
|
-
|
12
|
+
Deprecation.warn Versionable, "has_many_versions is deprecated and will be removed in ActiveFedora 11."
|
13
|
+
# self.versionable = true
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
@@ -26,7 +28,7 @@ module ActiveFedora
|
|
26
28
|
if reload
|
27
29
|
@versions = ActiveFedora::VersionsGraph.new << ::RDF::Reader.for(:ttl).new(versions_request)
|
28
30
|
else
|
29
|
-
@versions ||= ActiveFedora::VersionsGraph.new << ::RDF::Reader.for(:ttl).new(versions_request)
|
31
|
+
@versions ||= ActiveFedora::VersionsGraph.new << ::RDF::Reader.for(:ttl).new(versions_request)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
@@ -36,10 +38,9 @@ module ActiveFedora
|
|
36
38
|
resp.success?
|
37
39
|
end
|
38
40
|
|
39
|
-
#
|
40
|
-
# it queries Fedora directly to figure out if there are versions for the resource.
|
41
|
+
# Queries Fedora to figure out if there are versions for the resource.
|
41
42
|
def has_versions?
|
42
|
-
ActiveFedora.fedora.connection.head(versions_uri)
|
43
|
+
ActiveFedora.fedora.connection.head(versions_uri)
|
43
44
|
true
|
44
45
|
rescue Ldp::NotFound
|
45
46
|
false
|
@@ -5,22 +5,21 @@ describe ActiveFedora::Base do
|
|
5
5
|
class PageImage < ActiveFedora::Base
|
6
6
|
directly_contains :files, has_member_relation: ::RDF::URI.new("http://example.com/hasFiles"), class_name:"FileWithMetadata"
|
7
7
|
directly_contains_one :primary_file, through: :files, type: ::RDF::URI.new("http://example.com/primaryFile"), class_name:"FileWithMetadata"
|
8
|
-
directly_contains_one :
|
8
|
+
directly_contains_one :alternative_file, through: :files, type: ::RDF::URI.new("http://example.com/featuredFile"), class_name:'AlternativeFileWithMetadata'
|
9
9
|
end
|
10
10
|
|
11
11
|
class FileWithMetadata < ActiveFedora::File
|
12
12
|
include ActiveFedora::WithMetadata
|
13
13
|
end
|
14
|
-
class
|
14
|
+
class AlternativeFileWithMetadata < ActiveFedora::File
|
15
15
|
include ActiveFedora::WithMetadata
|
16
|
-
has_many_versions
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
20
19
|
after do
|
21
20
|
Object.send(:remove_const, :PageImage)
|
22
21
|
Object.send(:remove_const, :FileWithMetadata)
|
23
|
-
Object.send(:remove_const, :
|
22
|
+
Object.send(:remove_const, :AlternativeFileWithMetadata)
|
24
23
|
end
|
25
24
|
|
26
25
|
let(:page_image) { PageImage.create }
|
@@ -28,7 +27,7 @@ describe ActiveFedora::Base do
|
|
28
27
|
|
29
28
|
let(:a_file) { page_image.files.build }
|
30
29
|
let(:primary_file) { page_image.build_primary_file }
|
31
|
-
let(:
|
30
|
+
let(:alternative_file) { page_image.build_alternative_file }
|
32
31
|
let(:primary_sub_image) { page_image.build_primary_sub_image }
|
33
32
|
|
34
33
|
|
@@ -70,13 +69,13 @@ describe ActiveFedora::Base do
|
|
70
69
|
context "if class_name is set" do
|
71
70
|
before do
|
72
71
|
a_file.content = "I'm a file"
|
73
|
-
|
72
|
+
alternative_file.content = "I am too"
|
74
73
|
page_image.save!
|
75
74
|
end
|
76
|
-
subject { reloaded_page_image.
|
75
|
+
subject { reloaded_page_image.alternative_file }
|
77
76
|
it "uses the specified class to load objects" do
|
78
|
-
expect(subject).to eq
|
79
|
-
expect(subject).to be_instance_of
|
77
|
+
expect(subject).to eq alternative_file
|
78
|
+
expect(subject).to be_instance_of AlternativeFileWithMetadata
|
80
79
|
end
|
81
80
|
end
|
82
81
|
end
|
@@ -1,9 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
describe "deprecated behavior" do
|
4
|
+
it "has a warning" do
|
5
|
+
expect(Deprecation).to receive(:warn)
|
6
|
+
class WithVersions < ActiveFedora::Base
|
7
|
+
has_many_versions
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
Object.send(:remove_const, :WithVersions)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
3
16
|
describe "a versionable class" do
|
4
17
|
before do
|
5
18
|
class WithVersions < ActiveFedora::Base
|
6
|
-
has_many_versions
|
7
19
|
property :title, predicate: ::RDF::DC.title
|
8
20
|
end
|
9
21
|
end
|
@@ -16,8 +28,6 @@ describe "a versionable class" do
|
|
16
28
|
|
17
29
|
let(:current_year) { DateTime.now.year.to_s }
|
18
30
|
|
19
|
-
it { is_expected.to be_versionable }
|
20
|
-
|
21
31
|
describe 'sorting versions' do
|
22
32
|
before do
|
23
33
|
allow(subject).to receive(:fedora_versions) { versions }
|
@@ -116,15 +126,14 @@ describe "a versionable class" do
|
|
116
126
|
end
|
117
127
|
end
|
118
128
|
|
119
|
-
describe "a versionable rdf
|
129
|
+
describe "a versionable rdf file" do
|
120
130
|
before(:all) do
|
121
131
|
class VersionableDatastream < ActiveFedora::NtriplesRDFDatastream
|
122
|
-
has_many_versions
|
123
132
|
property :title, predicate: ::RDF::DC.title
|
124
133
|
end
|
125
134
|
|
126
135
|
class MockAFBase < ActiveFedora::Base
|
127
|
-
|
136
|
+
contains "descMetadata", class_name: 'VersionableDatastream', autocreate: true
|
128
137
|
end
|
129
138
|
end
|
130
139
|
|
@@ -144,11 +153,7 @@ describe "a versionable rdf datastream" do
|
|
144
153
|
context "that exists in the repository" do
|
145
154
|
let(:test_object) { MockAFBase.create }
|
146
155
|
|
147
|
-
|
148
|
-
expect(subject).to be_versionable
|
149
|
-
end
|
150
|
-
|
151
|
-
context "before creating the datastream" do
|
156
|
+
context "before creating the file" do
|
152
157
|
it "should not have versions" do
|
153
158
|
expect(subject.versions).to be_empty
|
154
159
|
end
|
@@ -157,7 +162,7 @@ describe "a versionable rdf datastream" do
|
|
157
162
|
end
|
158
163
|
end
|
159
164
|
|
160
|
-
context "after creating the
|
165
|
+
context "after creating the file" do
|
161
166
|
before do
|
162
167
|
subject.title = "Greetings Earthlings"
|
163
168
|
subject.save
|
@@ -215,11 +220,11 @@ describe "a versionable rdf datastream" do
|
|
215
220
|
expect(subject.versions.all.size).to eq 2
|
216
221
|
end
|
217
222
|
|
218
|
-
it "should load the restored
|
223
|
+
it "should load the restored file's content" do
|
219
224
|
expect(subject.title).to eql(["Greetings Earthlings"])
|
220
225
|
end
|
221
226
|
|
222
|
-
it "should be the same size as the original
|
227
|
+
it "should be the same size as the original file" do
|
223
228
|
expect(subject.size).to eq @original_size
|
224
229
|
end
|
225
230
|
|
@@ -249,10 +254,9 @@ describe "a versionable rdf datastream" do
|
|
249
254
|
end
|
250
255
|
end
|
251
256
|
|
252
|
-
describe "a versionable OM
|
257
|
+
describe "a versionable OM file" do
|
253
258
|
before(:all) do
|
254
259
|
class VersionableDatastream < ActiveFedora::OmDatastream
|
255
|
-
has_many_versions
|
256
260
|
set_terminology do |t|
|
257
261
|
t.root(path: "foo")
|
258
262
|
t.title
|
@@ -260,7 +264,7 @@ describe "a versionable OM datastream" do
|
|
260
264
|
end
|
261
265
|
|
262
266
|
class MockAFBase < ActiveFedora::Base
|
263
|
-
|
267
|
+
contains "descMetadata", class_name: 'VersionableDatastream', autocreate: true
|
264
268
|
end
|
265
269
|
end
|
266
270
|
|
@@ -276,11 +280,7 @@ describe "a versionable OM datastream" do
|
|
276
280
|
context "that exists in the repository" do
|
277
281
|
let(:test_object) { MockAFBase.create }
|
278
282
|
|
279
|
-
|
280
|
-
expect(subject).to be_versionable
|
281
|
-
end
|
282
|
-
|
283
|
-
context "before creating the datastream" do
|
283
|
+
context "before creating the file" do
|
284
284
|
it "should not have versions" do
|
285
285
|
expect(subject.versions).to be_empty
|
286
286
|
end
|
@@ -289,7 +289,7 @@ describe "a versionable OM datastream" do
|
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
292
|
-
context "after creating the
|
292
|
+
context "after creating the file" do
|
293
293
|
before do
|
294
294
|
subject.title = "Greetings Earthlings"
|
295
295
|
subject.save
|
@@ -349,11 +349,11 @@ describe "a versionable OM datastream" do
|
|
349
349
|
expect(subject.versions.all.size).to eq 2
|
350
350
|
end
|
351
351
|
|
352
|
-
it "should load the restored
|
352
|
+
it "should load the restored file's content" do
|
353
353
|
expect(subject.title).to eql(["Greetings Earthlings"])
|
354
354
|
end
|
355
355
|
|
356
|
-
it "should be the same size as the original
|
356
|
+
it "should be the same size as the original file" do
|
357
357
|
expect(subject.size).to eq @original_size
|
358
358
|
end
|
359
359
|
|
@@ -383,14 +383,13 @@ describe "a versionable OM datastream" do
|
|
383
383
|
end
|
384
384
|
end
|
385
385
|
|
386
|
-
describe "a versionable binary
|
386
|
+
describe "a versionable binary file" do
|
387
387
|
before(:all) do
|
388
388
|
class BinaryDatastream < ActiveFedora::File
|
389
|
-
has_many_versions
|
390
389
|
end
|
391
390
|
|
392
391
|
class MockAFBase < ActiveFedora::Base
|
393
|
-
|
392
|
+
contains "content", class_name: 'BinaryDatastream', autocreate: true
|
394
393
|
end
|
395
394
|
end
|
396
395
|
|
@@ -406,17 +405,13 @@ describe "a versionable binary datastream" do
|
|
406
405
|
context "that exists in the repository" do
|
407
406
|
let(:test_object) { MockAFBase.create }
|
408
407
|
|
409
|
-
|
410
|
-
expect(subject).to be_versionable
|
411
|
-
end
|
412
|
-
|
413
|
-
context "before creating the datastream" do
|
408
|
+
context "before creating the file" do
|
414
409
|
it "should not have versions" do
|
415
410
|
expect(subject.versions).to be_empty
|
416
411
|
end
|
417
412
|
end
|
418
413
|
|
419
|
-
context "after creating the
|
414
|
+
context "after creating the file" do
|
420
415
|
let(:first_file) { File.new(File.join( File.dirname(__FILE__), "../fixtures/dino.jpg" )) }
|
421
416
|
let(:first_name) { "dino.jpg" }
|
422
417
|
before do
|
@@ -484,11 +479,11 @@ describe "a versionable binary datastream" do
|
|
484
479
|
expect(subject.versions.all.size).to eq 2
|
485
480
|
end
|
486
481
|
|
487
|
-
it "should load the restored
|
482
|
+
it "should load the restored file's content" do
|
488
483
|
expect(subject.content.size).to eq first_file.size
|
489
484
|
end
|
490
485
|
|
491
|
-
it "should load the restored
|
486
|
+
it "should load the restored file's original name" do
|
492
487
|
expect(subject.original_name).to eql(first_name)
|
493
488
|
end
|
494
489
|
|
@@ -517,19 +512,18 @@ describe "a versionable binary datastream" do
|
|
517
512
|
end
|
518
513
|
end
|
519
514
|
|
520
|
-
describe "
|
521
|
-
before
|
522
|
-
class
|
523
|
-
# explicitly don't call has_many_versions
|
515
|
+
describe "an ActiveFedora::Base" do
|
516
|
+
before do
|
517
|
+
class TestBase < ActiveFedora::Base
|
524
518
|
property :title, predicate: ::RDF::DC.title
|
525
519
|
end
|
526
520
|
end
|
527
521
|
|
528
|
-
after
|
529
|
-
Object.send(:remove_const, :
|
522
|
+
after do
|
523
|
+
Object.send(:remove_const, :TestBase)
|
530
524
|
end
|
531
525
|
|
532
|
-
subject {
|
526
|
+
subject { TestBase.new }
|
533
527
|
|
534
528
|
context "saved with no versions" do
|
535
529
|
it "should not have versions" do
|
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.2.0
|
4
|
+
version: 9.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-07-
|
13
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rsolr
|
@@ -598,9 +598,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
598
598
|
version: 1.9.3
|
599
599
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
600
600
|
requirements:
|
601
|
-
- - "
|
601
|
+
- - ">="
|
602
602
|
- !ruby/object:Gem::Version
|
603
|
-
version:
|
603
|
+
version: '0'
|
604
604
|
requirements: []
|
605
605
|
rubyforge_project:
|
606
606
|
rubygems_version: 2.4.8
|