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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46a78de49a9573826cf094f2f8921d992235d00d
4
- data.tar.gz: 4bb2d7fe7f8000df1ee8b5019e55af47149d8b3a
3
+ metadata.gz: 88d92cb7b19334c1a8e7a4c98dc9acd6fc21ee45
4
+ data.tar.gz: 0f6107681d23b63de729610f23885e3b4da08ff1
5
5
  SHA512:
6
- metadata.gz: 79d51675b0bc6ab617eda83f7ea72036b5a106c8b921284db324138647416b2f06e532f39be7be4f567377568feb5becf3058702ea8b5088dc794b4a6a18cadc
7
- data.tar.gz: a3a0dde5bfe9cbda4ecf18379defd12e9e361273cdc54f31e34c886ab93cc983a77c590b9720d18d79b85ebffa33230c619f3aa4cb4ed50107e3060e10bcba9c
6
+ metadata.gz: 66f83b99b48425d77d36ebbc22c086860e4863ae01bce538fd0e520255a4a68376e20ff802506530c92508f68d1c2841d3a872b30c890b7ecc19a3366afdb744
7
+ data.tar.gz: bb0f4a9379ea95d7788d2fec2eb3803468853d6bc8289d3dcd67193aeea1edf478f60810af1522a616967f0e9be7bd9a666fdfe6feac23f4f3800e586d65f4ff
@@ -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
 
@@ -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", ">= 2.9.0")
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")
@@ -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
- init_with(self.class.find(self.pid, cast: false).inner_object)
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.init_with(DigitalObject.find(pid))
107
+ # post.init_with_object(DigitalObject.find(pid))
108
108
  # post.properties.title # => 'hello world'
109
- def init_with(inner_obj)
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.init_with(inner_object)
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.init_with DigitalObject.find(self.class,self.pid)
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 < Hash
3
-
4
- def initialize (obj)
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
- super()
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
- super
19
+ @hash[key]
15
20
  end
16
21
 
17
22
  def []= (key, val)
18
- @obj.inner_object.datastreams[key]=val# unless @obj.inner_object.new?
19
- super
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.init_with(inner)
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|
@@ -28,7 +28,7 @@ module ActiveFedora
28
28
  private
29
29
 
30
30
  def allocate_object
31
- active_fedora_class.allocate.init_with(solr_digital_object)
31
+ active_fedora_class.allocate.init_with_object(solr_digital_object)
32
32
  end
33
33
 
34
34
  def solr_digital_object
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "6.7.7"
2
+ VERSION = "6.7.8"
3
3
  end
@@ -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(Hash)
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
@@ -25,4 +25,10 @@ shared_examples_for "An ActiveModel" do
25
25
  subject
26
26
  end
27
27
 
28
+ # Because minitest assumes a method #assertions that is an integer.
29
+ attr_accessor :assertions
30
+ def assertions
31
+ @assertions ||= 0
32
+ end
33
+
28
34
  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
@@ -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.init_with to instantiate an object" do
63
- SpecModel::Basic.any_instance.should_receive(:init_with).and_return(SpecModel::Basic.new)
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.any_instance.should_receive(:object).and_raise(RestClient::ResourceNotFound)
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.init_with to instantiate an object" do
77
- SpecModel::Basic.any_instance.should_receive(:init_with).and_return(double("Model", :adapt_to_cmodel=>SpecModel::Basic.new ))
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
@@ -8,7 +8,7 @@ describe ActiveFedora do
8
8
  before(:all) do
9
9
  module SolrSpecModel
10
10
  class Basic < ActiveFedora::Base
11
- def init_with(inner_obj)
11
+ def init_with_object(inner_obj)
12
12
  end
13
13
  end
14
14
  end
@@ -38,7 +38,7 @@ describe ActiveFedora::SolrService do
38
38
  before(:all) do
39
39
  class AudioRecord
40
40
  attr_accessor :pid
41
- def init_with(inner_obj)
41
+ def init_with_object(inner_obj)
42
42
  self.pid = inner_obj.pid
43
43
  self
44
44
  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.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-02-26 00:00:00.000000000 Z
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.0
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.0
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.2.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.