active-fedora 4.4.0 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active-fedora (4.4.0)
4
+ active-fedora (4.4.1)
5
5
  activeresource (>= 3.0.0)
6
6
  activesupport (>= 3.0.0)
7
+ deprecation
7
8
  equivalent-xml
8
9
  mediashelf-loggable
9
10
  om (~> 1.6.0)
10
11
  rdf
11
12
  rdf-rdfxml (~> 0.3.8)
12
13
  rsolr
13
- rubydora (~> 0.5.10)
14
+ rubydora (~> 0.5.11)
14
15
  solrizer (~> 1.2.0)
15
16
 
16
17
  GEM
@@ -30,12 +31,14 @@ GEM
30
31
  akami (1.2.0)
31
32
  gyoku (>= 0.4.0)
32
33
  nokogiri (>= 1.4.0)
33
- backports (2.6.1)
34
+ backports (2.6.2)
34
35
  builder (3.0.0)
35
36
  childprocess (0.3.3)
36
37
  ffi (~> 1.0.6)
37
38
  columnize (0.3.6)
38
39
  daemons (1.1.8)
40
+ deprecation (0.0.5)
41
+ activesupport
39
42
  diff-lcs (1.1.3)
40
43
  equivalent-xml (0.2.9)
41
44
  nokogiri (>= 1.4.3)
@@ -43,7 +46,8 @@ GEM
43
46
  ffi (1.0.11)
44
47
  gyoku (0.4.6)
45
48
  builder (>= 2.1.2)
46
- httpi (1.1.0)
49
+ hooks (0.2.0)
50
+ httpi (1.1.1)
47
51
  rack
48
52
  i18n (0.6.0)
49
53
  jettywrapper (1.3.0)
@@ -62,7 +66,7 @@ GEM
62
66
  metaclass (~> 0.0.1)
63
67
  multi_json (1.3.6)
64
68
  nokogiri (1.5.5)
65
- nori (1.1.0)
69
+ nori (1.1.3)
66
70
  om (1.6.1)
67
71
  mediashelf-loggable
68
72
  nokogiri (>= 1.4.2)
@@ -96,10 +100,12 @@ GEM
96
100
  ruby-debug-base (~> 0.10.4.0)
97
101
  ruby-debug-base (0.10.4)
98
102
  linecache (>= 0.3)
99
- rubydora (0.5.10)
103
+ rubydora (0.5.11)
100
104
  activemodel
101
105
  activesupport
106
+ deprecation
102
107
  fastercsv
108
+ hooks
103
109
  mime-types
104
110
  nokogiri
105
111
  rest-client
@@ -1,3 +1,7 @@
1
+ 4.4.1
2
+ HYDRA-834 find(:all) should work on ActiveFedora::Base
3
+ update AF to hide the deprecation warnings introduced in rubydora 0.5.11
4
+
1
5
  4.4.0
2
6
  Updated gem dependencies
3
7
  Deprecated #find_by_solr()
@@ -22,9 +22,10 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency("activesupport", '>= 3.0.0')
23
23
  s.add_dependency("mediashelf-loggable")
24
24
  s.add_dependency("equivalent-xml")
25
- s.add_dependency("rubydora", '~>0.5.10')
25
+ s.add_dependency("rubydora", '~>0.5.11')
26
26
  s.add_dependency("rdf")
27
27
  s.add_dependency("rdf-rdfxml", '~>0.3.8')
28
+ s.add_dependency("deprecation")
28
29
  s.add_development_dependency("yard")
29
30
  s.add_development_dependency("RedCloth") # for RDoc formatting
30
31
  s.add_development_dependency("rake")
@@ -4,6 +4,16 @@ module ActiveFedora
4
4
  attr_accessor :original_class
5
5
 
6
6
  def self.find(original_class, pid)
7
+ conn = original_class.connection_for_pid(pid)
8
+ obj = Deprecation.silence(Rubydora::DigitalObject) do
9
+ super(pid, conn)
10
+ end
11
+ obj.original_class = original_class
12
+ raise ActiveFedora::ObjectNotFoundError, "Unable to find '#{pid}' in fedora" if obj.new?
13
+ obj
14
+ end
15
+
16
+ def self.find_or_initialize(original_class, pid)
7
17
  conn = original_class.connection_for_pid(pid)
8
18
  obj = super(pid, conn)
9
19
  obj.original_class = original_class
@@ -5,9 +5,7 @@ module ActiveFedora
5
5
  # This module mixes various methods into the including class,
6
6
  # much in the way ActiveRecord does.
7
7
  module Model
8
- def self.included(klass) # :nodoc:
9
- klass.extend(ClassMethods)
10
- end
8
+ extend ActiveSupport::Concern
11
9
 
12
10
  # Takes a Fedora URI for a cModel and returns classname, namespace
13
11
  def self.classname_from_uri(uri)
@@ -164,7 +162,7 @@ module ActiveFedora
164
162
  # @param[String] pid
165
163
  # @return[boolean]
166
164
  def exists?(pid)
167
- inner = DigitalObject.find(self, pid)
165
+ inner = DigitalObject.find_or_initialize(self, pid)
168
166
  !inner.new?
169
167
  end
170
168
 
@@ -334,12 +332,11 @@ module ActiveFedora
334
332
  # Returns a solr query for the supplied conditions
335
333
  # @param[Hash] conditions solr conditions to match
336
334
  def create_query(conditions)
337
- return '' unless conditions
338
335
  conditions.kind_of?(Hash) ? create_query_from_hash(conditions) : create_query_from_string(conditions)
339
336
  end
340
337
 
341
338
  def create_query_from_hash(conditions)
342
- clauses = [search_model_clause]
339
+ clauses = search_model_clause ? [search_model_clause] : []
343
340
  conditions.each_pair do |key,value|
344
341
  unless value.nil?
345
342
  if value.is_a? Array
@@ -353,7 +350,7 @@ module ActiveFedora
353
350
  end
354
351
  end
355
352
  end
356
-
353
+ return "*:*" if clauses.empty?
357
354
  clauses.compact.join(" AND ")
358
355
  end
359
356
 
@@ -380,11 +377,9 @@ module ActiveFedora
380
377
  # Book.find_one("hydra:dataset1")
381
378
  def find_one(pid, cast=false)
382
379
  inner = DigitalObject.find(self, pid)
383
- raise ActiveFedora::ObjectNotFoundError, "Unable to find '#{pid}' in fedora" if inner.new?
384
380
  af_base = self.allocate.init_with(inner)
385
381
  cast ? af_base.adapt_to_cmodel : af_base
386
382
  end
387
-
388
383
  end
389
384
 
390
385
  private
@@ -26,7 +26,7 @@ module ActiveFedora
26
26
 
27
27
  ### Change this into a real digital object
28
28
  def save
29
- obj = DigitalObject.find(self.original_class, assign_pid)
29
+ obj = DigitalObject.find_or_initialize(self.original_class, assign_pid)
30
30
  self.datastreams.each do |k, v|
31
31
  v.digital_object = obj
32
32
  obj.datastreams[k] = v
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "4.4.0"
2
+ VERSION = "4.4.1"
3
3
  end
@@ -19,24 +19,41 @@ describe ActiveFedora::Model do
19
19
 
20
20
  describe '#find' do
21
21
  describe "without :cast" do
22
- it "(:all) should query solr for all objects with :active_fedora_model_s of self.class" do
23
- SpecModel::Basic.expects(:find_one).with("changeme:30", nil).returns("Fake Object1")
24
- SpecModel::Basic.expects(:find_one).with("changeme:22", nil).returns("Fake Object2")
25
- mock_docs = mock('docs')
26
- mock_docs.expects(:each).multiple_yields([{"id" => "changeme:30"}],[{"id" => "changeme:22"}])
27
- mock_docs.expects(:has_next?).returns(false)
28
- ActiveFedora::SolrService.instance.conn.expects(:paginate).with(1, 1000, 'select', :params=>{:q=>'has_model_s:info\\:fedora/afmodel\\:SpecModel_Basic', :qt => 'standard', :sort => ['system_create_dt asc'], :fl=> 'id', }).returns('response'=>{'docs'=>mock_docs})
29
- SpecModel::Basic.find(:all).should == ["Fake Object1", "Fake Object2"]
30
- end
31
- it "should use SpecModel::Basic.allocate.init_with to instantiate an object" do
32
- SpecModel::Basic.any_instance.expects(:init_with).returns(SpecModel::Basic.new)
33
- ActiveFedora::DigitalObject.expects(:find).returns(stub("inner obj", :'new?'=>false))
34
- SpecModel::Basic.find("_PID_").should be_a SpecModel::Basic
22
+ describe ":all" do
23
+ describe "called on a concrete class" do
24
+ it "should query solr for all objects with :has_model_s of self.class" do
25
+ SpecModel::Basic.expects(:find_one).with("changeme:30", nil).returns("Fake Object1")
26
+ SpecModel::Basic.expects(:find_one).with("changeme:22", nil).returns("Fake Object2")
27
+ mock_docs = mock('docs')
28
+ mock_docs.expects(:each).multiple_yields([{"id" => "changeme:30"}],[{"id" => "changeme:22"}])
29
+ mock_docs.expects(:has_next?).returns(false)
30
+ ActiveFedora::SolrService.instance.conn.expects(:paginate).with(1, 1000, 'select', :params=>{:q=>'has_model_s:info\\:fedora/afmodel\\:SpecModel_Basic', :qt => 'standard', :sort => ['system_create_dt asc'], :fl=> 'id', }).returns('response'=>{'docs'=>mock_docs})
31
+ SpecModel::Basic.find(:all).should == ["Fake Object1", "Fake Object2"]
32
+ end
33
+ end
34
+ describe "called without a specific class" do
35
+ it "should specify a q parameter" do
36
+ ActiveFedora::Base.expects(:find_one).with("changeme:30", nil).returns("Fake Object1")
37
+ ActiveFedora::Base.expects(:find_one).with("changeme:22", nil).returns("Fake Object2")
38
+ mock_docs = mock('docs')
39
+ mock_docs.expects(:each).multiple_yields([{"id" => "changeme:30"}],[{"id" => "changeme:22"}])
40
+ mock_docs.expects(:has_next?).returns(false)
41
+ ActiveFedora::SolrService.instance.conn.expects(:paginate).with(1, 1000, 'select', :params=>{:q=>'*:*', :qt => 'standard', :sort => ['system_create_dt asc'], :fl=> 'id', }).returns('response'=>{'docs'=>mock_docs})
42
+ ActiveFedora::Base.find(:all).should == ["Fake Object1", "Fake Object2"]
43
+ end
44
+ end
35
45
  end
36
- it "should raise an exception if it is not found" do
37
- Rubydora::Repository.any_instance.expects(:object).raises(RestClient::ResourceNotFound)
38
- SpecModel::Basic.expects(:connection_for_pid).with("_PID_")
39
- lambda {SpecModel::Basic.find("_PID_")}.should raise_error ActiveFedora::ObjectNotFoundError
46
+ describe "and a pid is specified" do
47
+ it "should use SpecModel::Basic.allocate.init_with to instantiate an object" do
48
+ SpecModel::Basic.any_instance.expects(:init_with).returns(SpecModel::Basic.new)
49
+ ActiveFedora::DigitalObject.expects(:find).returns(stub("inner obj", :'new?'=>false))
50
+ SpecModel::Basic.find("_PID_").should be_a SpecModel::Basic
51
+ end
52
+ it "should raise an exception if it is not found" do
53
+ Rubydora::Repository.any_instance.expects(:object).raises(RestClient::ResourceNotFound)
54
+ SpecModel::Basic.expects(:connection_for_pid).with("_PID_")
55
+ lambda {SpecModel::Basic.find("_PID_")}.should raise_error ActiveFedora::ObjectNotFoundError
56
+ end
40
57
  end
41
58
  end
42
59
  describe "with :cast" 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: 4.4.0
4
+ version: 4.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-06-29 00:00:00.000000000 Z
14
+ date: 2012-07-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rsolr
18
- requirement: !ruby/object:Gem::Requirement
18
+ requirement: &77306850 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,15 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
- requirements:
29
- - - ! '>='
30
- - !ruby/object:Gem::Version
31
- version: '0'
26
+ version_requirements: *77306850
32
27
  - !ruby/object:Gem::Dependency
33
28
  name: om
34
- requirement: !ruby/object:Gem::Requirement
29
+ requirement: &77306370 !ruby/object:Gem::Requirement
35
30
  none: false
36
31
  requirements:
37
32
  - - ~>
@@ -39,15 +34,10 @@ dependencies:
39
34
  version: 1.6.0
40
35
  type: :runtime
41
36
  prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
- requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- version: 1.6.0
37
+ version_requirements: *77306370
48
38
  - !ruby/object:Gem::Dependency
49
39
  name: solrizer
50
- requirement: !ruby/object:Gem::Requirement
40
+ requirement: &77305870 !ruby/object:Gem::Requirement
51
41
  none: false
52
42
  requirements:
53
43
  - - ~>
@@ -55,15 +45,10 @@ dependencies:
55
45
  version: 1.2.0
56
46
  type: :runtime
57
47
  prerelease: false
58
- version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
- requirements:
61
- - - ~>
62
- - !ruby/object:Gem::Version
63
- version: 1.2.0
48
+ version_requirements: *77305870
64
49
  - !ruby/object:Gem::Dependency
65
50
  name: activeresource
66
- requirement: !ruby/object:Gem::Requirement
51
+ requirement: &77305030 !ruby/object:Gem::Requirement
67
52
  none: false
68
53
  requirements:
69
54
  - - ! '>='
@@ -71,15 +56,10 @@ dependencies:
71
56
  version: 3.0.0
72
57
  type: :runtime
73
58
  prerelease: false
74
- version_requirements: !ruby/object:Gem::Requirement
75
- none: false
76
- requirements:
77
- - - ! '>='
78
- - !ruby/object:Gem::Version
79
- version: 3.0.0
59
+ version_requirements: *77305030
80
60
  - !ruby/object:Gem::Dependency
81
61
  name: activesupport
82
- requirement: !ruby/object:Gem::Requirement
62
+ requirement: &77304400 !ruby/object:Gem::Requirement
83
63
  none: false
84
64
  requirements:
85
65
  - - ! '>='
@@ -87,15 +67,10 @@ dependencies:
87
67
  version: 3.0.0
88
68
  type: :runtime
89
69
  prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- none: false
92
- requirements:
93
- - - ! '>='
94
- - !ruby/object:Gem::Version
95
- version: 3.0.0
70
+ version_requirements: *77304400
96
71
  - !ruby/object:Gem::Dependency
97
72
  name: mediashelf-loggable
98
- requirement: !ruby/object:Gem::Requirement
73
+ requirement: &77303790 !ruby/object:Gem::Requirement
99
74
  none: false
100
75
  requirements:
101
76
  - - ! '>='
@@ -103,15 +78,10 @@ dependencies:
103
78
  version: '0'
104
79
  type: :runtime
105
80
  prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- none: false
108
- requirements:
109
- - - ! '>='
110
- - !ruby/object:Gem::Version
111
- version: '0'
81
+ version_requirements: *77303790
112
82
  - !ruby/object:Gem::Dependency
113
83
  name: equivalent-xml
114
- requirement: !ruby/object:Gem::Requirement
84
+ requirement: &77758110 !ruby/object:Gem::Requirement
115
85
  none: false
116
86
  requirements:
117
87
  - - ! '>='
@@ -119,31 +89,21 @@ dependencies:
119
89
  version: '0'
120
90
  type: :runtime
121
91
  prerelease: false
122
- version_requirements: !ruby/object:Gem::Requirement
123
- none: false
124
- requirements:
125
- - - ! '>='
126
- - !ruby/object:Gem::Version
127
- version: '0'
92
+ version_requirements: *77758110
128
93
  - !ruby/object:Gem::Dependency
129
94
  name: rubydora
130
- requirement: !ruby/object:Gem::Requirement
95
+ requirement: &77757570 !ruby/object:Gem::Requirement
131
96
  none: false
132
97
  requirements:
133
98
  - - ~>
134
99
  - !ruby/object:Gem::Version
135
- version: 0.5.10
100
+ version: 0.5.11
136
101
  type: :runtime
137
102
  prerelease: false
138
- version_requirements: !ruby/object:Gem::Requirement
139
- none: false
140
- requirements:
141
- - - ~>
142
- - !ruby/object:Gem::Version
143
- version: 0.5.10
103
+ version_requirements: *77757570
144
104
  - !ruby/object:Gem::Dependency
145
105
  name: rdf
146
- requirement: !ruby/object:Gem::Requirement
106
+ requirement: &77757000 !ruby/object:Gem::Requirement
147
107
  none: false
148
108
  requirements:
149
109
  - - ! '>='
@@ -151,15 +111,10 @@ dependencies:
151
111
  version: '0'
152
112
  type: :runtime
153
113
  prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- none: false
156
- requirements:
157
- - - ! '>='
158
- - !ruby/object:Gem::Version
159
- version: '0'
114
+ version_requirements: *77757000
160
115
  - !ruby/object:Gem::Dependency
161
116
  name: rdf-rdfxml
162
- requirement: !ruby/object:Gem::Requirement
117
+ requirement: &77755670 !ruby/object:Gem::Requirement
163
118
  none: false
164
119
  requirements:
165
120
  - - ~>
@@ -167,31 +122,32 @@ dependencies:
167
122
  version: 0.3.8
168
123
  type: :runtime
169
124
  prerelease: false
170
- version_requirements: !ruby/object:Gem::Requirement
171
- none: false
172
- requirements:
173
- - - ~>
174
- - !ruby/object:Gem::Version
175
- version: 0.3.8
125
+ version_requirements: *77755670
176
126
  - !ruby/object:Gem::Dependency
177
- name: yard
178
- requirement: !ruby/object:Gem::Requirement
127
+ name: deprecation
128
+ requirement: &77755040 !ruby/object:Gem::Requirement
179
129
  none: false
180
130
  requirements:
181
131
  - - ! '>='
182
132
  - !ruby/object:Gem::Version
183
133
  version: '0'
184
- type: :development
134
+ type: :runtime
185
135
  prerelease: false
186
- version_requirements: !ruby/object:Gem::Requirement
136
+ version_requirements: *77755040
137
+ - !ruby/object:Gem::Dependency
138
+ name: yard
139
+ requirement: &77754090 !ruby/object:Gem::Requirement
187
140
  none: false
188
141
  requirements:
189
142
  - - ! '>='
190
143
  - !ruby/object:Gem::Version
191
144
  version: '0'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: *77754090
192
148
  - !ruby/object:Gem::Dependency
193
149
  name: RedCloth
194
- requirement: !ruby/object:Gem::Requirement
150
+ requirement: &77753270 !ruby/object:Gem::Requirement
195
151
  none: false
196
152
  requirements:
197
153
  - - ! '>='
@@ -199,15 +155,10 @@ dependencies:
199
155
  version: '0'
200
156
  type: :development
201
157
  prerelease: false
202
- version_requirements: !ruby/object:Gem::Requirement
203
- none: false
204
- requirements:
205
- - - ! '>='
206
- - !ruby/object:Gem::Version
207
- version: '0'
158
+ version_requirements: *77753270
208
159
  - !ruby/object:Gem::Dependency
209
160
  name: rake
210
- requirement: !ruby/object:Gem::Requirement
161
+ requirement: &77752250 !ruby/object:Gem::Requirement
211
162
  none: false
212
163
  requirements:
213
164
  - - ! '>='
@@ -215,15 +166,10 @@ dependencies:
215
166
  version: '0'
216
167
  type: :development
217
168
  prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- none: false
220
- requirements:
221
- - - ! '>='
222
- - !ruby/object:Gem::Version
223
- version: '0'
169
+ version_requirements: *77752250
224
170
  - !ruby/object:Gem::Dependency
225
171
  name: jettywrapper
226
- requirement: !ruby/object:Gem::Requirement
172
+ requirement: &77751360 !ruby/object:Gem::Requirement
227
173
  none: false
228
174
  requirements:
229
175
  - - ! '>='
@@ -231,15 +177,10 @@ dependencies:
231
177
  version: 1.2.0
232
178
  type: :development
233
179
  prerelease: false
234
- version_requirements: !ruby/object:Gem::Requirement
235
- none: false
236
- requirements:
237
- - - ! '>='
238
- - !ruby/object:Gem::Version
239
- version: 1.2.0
180
+ version_requirements: *77751360
240
181
  - !ruby/object:Gem::Dependency
241
182
  name: rspec
242
- requirement: !ruby/object:Gem::Requirement
183
+ requirement: &77750230 !ruby/object:Gem::Requirement
243
184
  none: false
244
185
  requirements:
245
186
  - - ! '>='
@@ -247,28 +188,18 @@ dependencies:
247
188
  version: 2.9.0
248
189
  type: :development
249
190
  prerelease: false
250
- version_requirements: !ruby/object:Gem::Requirement
251
- none: false
252
- requirements:
253
- - - ! '>='
254
- - !ruby/object:Gem::Version
255
- version: 2.9.0
191
+ version_requirements: *77750230
256
192
  - !ruby/object:Gem::Dependency
257
193
  name: mocha
258
- requirement: !ruby/object:Gem::Requirement
194
+ requirement: &77766090 !ruby/object:Gem::Requirement
259
195
  none: false
260
196
  requirements:
261
- - - '='
197
+ - - =
262
198
  - !ruby/object:Gem::Version
263
199
  version: 0.10.5
264
200
  type: :development
265
201
  prerelease: false
266
- version_requirements: !ruby/object:Gem::Requirement
267
- none: false
268
- requirements:
269
- - - '='
270
- - !ruby/object:Gem::Version
271
- version: 0.10.5
202
+ version_requirements: *77766090
272
203
  description: ActiveFedora provides for creating and managing objects in the Fedora
273
204
  Repository Architecture.
274
205
  email:
@@ -507,7 +438,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
507
438
  version: '0'
508
439
  segments:
509
440
  - 0
510
- hash: -160565939
441
+ hash: -434881585
511
442
  required_rubygems_version: !ruby/object:Gem::Requirement
512
443
  none: false
513
444
  requirements:
@@ -516,10 +447,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
516
447
  version: '0'
517
448
  segments:
518
449
  - 0
519
- hash: -160565939
450
+ hash: -434881585
520
451
  requirements: []
521
452
  rubyforge_project: rubyfedora
522
- rubygems_version: 1.8.24
453
+ rubygems_version: 1.8.15
523
454
  signing_key:
524
455
  specification_version: 3
525
456
  summary: A convenience libary for manipulating documents in the Fedora Repository.