active-fedora 5.5.2 → 5.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,7 +3,6 @@ source "http://rubygems.org"
3
3
  # Bundler will rely on active-fedora.gemspec for dependency information.
4
4
 
5
5
  gemspec
6
-
7
6
  group :development, :test do
8
7
  gem 'simplecov', :platform => :mri_19
9
8
  gem 'simplecov-rcov', :platform => :mri_19
@@ -1,3 +1,8 @@
1
+ 5.6.0
2
+ Upgrade to rubydora 1.3.0, which prevents unnecessary loading of datastream content.
3
+ #35 fix passing :sort argument to ActiveFedora::Base#find
4
+ Better support for ruby 2.0 (delegating inspect within RdfNode::TermProxy)
5
+
1
6
  5.5.2
2
7
  #25 When multiple has_many relationships share a predicate, the solr_query should use class_name to distinguish the sets.
3
8
 
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency("activesupport", '>= 3.0.0')
24
24
  s.add_dependency("builder", '~> 3.0.0')
25
25
  s.add_dependency("mediashelf-loggable")
26
- s.add_dependency("rubydora", '~>1.2')
26
+ s.add_dependency("rubydora", '~>1.3')
27
27
  s.add_dependency("rdf")
28
28
  s.add_dependency("rdf-rdfxml", '~>0.3.8')
29
29
  s.add_dependency("deprecation")
@@ -65,11 +65,12 @@ module ActiveFedora
65
65
  def ng_xml=(new_xml)
66
66
  case new_xml
67
67
  when Nokogiri::XML::Document
68
- @ng_xml = new_xml
68
+ self.content=new_xml.to_xml
69
69
  when Nokogiri::XML::Node
70
- @ng_xml = Nokogiri::XML(new_xml.to_s) ## Cast a fragment to a document
70
+ ## Cast a fragment to a document
71
+ self.content=new_xml.to_s
71
72
  when String
72
- @ng_xml = Nokogiri::XML::Document.parse(new_xml)
73
+ self.content=new_xml
73
74
  else
74
75
  raise TypeError, "You passed a #{new_xml.class} into the ng_xml of the #{self.dsid} datastream. NokogiriDatastream.ng_xml= only accepts Nokogiri::XML::Document, Nokogiri::XML::Element, Nokogiri::XML::Node, or raw XML (String) as inputs."
75
76
  end
@@ -105,6 +106,7 @@ module ActiveFedora
105
106
 
106
107
  def content=(content)
107
108
  @ng_xml = Nokogiri::XML::Document.parse(content)
109
+ super(@ng_xml.to_s)
108
110
  end
109
111
 
110
112
  def content_changed?
@@ -31,7 +31,6 @@ module ActiveFedora
31
31
 
32
32
  end
33
33
 
34
- attr_accessor :loaded
35
34
  def metadata?
36
35
  true
37
36
  end
@@ -42,25 +41,20 @@ module ActiveFedora
42
41
  return "#{pre}__#{name}".to_sym
43
42
  end
44
43
 
44
+ # Overriding so that one can call ds.content on an unsaved datastream and they will see the serialized format
45
45
  def content
46
46
  serialize
47
47
  end
48
48
 
49
49
  def content=(content)
50
- self.loaded = true
51
50
  @graph = deserialize(content)
52
51
  end
53
52
 
54
53
  def content_changed?
55
- return false if new? and !loaded
54
+ @content = serialize
56
55
  super
57
56
  end
58
57
 
59
- def changed?
60
- super || content_changed?
61
- end
62
-
63
-
64
58
  def to_solr(solr_doc = Hash.new) # :nodoc:
65
59
  fields.each do |field_key, field_info|
66
60
  values = get_values(rdf_subject, field_key)
@@ -96,7 +90,6 @@ module ActiveFedora
96
90
 
97
91
  def graph
98
92
  @graph ||= begin
99
- self.loaded = true
100
93
  deserialize
101
94
  end
102
95
  end
@@ -3,7 +3,10 @@ module ActiveFedora
3
3
  class TermProxy
4
4
 
5
5
  attr_reader :graph, :subject, :predicate, :options
6
- delegate :class, :to_s, :==, :kind_of?, :each, :map, :empty?, :as_json, :is_a?, :to => :values
6
+
7
+ delegate :class, :to_s, :==, :kind_of?, :each, :map, :empty?, :as_json,
8
+ :is_a?, :to_ary, :inspect, :first, :last, :include?, :count,
9
+ :to => :values
7
10
 
8
11
  # @param graph RDF::Graph
9
12
  # @param subject RDF::URI
@@ -51,14 +54,7 @@ module ActiveFedora
51
54
 
52
55
  values
53
56
  end
54
-
55
- def method_missing(method, *args, &block)
56
- if values.respond_to? method
57
- values.send(method, *args, &block)
58
- else
59
- super
60
- end
61
- end
57
+
62
58
  end
63
59
  end
64
60
  end
@@ -94,8 +94,8 @@ module ActiveFedora
94
94
  options[:order] ||= sort if sort.present?
95
95
  end
96
96
 
97
-
98
97
  if options.present?
98
+ options = args.first unless args.empty?
99
99
  options = {conditions: options}
100
100
  apply_finder_options(options).all
101
101
  else
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "5.5.2"
2
+ VERSION = "5.6.0"
3
3
  end
@@ -26,7 +26,6 @@ describe ActiveFedora::OmDatastream do
26
26
  @test_object = HydrangeaArticle2.find(@pid)
27
27
 
28
28
  @test_object.descMetadata.ng_xml = @test_object.descMetadata.ng_xml
29
-
30
29
  @test_object.descMetadata.should_not be_changed
31
30
  end
32
31
 
@@ -182,7 +182,7 @@ describe ActiveFedora::OmDatastream do
182
182
  end
183
183
  end
184
184
 
185
- describe '.content=' do
185
+ describe 'setting content' do
186
186
  subject { ActiveFedora::OmDatastream.new(@mock_inner, "descMetadata") }
187
187
  it "should update the content" do
188
188
  subject.stub(:new? => false )
@@ -225,7 +225,6 @@ describe ActiveFedora::OmDatastream do
225
225
  @test_ds2.should_not be_changed
226
226
  @test_ds2.ng_xml = @sample_raw_xml
227
227
  @test_ds2.should be_changed
228
- @test_ds2.instance_variable_get(:@content).should be_nil
229
228
  end
230
229
  end
231
230
 
@@ -81,6 +81,29 @@ describe ActiveFedora::Base do
81
81
  }.and_return('response'=>{'docs'=>mock_docs})
82
82
  SpecModel::Basic.find({:foo=>'bar', :baz=>['quix','quack']}).should == ["Fake Object1", "Fake Object2"]
83
83
  end
84
+
85
+ it "should add options" do
86
+ SpecModel::Basic.should_receive(:find_one).with("changeme:30", nil).and_return("Fake Object1")
87
+ SpecModel::Basic.should_receive(:find_one).with("changeme:22", nil).and_return("Fake Object2")
88
+
89
+ mock_docs = [{"id" => "changeme:30"},{"id" => "changeme:22"}]
90
+ mock_docs.should_receive(:has_next?).and_return(false)
91
+ ActiveFedora::SolrService.instance.conn.should_receive(:paginate).with() { |page, rows, method, hash|
92
+ page == 1 &&
93
+ rows == 1000 &&
94
+ method == 'select' &&
95
+ hash[:params] &&
96
+ hash[:params][:sort] == [@sort_query] &&
97
+ hash[:params][:fl] == 'id' &&
98
+ hash[:params][:sort] == ["system_create_dt asc"] &&
99
+ hash[:params][:q].split(" AND ").include?(@model_query) &&
100
+ hash[:params][:q].split(" AND ").include?("foo:\"bar\"") &&
101
+ hash[:params][:q].split(" AND ").include?("baz:\"quix\"") &&
102
+ hash[:params][:q].split(" AND ").include?("baz:\"quack\"")
103
+ }.and_return('response'=>{'docs'=>mock_docs})
104
+ SpecModel::Basic.find({:foo=>'bar', :baz=>['quix','quack']}, :sort=>'title_t desc').should == ["Fake Object1", "Fake Object2"]
105
+ end
106
+
84
107
  end
85
108
  end
86
109
 
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: 5.5.2
4
+ version: 5.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,14 +11,14 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-01-28 00:00:00.000000000 Z
14
+ date: 2013-02-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rsolr
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
- - - ! '>='
21
+ - - ">="
22
22
  - !ruby/object:Gem::Version
23
23
  version: '0'
24
24
  type: :runtime
@@ -26,7 +26,7 @@ dependencies:
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  none: false
28
28
  requirements:
29
- - - ! '>='
29
+ - - ">="
30
30
  - !ruby/object:Gem::Version
31
31
  version: '0'
32
32
  - !ruby/object:Gem::Dependency
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  none: false
36
36
  requirements:
37
- - - ~>
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: 1.8.0
40
40
  type: :runtime
@@ -42,7 +42,7 @@ dependencies:
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  none: false
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.8.0
48
48
  - !ruby/object:Gem::Dependency
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
- - - ! '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: 0.5.1
56
56
  type: :runtime
@@ -58,7 +58,7 @@ dependencies:
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  none: false
60
60
  requirements:
61
- - - ! '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: 0.5.1
64
64
  - !ruby/object:Gem::Dependency
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirement: !ruby/object:Gem::Requirement
67
67
  none: false
68
68
  requirements:
69
- - - ! '>='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: 2.1.0
72
72
  type: :runtime
@@ -74,7 +74,7 @@ dependencies:
74
74
  version_requirements: !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
- - - ! '>='
77
+ - - ">="
78
78
  - !ruby/object:Gem::Version
79
79
  version: 2.1.0
80
80
  - !ruby/object:Gem::Dependency
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirement: !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
- - - ! '>='
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: 3.0.0
88
88
  type: :runtime
@@ -90,7 +90,7 @@ dependencies:
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  none: false
92
92
  requirements:
93
- - - ! '>='
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: 3.0.0
96
96
  - !ruby/object:Gem::Dependency
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  none: false
100
100
  requirements:
101
- - - ! '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 3.0.0
104
104
  type: :runtime
@@ -106,7 +106,7 @@ dependencies:
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
- - - ! '>='
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: 3.0.0
112
112
  - !ruby/object:Gem::Dependency
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  none: false
116
116
  requirements:
117
- - - ~>
117
+ - - "~>"
118
118
  - !ruby/object:Gem::Version
119
119
  version: 3.0.0
120
120
  type: :runtime
@@ -122,7 +122,7 @@ dependencies:
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  none: false
124
124
  requirements:
125
- - - ~>
125
+ - - "~>"
126
126
  - !ruby/object:Gem::Version
127
127
  version: 3.0.0
128
128
  - !ruby/object:Gem::Dependency
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirement: !ruby/object:Gem::Requirement
131
131
  none: false
132
132
  requirements:
133
- - - ! '>='
133
+ - - ">="
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  type: :runtime
@@ -138,7 +138,7 @@ dependencies:
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
- - - ! '>='
141
+ - - ">="
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  - !ruby/object:Gem::Dependency
@@ -146,23 +146,23 @@ dependencies:
146
146
  requirement: !ruby/object:Gem::Requirement
147
147
  none: false
148
148
  requirements:
149
- - - ~>
149
+ - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '1.2'
151
+ version: '1.3'
152
152
  type: :runtime
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  none: false
156
156
  requirements:
157
- - - ~>
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.2'
159
+ version: '1.3'
160
160
  - !ruby/object:Gem::Dependency
161
161
  name: rdf
162
162
  requirement: !ruby/object:Gem::Requirement
163
163
  none: false
164
164
  requirements:
165
- - - ! '>='
165
+ - - ">="
166
166
  - !ruby/object:Gem::Version
167
167
  version: '0'
168
168
  type: :runtime
@@ -170,7 +170,7 @@ dependencies:
170
170
  version_requirements: !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
- - - ! '>='
173
+ - - ">="
174
174
  - !ruby/object:Gem::Version
175
175
  version: '0'
176
176
  - !ruby/object:Gem::Dependency
@@ -178,7 +178,7 @@ dependencies:
178
178
  requirement: !ruby/object:Gem::Requirement
179
179
  none: false
180
180
  requirements:
181
- - - ~>
181
+ - - "~>"
182
182
  - !ruby/object:Gem::Version
183
183
  version: 0.3.8
184
184
  type: :runtime
@@ -186,7 +186,7 @@ dependencies:
186
186
  version_requirements: !ruby/object:Gem::Requirement
187
187
  none: false
188
188
  requirements:
189
- - - ~>
189
+ - - "~>"
190
190
  - !ruby/object:Gem::Version
191
191
  version: 0.3.8
192
192
  - !ruby/object:Gem::Dependency
@@ -194,7 +194,7 @@ dependencies:
194
194
  requirement: !ruby/object:Gem::Requirement
195
195
  none: false
196
196
  requirements:
197
- - - ! '>='
197
+ - - ">="
198
198
  - !ruby/object:Gem::Version
199
199
  version: '0'
200
200
  type: :runtime
@@ -202,7 +202,7 @@ dependencies:
202
202
  version_requirements: !ruby/object:Gem::Requirement
203
203
  none: false
204
204
  requirements:
205
- - - ! '>='
205
+ - - ">="
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  - !ruby/object:Gem::Dependency
@@ -210,7 +210,7 @@ dependencies:
210
210
  requirement: !ruby/object:Gem::Requirement
211
211
  none: false
212
212
  requirements:
213
- - - ! '>='
213
+ - - ">="
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  type: :development
@@ -218,7 +218,7 @@ dependencies:
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  none: false
220
220
  requirements:
221
- - - ! '>='
221
+ - - ">="
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
224
  - !ruby/object:Gem::Dependency
@@ -226,7 +226,7 @@ dependencies:
226
226
  requirement: !ruby/object:Gem::Requirement
227
227
  none: false
228
228
  requirements:
229
- - - ! '>='
229
+ - - ">="
230
230
  - !ruby/object:Gem::Version
231
231
  version: '0'
232
232
  type: :development
@@ -234,7 +234,7 @@ dependencies:
234
234
  version_requirements: !ruby/object:Gem::Requirement
235
235
  none: false
236
236
  requirements:
237
- - - ! '>='
237
+ - - ">="
238
238
  - !ruby/object:Gem::Version
239
239
  version: '0'
240
240
  - !ruby/object:Gem::Dependency
@@ -242,7 +242,7 @@ dependencies:
242
242
  requirement: !ruby/object:Gem::Requirement
243
243
  none: false
244
244
  requirements:
245
- - - ! '>='
245
+ - - ">="
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  type: :development
@@ -250,7 +250,7 @@ dependencies:
250
250
  version_requirements: !ruby/object:Gem::Requirement
251
251
  none: false
252
252
  requirements:
253
- - - ! '>='
253
+ - - ">="
254
254
  - !ruby/object:Gem::Version
255
255
  version: '0'
256
256
  - !ruby/object:Gem::Dependency
@@ -258,7 +258,7 @@ dependencies:
258
258
  requirement: !ruby/object:Gem::Requirement
259
259
  none: false
260
260
  requirements:
261
- - - ! '>='
261
+ - - ">="
262
262
  - !ruby/object:Gem::Version
263
263
  version: 1.2.0
264
264
  type: :development
@@ -266,7 +266,7 @@ dependencies:
266
266
  version_requirements: !ruby/object:Gem::Requirement
267
267
  none: false
268
268
  requirements:
269
- - - ! '>='
269
+ - - ">="
270
270
  - !ruby/object:Gem::Version
271
271
  version: 1.2.0
272
272
  - !ruby/object:Gem::Dependency
@@ -274,7 +274,7 @@ dependencies:
274
274
  requirement: !ruby/object:Gem::Requirement
275
275
  none: false
276
276
  requirements:
277
- - - ! '>='
277
+ - - ">="
278
278
  - !ruby/object:Gem::Version
279
279
  version: 2.9.0
280
280
  type: :development
@@ -282,7 +282,7 @@ dependencies:
282
282
  version_requirements: !ruby/object:Gem::Requirement
283
283
  none: false
284
284
  requirements:
285
- - - ! '>='
285
+ - - ">="
286
286
  - !ruby/object:Gem::Version
287
287
  version: 2.9.0
288
288
  - !ruby/object:Gem::Dependency
@@ -290,7 +290,7 @@ dependencies:
290
290
  requirement: !ruby/object:Gem::Requirement
291
291
  none: false
292
292
  requirements:
293
- - - ! '>='
293
+ - - ">="
294
294
  - !ruby/object:Gem::Version
295
295
  version: '0'
296
296
  type: :development
@@ -298,7 +298,7 @@ dependencies:
298
298
  version_requirements: !ruby/object:Gem::Requirement
299
299
  none: false
300
300
  requirements:
301
- - - ! '>='
301
+ - - ">="
302
302
  - !ruby/object:Gem::Version
303
303
  version: '0'
304
304
  description: ActiveFedora provides for creating and managing objects in the Fedora
@@ -311,8 +311,8 @@ extra_rdoc_files:
311
311
  - LICENSE
312
312
  - README.textile
313
313
  files:
314
- - .gitignore
315
- - .gitmodules
314
+ - ".gitignore"
315
+ - ".gitmodules"
316
316
  - CONSOLE_GETTING_STARTED.textile
317
317
  - Gemfile
318
318
  - History.txt
@@ -555,21 +555,21 @@ require_paths:
555
555
  required_ruby_version: !ruby/object:Gem::Requirement
556
556
  none: false
557
557
  requirements:
558
- - - ! '>='
558
+ - - ">="
559
559
  - !ruby/object:Gem::Version
560
560
  version: 1.9.3
561
561
  required_rubygems_version: !ruby/object:Gem::Requirement
562
562
  none: false
563
563
  requirements:
564
- - - ! '>='
564
+ - - ">="
565
565
  - !ruby/object:Gem::Version
566
566
  version: '0'
567
567
  segments:
568
568
  - 0
569
- hash: -3856753217323380109
569
+ hash: 3222312397106806094
570
570
  requirements: []
571
571
  rubyforge_project: rubyfedora
572
- rubygems_version: 1.8.24
572
+ rubygems_version: 1.8.25
573
573
  signing_key:
574
574
  specification_version: 3
575
575
  summary: A convenience libary for manipulating documents in the Fedora Repository.