active-fedora 6.7.7 → 6.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +3 -0
- data/active-fedora.gemspec +1 -1
- data/lib/active_fedora/base.rb +5 -5
- data/lib/active_fedora/datastream_hash.rb +13 -8
- data/lib/active_fedora/querying.rb +1 -1
- data/lib/active_fedora/rdf_datastream.rb +4 -1
- data/lib/active_fedora/solr_instance_loader.rb +1 -1
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/base_spec.rb +1 -1
- data/spec/support/an_active_model.rb +6 -0
- data/spec/unit/datastreams_spec.rb +4 -0
- data/spec/unit/query_spec.rb +5 -5
- data/spec/unit/solr_config_options_spec.rb +1 -1
- data/spec/unit/solr_service_spec.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88d92cb7b19334c1a8e7a4c98dc9acd6fc21ee45
|
4
|
+
data.tar.gz: 0f6107681d23b63de729610f23885e3b4da08ff1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66f83b99b48425d77d36ebbc22c086860e4863ae01bce538fd0e520255a4a68376e20ff802506530c92508f68d1c2841d3a872b30c890b7ecc19a3366afdb744
|
7
|
+
data.tar.gz: bb0f4a9379ea95d7788d2fec2eb3803468853d6bc8289d3dcd67193aeea1edf478f60810af1522a616967f0e9be7bd9a666fdfe6feac23f4f3800e586d65f4ff
|
data/History.txt
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
v6.7.8
|
2
|
+
Backported changes from master for proper deserialization of ActiveFedora::DatastreamHash (Fixed #439) [Michael B. Klein]
|
3
|
+
|
1
4
|
v6.7.7
|
2
5
|
Backported changes from master for rubydora 1.7.1+ compatibility (Fixes #354). Upgraded rubydora to ~> 1.7.4. [David Chandek-Stark]
|
3
6
|
|
data/active-fedora.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency("RedCloth") # for RDoc formatting
|
29
29
|
s.add_development_dependency("rake")
|
30
30
|
s.add_development_dependency("jettywrapper", ">=1.4.0")
|
31
|
-
s.add_development_dependency("rspec", "
|
31
|
+
s.add_development_dependency("rspec", "~> 2.9")
|
32
32
|
s.add_development_dependency("equivalent-xml")
|
33
33
|
s.add_development_dependency("rest-client")
|
34
34
|
s.add_development_dependency("webmock")
|
data/lib/active_fedora/base.rb
CHANGED
@@ -93,7 +93,7 @@ module ActiveFedora
|
|
93
93
|
def reload
|
94
94
|
raise ActiveFedora::ObjectNotFoundError, "Can't reload an object that hasn't been saved" unless persisted?
|
95
95
|
clear_association_cache
|
96
|
-
|
96
|
+
init_with_object(self.class.find(self.pid, cast: false).inner_object)
|
97
97
|
end
|
98
98
|
|
99
99
|
# Initialize an empty model object and set the +inner_obj+
|
@@ -104,9 +104,9 @@ module ActiveFedora
|
|
104
104
|
# end
|
105
105
|
#
|
106
106
|
# post = Post.allocate
|
107
|
-
# post.
|
107
|
+
# post.init_with_object(DigitalObject.find(pid))
|
108
108
|
# post.properties.title # => 'hello world'
|
109
|
-
def
|
109
|
+
def init_with_object(inner_obj)
|
110
110
|
@association_cache = {}
|
111
111
|
@inner_object = inner_obj
|
112
112
|
unless @inner_object.is_a? SolrDigitalObject
|
@@ -279,7 +279,7 @@ module ActiveFedora
|
|
279
279
|
unless klass.ancestors.include? ActiveFedora::Base
|
280
280
|
raise "Cannot adapt #{self.class.name} to #{klass.name}: Not a ActiveFedora::Base subclass"
|
281
281
|
end
|
282
|
-
klass.allocate.
|
282
|
+
klass.allocate.init_with_object(inner_object)
|
283
283
|
end
|
284
284
|
|
285
285
|
# Examines the :has_model assertions in the RELS-EXT.
|
@@ -328,7 +328,7 @@ module ActiveFedora
|
|
328
328
|
if self.inner_object.is_a? DigitalObject
|
329
329
|
raise "#{self.inspect} is already a full digital object"
|
330
330
|
end
|
331
|
-
self.
|
331
|
+
self.init_with_object DigitalObject.find(self.class,self.pid)
|
332
332
|
end
|
333
333
|
|
334
334
|
def self.pids_from_uris(uris)
|
@@ -1,9 +1,14 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
|
1
3
|
module ActiveFedora
|
2
|
-
class DatastreamHash
|
3
|
-
|
4
|
-
|
4
|
+
class DatastreamHash
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def_delegators :@hash, *(Hash.instance_methods(false))
|
8
|
+
|
9
|
+
def initialize (obj, &block)
|
5
10
|
@obj = obj
|
6
|
-
|
11
|
+
@hash = Hash.new &block
|
7
12
|
end
|
8
13
|
|
9
14
|
def [] (key)
|
@@ -11,12 +16,12 @@ module ActiveFedora
|
|
11
16
|
ds = Datastream.new(@obj.inner_object, key, :controlGroup=>'X')
|
12
17
|
self[key] = ds
|
13
18
|
end
|
14
|
-
|
19
|
+
@hash[key]
|
15
20
|
end
|
16
21
|
|
17
22
|
def []= (key, val)
|
18
|
-
@obj.inner_object.datastreams[key]=val
|
19
|
-
|
20
|
-
end
|
23
|
+
@obj.inner_object.datastreams[key]=val
|
24
|
+
@hash[key]=val
|
25
|
+
end
|
21
26
|
end
|
22
27
|
end
|
@@ -121,7 +121,7 @@ module ActiveFedora
|
|
121
121
|
Deprecation.warn(Querying, "find_one's cast parameter will default to true in ActiveFedora 7.0.0. If you want to maintain your existing behavior set `false' as the second parameter.", caller)
|
122
122
|
end
|
123
123
|
inner = DigitalObject.find(self, pid)
|
124
|
-
af_base = self.allocate.
|
124
|
+
af_base = self.allocate.init_with_object(inner)
|
125
125
|
cast ? af_base.adapt_to_cmodel : af_base
|
126
126
|
end
|
127
127
|
|
@@ -73,8 +73,11 @@ module ActiveFedora
|
|
73
73
|
def deserialize(data = nil)
|
74
74
|
repository = RDF::Repository.new
|
75
75
|
return repository if new? and data.nil?
|
76
|
-
|
77
76
|
data ||= datastream_content
|
77
|
+
|
78
|
+
# Because datastream_content can return nil, we should check that here.
|
79
|
+
return repository if data.nil?
|
80
|
+
|
78
81
|
data.force_encoding('utf-8')
|
79
82
|
RDF::Reader.for(serialization_format).new(data) do |reader|
|
80
83
|
reader.each_statement do |statement|
|
@@ -252,7 +252,7 @@ describe ActiveFedora::Base do
|
|
252
252
|
describe ".datastreams" do
|
253
253
|
it "should return a Hash of datastreams from fedora" do
|
254
254
|
datastreams = @test_object.datastreams
|
255
|
-
datastreams.should be_a_kind_of(
|
255
|
+
datastreams.should be_a_kind_of(ActiveFedora::DatastreamHash)
|
256
256
|
datastreams.each_value do |ds|
|
257
257
|
ds.should be_a_kind_of(ActiveFedora::Datastream)
|
258
258
|
end
|
@@ -86,6 +86,10 @@ describe ActiveFedora::Datastreams do
|
|
86
86
|
subject.stub(:load_datastreams)
|
87
87
|
subject.datastreams.should be_a_kind_of(ActiveFedora::DatastreamHash)
|
88
88
|
end
|
89
|
+
|
90
|
+
it "should round-trip to/from YAML" do
|
91
|
+
YAML.load(subject.datastreams.to_yaml).inspect.should == subject.datastreams.inspect
|
92
|
+
end
|
89
93
|
end
|
90
94
|
|
91
95
|
describe "#configure_datastream" do
|
data/spec/unit/query_spec.rb
CHANGED
@@ -59,13 +59,13 @@ describe ActiveFedora::Base do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
describe "and a pid is specified" do
|
62
|
-
it "should use SpecModel::Basic.allocate.
|
63
|
-
SpecModel::Basic.
|
62
|
+
it "should use SpecModel::Basic.allocate.init_with_object to instantiate an object" do
|
63
|
+
allow_any_instance_of(SpecModel::Basic).to receive(:init_with_object).and_return(SpecModel::Basic.new)
|
64
64
|
ActiveFedora::DigitalObject.should_receive(:find).and_return(double("inner obj", :'new?'=>false))
|
65
65
|
SpecModel::Basic.find("_PID_").should be_a SpecModel::Basic
|
66
66
|
end
|
67
67
|
it "should raise an exception if it is not found" do
|
68
|
-
Rubydora::Fc3Service.
|
68
|
+
allow_any_instance_of(Rubydora::Fc3Service).to receive(:object).and_raise(RestClient::ResourceNotFound)
|
69
69
|
|
70
70
|
SpecModel::Basic.should_receive(:connection_for_pid).with("_PID_")
|
71
71
|
lambda {SpecModel::Basic.find("_PID_")}.should raise_error ActiveFedora::ObjectNotFoundError
|
@@ -73,8 +73,8 @@ describe ActiveFedora::Base do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
describe "with :cast" do
|
76
|
-
it "should use SpecModel::Basic.allocate.
|
77
|
-
SpecModel::Basic.
|
76
|
+
it "should use SpecModel::Basic.allocate.init_with_object to instantiate an object" do
|
77
|
+
allow_any_instance_of(SpecModel::Basic).to receive(:init_with_object).and_return(double("Model", :adapt_to_cmodel=>SpecModel::Basic.new ))
|
78
78
|
ActiveFedora::DigitalObject.should_receive(:find).and_return(double("inner obj", :'new?'=>false))
|
79
79
|
SpecModel::Basic.find("_PID_", :cast=>true)
|
80
80
|
end
|
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: 6.7.
|
4
|
+
version: 6.7.8
|
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: 2014-
|
13
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rsolr
|
@@ -212,16 +212,16 @@ dependencies:
|
|
212
212
|
name: rspec
|
213
213
|
requirement: !ruby/object:Gem::Requirement
|
214
214
|
requirements:
|
215
|
-
- -
|
215
|
+
- - ~>
|
216
216
|
- !ruby/object:Gem::Version
|
217
|
-
version: 2.9
|
217
|
+
version: '2.9'
|
218
218
|
type: :development
|
219
219
|
prerelease: false
|
220
220
|
version_requirements: !ruby/object:Gem::Requirement
|
221
221
|
requirements:
|
222
|
-
- -
|
222
|
+
- - ~>
|
223
223
|
- !ruby/object:Gem::Version
|
224
|
-
version: 2.9
|
224
|
+
version: '2.9'
|
225
225
|
- !ruby/object:Gem::Dependency
|
226
226
|
name: equivalent-xml
|
227
227
|
requirement: !ruby/object:Gem::Requirement
|
@@ -550,7 +550,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
550
550
|
version: '0'
|
551
551
|
requirements: []
|
552
552
|
rubyforge_project:
|
553
|
-
rubygems_version: 2.
|
553
|
+
rubygems_version: 2.0.14
|
554
554
|
signing_key:
|
555
555
|
specification_version: 4
|
556
556
|
summary: A convenience libary for manipulating documents in the Fedora Repository.
|