active-fedora 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +9 -9
- data/History.txt +4 -0
- data/active-fedora.gemspec +1 -1
- data/lib/active_fedora/datastream.rb +5 -0
- data/lib/active_fedora/nokogiri_datastream.rb +0 -6
- data/lib/active_fedora/rels_ext_datastream.rb +0 -2
- data/lib/active_fedora/version.rb +1 -1
- data/spec/unit/datastream_spec.rb +1 -1
- data/spec/unit/metadata_datastream_spec.rb +14 -6
- metadata +6 -6
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active-fedora (3.1.
|
4
|
+
active-fedora (3.1.3)
|
5
5
|
activeresource (~> 3.0.0)
|
6
6
|
activesupport (~> 3.0.0)
|
7
7
|
equivalent-xml
|
@@ -13,7 +13,7 @@ PATH
|
|
13
13
|
om (>= 1.4.3)
|
14
14
|
rdf
|
15
15
|
rdf-rdfxml
|
16
|
-
rubydora (= 0.2.
|
16
|
+
rubydora (= 0.2.4)
|
17
17
|
solr-ruby (>= 0.0.6)
|
18
18
|
solrizer (> 1.0.0)
|
19
19
|
xml-simple (>= 1.0.12)
|
@@ -22,14 +22,14 @@ GEM
|
|
22
22
|
remote: http://rubygems.org/
|
23
23
|
specs:
|
24
24
|
RedCloth (4.2.8)
|
25
|
-
activemodel (3.0.
|
26
|
-
activesupport (= 3.0.
|
25
|
+
activemodel (3.0.11)
|
26
|
+
activesupport (= 3.0.11)
|
27
27
|
builder (~> 2.1.2)
|
28
28
|
i18n (~> 0.5.0)
|
29
|
-
activeresource (3.0.
|
30
|
-
activemodel (= 3.0.
|
31
|
-
activesupport (= 3.0.
|
32
|
-
activesupport (3.0.
|
29
|
+
activeresource (3.0.11)
|
30
|
+
activemodel (= 3.0.11)
|
31
|
+
activesupport (= 3.0.11)
|
32
|
+
activesupport (3.0.11)
|
33
33
|
addressable (2.2.6)
|
34
34
|
akami (1.0.0)
|
35
35
|
gyoku (>= 0.4.0)
|
@@ -87,7 +87,7 @@ GEM
|
|
87
87
|
ruby-debug-base (~> 0.10.4.0)
|
88
88
|
ruby-debug-base (0.10.4)
|
89
89
|
linecache (>= 0.3)
|
90
|
-
rubydora (0.2.
|
90
|
+
rubydora (0.2.4)
|
91
91
|
activemodel
|
92
92
|
activesupport
|
93
93
|
fastercsv
|
data/History.txt
CHANGED
data/active-fedora.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_dependency("mediashelf-loggable")
|
28
28
|
s.add_dependency("equivalent-xml")
|
29
29
|
s.add_dependency("facets")
|
30
|
-
s.add_dependency("rubydora", '0.2.
|
30
|
+
s.add_dependency("rubydora", '0.2.4')
|
31
31
|
s.add_dependency("rdf")
|
32
32
|
s.add_dependency("rdf-rdfxml")
|
33
33
|
s.add_development_dependency("yard")
|
@@ -4,6 +4,7 @@ module ActiveFedora
|
|
4
4
|
class Datastream < Rubydora::Datastream
|
5
5
|
|
6
6
|
attr_accessor :dirty, :last_modified, :fields
|
7
|
+
before_create :add_mime_type
|
7
8
|
|
8
9
|
def initialize(digital_object, dsid)
|
9
10
|
@fields={}
|
@@ -15,6 +16,10 @@ module ActiveFedora
|
|
15
16
|
self.profile['dsSize']
|
16
17
|
end
|
17
18
|
|
19
|
+
def add_mime_type
|
20
|
+
self.mimeType = 'text/xml' unless self.mimeType
|
21
|
+
end
|
22
|
+
|
18
23
|
#compatibility method for rails' url generators. This method will
|
19
24
|
#urlescape escape dots, which are apparently
|
20
25
|
#invalid characters in a dsid.
|
@@ -17,12 +17,6 @@ module ActiveFedora
|
|
17
17
|
|
18
18
|
attr_accessor :internal_solr_doc
|
19
19
|
|
20
|
-
before_create :add_mime_type
|
21
|
-
|
22
|
-
def add_mime_type
|
23
|
-
self.mimeType= 'text/xml'
|
24
|
-
end
|
25
|
-
|
26
20
|
# Create an instance of this class based on xml content
|
27
21
|
# @param [String, File, Nokogiri::XML::Node] xml the xml content to build from
|
28
22
|
# @param [ActiveFedora::MetadataDatastream] tmpl the Datastream object that you are building @default a new instance of this class
|
@@ -21,7 +21,7 @@ describe ActiveFedora::Datastream do
|
|
21
21
|
describe '#save' do
|
22
22
|
it "should set dirty? to false" do
|
23
23
|
@mock_repo = mock('repository')
|
24
|
-
@mock_repo.stubs(:add_datastream).with(:versionable => true, :pid => @test_object.pid, :dsid => 'abcd', :controlGroup => 'M', :dsState => 'A', :content => 'hi there', :checksumType => 'DISABLED')
|
24
|
+
@mock_repo.stubs(:add_datastream).with(:mimeType=>'text/xml', :versionable => true, :pid => @test_object.pid, :dsid => 'abcd', :controlGroup => 'M', :dsState => 'A', :content => 'hi there', :checksumType => 'DISABLED')
|
25
25
|
@mock_repo.expects(:datastream).with(:dsid => 'abcd', :pid => @test_object.pid)
|
26
26
|
@test_object.inner_object.stubs(:repository).returns(@mock_repo)
|
27
27
|
@test_datastream.dirty?.should be_true
|
@@ -18,11 +18,13 @@ describe ActiveFedora::MetadataDatastream do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
before(:each) do
|
21
|
+
mock_inner = mock('inner object')
|
21
22
|
@test_object = ActiveFedora::Base.new
|
22
|
-
@
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
@mock_repo = mock('repository')
|
24
|
+
@mock_repo.stubs(:datastream_dissemination=>'My Content')
|
25
|
+
mock_inner.stubs(:repository).returns(@mock_repo)
|
26
|
+
mock_inner.stubs(:pid)
|
27
|
+
@test_ds = ActiveFedora::MetadataDatastream.new(mock_inner, 'mdDs')
|
26
28
|
end
|
27
29
|
|
28
30
|
describe '#new' do
|
@@ -37,8 +39,14 @@ describe ActiveFedora::MetadataDatastream do
|
|
37
39
|
end
|
38
40
|
|
39
41
|
describe '.save' do
|
40
|
-
it "should
|
41
|
-
@test_ds.
|
42
|
+
it "should persist the product of .to_xml in fedora" do
|
43
|
+
@test_ds.expects(:new?).returns(true).twice
|
44
|
+
@mock_repo.expects(:datastream).with(:pid => nil, :dsid => 'mdDs')
|
45
|
+
@mock_repo.expects(:add_datastream).with(:pid => nil, :dsid => 'mdDs', :checksumType => 'DISABLED', :versionable => true, :content => 'fake xml', :controlGroup => 'M', :dsState => 'A', :mimeType=>'text/xml')
|
46
|
+
@test_ds.expects(:to_xml).returns("fake xml")
|
47
|
+
@test_ds.serialize!
|
48
|
+
@test_ds.save
|
49
|
+
@test_ds.mimeType.should == 'text/xml'
|
42
50
|
end
|
43
51
|
end
|
44
52
|
|
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:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 3.1.
|
9
|
+
- 3
|
10
|
+
version: 3.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Zumwalt
|
@@ -211,12 +211,12 @@ dependencies:
|
|
211
211
|
requirements:
|
212
212
|
- - "="
|
213
213
|
- !ruby/object:Gem::Version
|
214
|
-
hash:
|
214
|
+
hash: 31
|
215
215
|
segments:
|
216
216
|
- 0
|
217
217
|
- 2
|
218
|
-
-
|
219
|
-
version: 0.2.
|
218
|
+
- 4
|
219
|
+
version: 0.2.4
|
220
220
|
requirement: *id013
|
221
221
|
- !ruby/object:Gem::Dependency
|
222
222
|
name: rdf
|