active-fedora 3.3.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active-fedora (3.3.0)
4
+ active-fedora (3.3.1)
5
5
  activeresource (>= 3.0.0)
6
6
  activesupport (>= 3.0.0)
7
7
  equivalent-xml
8
- facets
9
8
  mediashelf-loggable
10
9
  mime-types (>= 1.16)
11
10
  multipart-post (= 1.1.2)
@@ -13,7 +12,7 @@ PATH
13
12
  om (>= 1.5.1)
14
13
  rdf
15
14
  rdf-rdfxml
16
- rubydora (~> 0.5.1)
15
+ rubydora (~> 0.5.2)
17
16
  solr-ruby (>= 0.0.6)
18
17
  solrizer (~> 1.2.0)
19
18
  xml-simple (>= 1.0.12)
@@ -41,7 +40,6 @@ GEM
41
40
  diff-lcs (1.1.3)
42
41
  equivalent-xml (0.2.9)
43
42
  nokogiri (>= 1.4.3)
44
- facets (2.9.3)
45
43
  fastercsv (1.5.4)
46
44
  ffi (1.0.11)
47
45
  gyoku (0.4.4)
@@ -87,7 +85,7 @@ GEM
87
85
  rspec-expectations (2.8.0)
88
86
  diff-lcs (~> 1.1.2)
89
87
  rspec-mocks (2.8.0)
90
- rubydora (0.5.1)
88
+ rubydora (0.5.2)
91
89
  activemodel
92
90
  activesupport
93
91
  fastercsv
@@ -1,3 +1,10 @@
1
+ 3.3.1
2
+ Allow explicit setting of predicate config.
3
+ Check for appropriate content before saving a datastream
4
+ rubydora to 0.5.2
5
+ Support for changing base fixture directory path
6
+ Removed unnecessary dependencies
7
+
1
8
  3.3.0
2
9
  A label set on an unsaved datastream should be saved in the repository
3
10
  Should be able to add checksumType parameter when creating a datastream
@@ -26,8 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_dependency("activesupport", '>= 3.0.0')
27
27
  s.add_dependency("mediashelf-loggable")
28
28
  s.add_dependency("equivalent-xml")
29
- s.add_dependency("facets")
30
- s.add_dependency("rubydora", '~>0.5.1')
29
+ s.add_dependency("rubydora", '~>0.5.2')
31
30
  s.add_dependency("rdf")
32
31
  s.add_dependency("rdf-rdfxml")
33
32
  s.add_development_dependency("yard")
@@ -1,4 +1,3 @@
1
- require 'facets/string/titlecase'
2
1
  module ActiveFedora
3
2
  class ContentModel < Base
4
3
  CMODEL_NAMESPACE = "afmodel"
@@ -5,7 +5,7 @@ module ActiveFedora
5
5
 
6
6
  attr_writer :digital_object
7
7
  attr_accessor :dirty, :last_modified, :fields
8
- before_create :add_mime_type, :add_ds_location
8
+ before_create :add_mime_type, :add_ds_location, :validate_content_present
9
9
 
10
10
  def initialize(digital_object, dsid, options={})
11
11
  ## When you use the versions feature of rubydora (0.5.x), you need to have a 3 argument constructor
@@ -47,9 +47,18 @@ module ActiveFedora
47
47
  new?
48
48
  end
49
49
 
50
+ def validate_content_present
51
+ case controlGroup
52
+ when 'X','M'
53
+ @content.present?
54
+ when 'E','R'
55
+ dsLocation.present?
56
+ else
57
+ raise "Invalid control group: #{controlGroup.inspect}"
58
+ end
59
+ end
60
+
50
61
  def save
51
- #raise "No content #{dsid}" if @content.nil?
52
- return if @content.nil?
53
62
  run_callbacks :save do
54
63
  return create if new?
55
64
  repository.modify_datastream to_api_params.merge({ :pid => pid, :dsid => dsid })
@@ -50,6 +50,13 @@ module ActiveFedora
50
50
  return predicate
51
51
  end
52
52
 
53
+ def self.predicate_config= value
54
+ unless value.is_a?(Hash) and [:predicate_mapping,:default_namespace].all? { |key| value.has_key? key }
55
+ raise TypeError, "predicate_config must specify :predicate_mapping and :default_namespace"
56
+ end
57
+ @@predicate_config = value
58
+ end
59
+
53
60
  def self.predicate_config
54
61
  @@predicate_config ||= YAML::load(File.open(ActiveFedora.predicate_config)) if File.exist?(ActiveFedora.predicate_config)
55
62
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "3.3.0"
2
+ VERSION = "3.3.1"
3
3
  end
@@ -64,11 +64,15 @@ namespace :repo do
64
64
 
65
65
  desc "Load the object located at the provided path or identified by pid. Example: rake repo:load path=spec/fixtures/demo_12.foxml.xml"
66
66
  task :load => :init do
67
- if !ENV["path"].nil?
67
+ if !ENV["path"].nil? and File.file?(ENV["path"])
68
68
  filename = ENV["path"]
69
69
  elsif !ENV["pid"].nil?
70
70
  pid = ENV["pid"]
71
- filename = File.join("spec","fixtures","#{pid.gsub(":","_")}.foxml.xml")
71
+ if !ENV["path"].nil? and File.directory?(ENV["path"])
72
+ filename = File.join(ENV["path"], "#{pid.gsub(":","_")}.foxml.xml")
73
+ else
74
+ filename = File.join("spec","fixtures","#{pid.gsub(":","_")}.foxml.xml")
75
+ end
72
76
  else
73
77
  puts "You must specify a path to the object or provide its pid. Example: rake repo:load path=spec/fixtures/demo_12.foxml.xml"
74
78
  end
@@ -21,6 +21,45 @@ describe ActiveFedora::Datastream do
21
21
  @test_datastream.inspect.should match /#<ActiveFedora::Datastream:-?\d+ @pid=\"__DO_NOT_USE__\" @dsid=\"abcd\" @controlGroup=\"M\" @dirty=\"false\" @mimeType=\"\" >/
22
22
  end
23
23
 
24
+ describe '#validate_content_present' do
25
+ before :each do
26
+ @test_datastream.content = nil
27
+ @test_datastream.dsLocation = nil
28
+ end
29
+
30
+ it "should expect content on an Inline (X) datastream" do
31
+ @test_datastream.controlGroup = 'X'
32
+ @test_datastream.dsLocation = "http://example.com/test/content/abcd"
33
+ @test_datastream.validate_content_present.should be_false
34
+ @test_datastream.content = "<foo><xmlelement/></foo>"
35
+ @test_datastream.validate_content_present.should be_true
36
+ end
37
+
38
+ it "should expect content on a Managed (M) datastream" do
39
+ @test_datastream.controlGroup = 'M'
40
+ @test_datastream.dsLocation = "http://example.com/test/content/abcd"
41
+ @test_datastream.validate_content_present.should be_false
42
+ @test_datastream.content = "<foo><xmlelement/></foo>"
43
+ @test_datastream.validate_content_present.should be_true
44
+ end
45
+
46
+ it "should expect a dsLocation on an External (E) datastream" do
47
+ @test_datastream.controlGroup = 'E'
48
+ @test_datastream.content = "<foo><xmlelement/></foo>"
49
+ @test_datastream.validate_content_present.should be_false
50
+ @test_datastream.dsLocation = "http://example.com/test/content/abcd"
51
+ @test_datastream.validate_content_present.should be_true
52
+ end
53
+
54
+ it "should expect a dsLocation on a Redirect (R) datastream" do
55
+ @test_datastream.controlGroup = 'R'
56
+ @test_datastream.content = "<foo><xmlelement/></foo>"
57
+ @test_datastream.validate_content_present.should be_false
58
+ @test_datastream.dsLocation = "http://example.com/test/content/abcd"
59
+ @test_datastream.validate_content_present.should be_true
60
+ end
61
+ end
62
+
24
63
  describe '#save' do
25
64
  it "should set dirty? to false" do
26
65
  mock_repo = mock('repository', :config=>{})
@@ -59,6 +59,31 @@ describe ActiveFedora::Predicates do
59
59
  lambda { ActiveFedora::Predicates.predicate_lookup(:has_foo) }.should raise_error ActiveFedora::UnregisteredPredicateError
60
60
  end
61
61
 
62
+ context 'initialization' do
63
+ before :each do
64
+ @old_predicate_config = ActiveFedora::Predicates.predicate_config
65
+ end
62
66
 
63
-
67
+ after :each do
68
+ ActiveFedora::Predicates.predicate_config = @old_predicate_config
69
+ end
70
+
71
+ it 'should allow explicit initialization of predicates' do
72
+ ActiveFedora::Predicates.find_predicate(:is_part_of).should == ["isPartOf", "info:fedora/fedora-system:def/relations-external#"]
73
+ ActiveFedora::Predicates.predicate_config = {
74
+ :default_namespace => 'http://example.com/foo',
75
+ :predicate_mapping => {
76
+ 'http://example.com/foo' => { :has_bar => 'hasBAR' }
77
+ }
78
+ }
79
+ ActiveFedora::Predicates.find_predicate(:has_bar).should == ["hasBAR", "http://example.com/foo"]
80
+ lambda { ActiveFedora::Predicates.find_predicate(:is_part_of) }.should raise_error ActiveFedora::UnregisteredPredicateError
81
+ end
82
+
83
+ it 'should ensure that the configuration has the correct keys' do
84
+ lambda { ActiveFedora::Predicates.predicate_config = { :foo => 'invalid!' } }.should raise_error TypeError
85
+ end
86
+
87
+ end
88
+
64
89
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 3
9
- - 0
10
- version: 3.3.0
9
+ - 1
10
+ version: 3.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Zumwalt
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-01-30 00:00:00 Z
20
+ date: 2012-02-06 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -31,10 +31,10 @@ dependencies:
31
31
  - 0
32
32
  - 6
33
33
  version: 0.0.6
34
- requirement: *id001
35
34
  prerelease: false
36
- name: solr-ruby
35
+ requirement: *id001
37
36
  type: :runtime
37
+ name: solr-ruby
38
38
  - !ruby/object:Gem::Dependency
39
39
  version_requirements: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
@@ -47,10 +47,10 @@ dependencies:
47
47
  - 0
48
48
  - 12
49
49
  version: 1.0.12
50
- requirement: *id002
51
50
  prerelease: false
52
- name: xml-simple
51
+ requirement: *id002
53
52
  type: :runtime
53
+ name: xml-simple
54
54
  - !ruby/object:Gem::Dependency
55
55
  version_requirements: &id003 !ruby/object:Gem::Requirement
56
56
  none: false
@@ -62,10 +62,10 @@ dependencies:
62
62
  - 1
63
63
  - 16
64
64
  version: "1.16"
65
- requirement: *id003
66
65
  prerelease: false
67
- name: mime-types
66
+ requirement: *id003
68
67
  type: :runtime
68
+ name: mime-types
69
69
  - !ruby/object:Gem::Dependency
70
70
  version_requirements: &id004 !ruby/object:Gem::Requirement
71
71
  none: false
@@ -78,10 +78,10 @@ dependencies:
78
78
  - 1
79
79
  - 2
80
80
  version: 1.1.2
81
- requirement: *id004
82
81
  prerelease: false
83
- name: multipart-post
82
+ requirement: *id004
84
83
  type: :runtime
84
+ name: multipart-post
85
85
  - !ruby/object:Gem::Dependency
86
86
  version_requirements: &id005 !ruby/object:Gem::Requirement
87
87
  none: false
@@ -92,10 +92,10 @@ dependencies:
92
92
  segments:
93
93
  - 0
94
94
  version: "0"
95
- requirement: *id005
96
95
  prerelease: false
97
- name: nokogiri
96
+ requirement: *id005
98
97
  type: :runtime
98
+ name: nokogiri
99
99
  - !ruby/object:Gem::Dependency
100
100
  version_requirements: &id006 !ruby/object:Gem::Requirement
101
101
  none: false
@@ -108,10 +108,10 @@ dependencies:
108
108
  - 5
109
109
  - 1
110
110
  version: 1.5.1
111
- requirement: *id006
112
111
  prerelease: false
113
- name: om
112
+ requirement: *id006
114
113
  type: :runtime
114
+ name: om
115
115
  - !ruby/object:Gem::Dependency
116
116
  version_requirements: &id007 !ruby/object:Gem::Requirement
117
117
  none: false
@@ -124,10 +124,10 @@ dependencies:
124
124
  - 2
125
125
  - 0
126
126
  version: 1.2.0
127
- requirement: *id007
128
127
  prerelease: false
129
- name: solrizer
128
+ requirement: *id007
130
129
  type: :runtime
130
+ name: solrizer
131
131
  - !ruby/object:Gem::Dependency
132
132
  version_requirements: &id008 !ruby/object:Gem::Requirement
133
133
  none: false
@@ -140,10 +140,10 @@ dependencies:
140
140
  - 0
141
141
  - 0
142
142
  version: 3.0.0
143
- requirement: *id008
144
143
  prerelease: false
145
- name: activeresource
144
+ requirement: *id008
146
145
  type: :runtime
146
+ name: activeresource
147
147
  - !ruby/object:Gem::Dependency
148
148
  version_requirements: &id009 !ruby/object:Gem::Requirement
149
149
  none: false
@@ -156,10 +156,10 @@ dependencies:
156
156
  - 0
157
157
  - 0
158
158
  version: 3.0.0
159
- requirement: *id009
160
159
  prerelease: false
161
- name: activesupport
160
+ requirement: *id009
162
161
  type: :runtime
162
+ name: activesupport
163
163
  - !ruby/object:Gem::Dependency
164
164
  version_requirements: &id010 !ruby/object:Gem::Requirement
165
165
  none: false
@@ -170,10 +170,10 @@ dependencies:
170
170
  segments:
171
171
  - 0
172
172
  version: "0"
173
- requirement: *id010
174
173
  prerelease: false
175
- name: mediashelf-loggable
174
+ requirement: *id010
176
175
  type: :runtime
176
+ name: mediashelf-loggable
177
177
  - !ruby/object:Gem::Dependency
178
178
  version_requirements: &id011 !ruby/object:Gem::Requirement
179
179
  none: false
@@ -184,42 +184,28 @@ dependencies:
184
184
  segments:
185
185
  - 0
186
186
  version: "0"
187
- requirement: *id011
188
187
  prerelease: false
189
- name: equivalent-xml
188
+ requirement: *id011
190
189
  type: :runtime
190
+ name: equivalent-xml
191
191
  - !ruby/object:Gem::Dependency
192
192
  version_requirements: &id012 !ruby/object:Gem::Requirement
193
- none: false
194
- requirements:
195
- - - ">="
196
- - !ruby/object:Gem::Version
197
- hash: 3
198
- segments:
199
- - 0
200
- version: "0"
201
- requirement: *id012
202
- prerelease: false
203
- name: facets
204
- type: :runtime
205
- - !ruby/object:Gem::Dependency
206
- version_requirements: &id013 !ruby/object:Gem::Requirement
207
193
  none: false
208
194
  requirements:
209
195
  - - ~>
210
196
  - !ruby/object:Gem::Version
211
- hash: 9
197
+ hash: 15
212
198
  segments:
213
199
  - 0
214
200
  - 5
215
- - 1
216
- version: 0.5.1
217
- requirement: *id013
201
+ - 2
202
+ version: 0.5.2
218
203
  prerelease: false
219
- name: rubydora
204
+ requirement: *id012
220
205
  type: :runtime
206
+ name: rubydora
221
207
  - !ruby/object:Gem::Dependency
222
- version_requirements: &id014 !ruby/object:Gem::Requirement
208
+ version_requirements: &id013 !ruby/object:Gem::Requirement
223
209
  none: false
224
210
  requirements:
225
211
  - - ">="
@@ -228,12 +214,12 @@ dependencies:
228
214
  segments:
229
215
  - 0
230
216
  version: "0"
231
- requirement: *id014
232
217
  prerelease: false
233
- name: rdf
218
+ requirement: *id013
234
219
  type: :runtime
220
+ name: rdf
235
221
  - !ruby/object:Gem::Dependency
236
- version_requirements: &id015 !ruby/object:Gem::Requirement
222
+ version_requirements: &id014 !ruby/object:Gem::Requirement
237
223
  none: false
238
224
  requirements:
239
225
  - - ">="
@@ -242,12 +228,12 @@ dependencies:
242
228
  segments:
243
229
  - 0
244
230
  version: "0"
245
- requirement: *id015
246
231
  prerelease: false
247
- name: rdf-rdfxml
232
+ requirement: *id014
248
233
  type: :runtime
234
+ name: rdf-rdfxml
249
235
  - !ruby/object:Gem::Dependency
250
- version_requirements: &id016 !ruby/object:Gem::Requirement
236
+ version_requirements: &id015 !ruby/object:Gem::Requirement
251
237
  none: false
252
238
  requirements:
253
239
  - - ">="
@@ -256,12 +242,12 @@ dependencies:
256
242
  segments:
257
243
  - 0
258
244
  version: "0"
259
- requirement: *id016
260
245
  prerelease: false
261
- name: yard
246
+ requirement: *id015
262
247
  type: :development
248
+ name: yard
263
249
  - !ruby/object:Gem::Dependency
264
- version_requirements: &id017 !ruby/object:Gem::Requirement
250
+ version_requirements: &id016 !ruby/object:Gem::Requirement
265
251
  none: false
266
252
  requirements:
267
253
  - - ">="
@@ -270,12 +256,12 @@ dependencies:
270
256
  segments:
271
257
  - 0
272
258
  version: "0"
273
- requirement: *id017
274
259
  prerelease: false
275
- name: RedCloth
260
+ requirement: *id016
276
261
  type: :development
262
+ name: RedCloth
277
263
  - !ruby/object:Gem::Dependency
278
- version_requirements: &id018 !ruby/object:Gem::Requirement
264
+ version_requirements: &id017 !ruby/object:Gem::Requirement
279
265
  none: false
280
266
  requirements:
281
267
  - - ">="
@@ -284,12 +270,12 @@ dependencies:
284
270
  segments:
285
271
  - 0
286
272
  version: "0"
287
- requirement: *id018
288
273
  prerelease: false
289
- name: rake
274
+ requirement: *id017
290
275
  type: :development
276
+ name: rake
291
277
  - !ruby/object:Gem::Dependency
292
- version_requirements: &id019 !ruby/object:Gem::Requirement
278
+ version_requirements: &id018 !ruby/object:Gem::Requirement
293
279
  none: false
294
280
  requirements:
295
281
  - - ~>
@@ -300,12 +286,12 @@ dependencies:
300
286
  - 2
301
287
  - 3
302
288
  version: 1.2.3
303
- requirement: *id019
304
289
  prerelease: false
305
- name: solrizer-fedora
290
+ requirement: *id018
306
291
  type: :development
292
+ name: solrizer-fedora
307
293
  - !ruby/object:Gem::Dependency
308
- version_requirements: &id020 !ruby/object:Gem::Requirement
294
+ version_requirements: &id019 !ruby/object:Gem::Requirement
309
295
  none: false
310
296
  requirements:
311
297
  - - ">="
@@ -316,12 +302,12 @@ dependencies:
316
302
  - 2
317
303
  - 0
318
304
  version: 1.2.0
319
- requirement: *id020
320
305
  prerelease: false
321
- name: jettywrapper
306
+ requirement: *id019
322
307
  type: :development
308
+ name: jettywrapper
323
309
  - !ruby/object:Gem::Dependency
324
- version_requirements: &id021 !ruby/object:Gem::Requirement
310
+ version_requirements: &id020 !ruby/object:Gem::Requirement
325
311
  none: false
326
312
  requirements:
327
313
  - - ~>
@@ -331,12 +317,12 @@ dependencies:
331
317
  - 2
332
318
  - 0
333
319
  version: "2.0"
334
- requirement: *id021
335
320
  prerelease: false
336
- name: rspec
321
+ requirement: *id020
337
322
  type: :development
323
+ name: rspec
338
324
  - !ruby/object:Gem::Dependency
339
- version_requirements: &id022 !ruby/object:Gem::Requirement
325
+ version_requirements: &id021 !ruby/object:Gem::Requirement
340
326
  none: false
341
327
  requirements:
342
328
  - - ">="
@@ -347,10 +333,10 @@ dependencies:
347
333
  - 9
348
334
  - 8
349
335
  version: 0.9.8
350
- requirement: *id022
351
336
  prerelease: false
352
- name: mocha
337
+ requirement: *id021
353
338
  type: :development
339
+ name: mocha
354
340
  description: ActiveFedora provides for creating and managing objects in the Fedora Repository Architecture.
355
341
  email:
356
342
  - matt.zumwalt@yourmediashelf.com
@@ -595,7 +581,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
595
581
  requirements: []
596
582
 
597
583
  rubyforge_project: rubyfedora
598
- rubygems_version: 1.8.10
584
+ rubygems_version: 1.8.15
599
585
  signing_key:
600
586
  specification_version: 3
601
587
  summary: A convenience libary for manipulating MODS (Metadata Object Description Schema) documents.