active-fedora 3.1.0.rc1 → 3.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,5 +41,5 @@
41
41
  :is_topic_of: isTopicOf
42
42
  info:fedora/fedora-system:def/model#:
43
43
  :has_model: hasModel
44
- # http://www.openarchives.org/OAI/2.0/:
45
- # :oai_item_id: itemID
44
+ http://www.openarchives.org/OAI/2.0/:
45
+ :oai_item_id: itemID
@@ -577,7 +577,7 @@ module ActiveFedora
577
577
  ##TODO, this is all done by rubydora -- remove
578
578
  ds.mimeType = blob.respond_to?(:content_type) ? blob.content_type : "application/octet-stream"
579
579
  end
580
- if !ds.dsLabel.present?
580
+ if !ds.dsLabel.present? && blob.respond_to?(:path)
581
581
  ds.dsLabel = File.basename(blob.path)
582
582
  # ds.dsLabel = blob.original_filename
583
583
  end
@@ -16,7 +16,6 @@ module ActiveFedora
16
16
  alias_method(:om_update_values, :update_values) unless method_defined?(:om_update_values)
17
17
 
18
18
  attr_accessor :internal_solr_doc
19
- attr_reader :ng_xml
20
19
 
21
20
  # Create an instance of this class based on xml content
22
21
  # @param [String, File, Nokogiri::XML::Node] xml the xml content to build from
@@ -39,8 +38,14 @@ module ActiveFedora
39
38
  def self.xml_template
40
39
  Nokogiri::XML::Document.parse("<xml/>")
41
40
  end
41
+
42
+ def ng_xml
43
+ ensure_xml_loaded
44
+ return @ng_xml
45
+ end
42
46
 
43
47
  def ng_xml=(new_xml)
48
+ self.xml_loaded=true
44
49
  case new_xml
45
50
  when Nokogiri::XML::Document, Nokogiri::XML::Element, Nokogiri::XML::Node
46
51
  @ng_xml = new_xml
@@ -61,7 +61,7 @@ module ActiveFedora
61
61
  end
62
62
 
63
63
  def self.short_predicate(predicate)
64
- if match = /^([^#]+#)(.+)$/.match(predicate.to_str)
64
+ if match = /^(#{ActiveFedora::Base.predicate_mappings.keys.join('|')})(.+)$/.match(predicate.to_str)
65
65
  namespace = match[1]
66
66
  predicate = match[2]
67
67
  pred = ActiveFedora::Base.predicate_mappings[namespace].invert[predicate]
@@ -253,8 +253,10 @@ module ActiveFedora
253
253
 
254
254
  module ClassMethods
255
255
  def vocabularies
256
- @vocabularies ||= {"info:fedora/fedora-system:def/relations-external#" => RDF::Vocabulary.new("info:fedora/fedora-system:def/relations-external#"),
257
- "info:fedora/fedora-system:def/model#" => RDF::Vocabulary.new("info:fedora/fedora-system:def/model#")}
256
+ return @vocabularies if @vocabularies
257
+ @vocabularies = {}
258
+ predicate_mappings.keys.each { |ns| @vocabularies[ns] = RDF::Vocabulary.new(ns)}
259
+ @vocabularies
258
260
  end
259
261
 
260
262
  # Allows for a relationship to be treated like any other attribute of a model class. You define
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "3.1.0.rc1"
2
+ VERSION = "3.1.0.rc2"
3
3
  end
@@ -240,6 +240,12 @@ describe ActiveFedora::Base do
240
240
  ds.dsLabel.should == "minivan.jpg"
241
241
  ds.mimeType.should == "image/jpeg"
242
242
  end
243
+ it 'should create a datastream object from a string' do
244
+ ds = @test_object.create_datastream("ActiveFedora::Datastream", 'NAME', {:blob=>"My file data"})
245
+ ds.class.should == ActiveFedora::Datastream
246
+ ds.dsLabel.should == ""
247
+ ds.mimeType.should == "application/octet-stream"
248
+ end
243
249
  end
244
250
 
245
251
  it 'should provide #is_named_datastream?' do
@@ -1,6 +1,11 @@
1
1
  require File.join( File.dirname(__FILE__), "../spec_helper" )
2
2
 
3
3
  describe ActiveFedora::RelsExtDatastream do
4
+ describe "short_predicate" do
5
+ it 'should parse' do
6
+ ActiveFedora::RelsExtDatastream.short_predicate('http://www.openarchives.org/OAI/2.0/itemID').should == :oai_item_id
7
+ end
8
+ end
4
9
 
5
10
  before(:all) do
6
11
  @pid = "test:sample_pid"
@@ -21,6 +26,7 @@ describe ActiveFedora::RelsExtDatastream do
21
26
  @test_ds.should respond_to(:save)
22
27
  end
23
28
 
29
+
24
30
  describe '#serialize!' do
25
31
 
26
32
  it "should generate new rdf/xml as the datastream content if the object has been changed" do
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424103
4
+ hash: 15424097
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
9
  - 0
10
10
  - rc
11
- - 1
12
- version: 3.1.0.rc1
11
+ - 2
12
+ version: 3.1.0.rc2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Matt Zumwalt
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-10-27 00:00:00 -05:00
21
+ date: 2011-10-28 00:00:00 -05:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency