active-fedora 6.0.0.rc2 → 6.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -5,8 +5,8 @@ source "http://rubygems.org"
5
5
  gemspec
6
6
 
7
7
  group :development, :test do
8
- gem 'simplecov', :platforms => [:mri_19, :mri_20]
9
- gem 'simplecov-rcov', :platforms => [:mri_19, :mri_20]
8
+ gem 'simplecov', :platforms => [:mri_19]#, :mri_20]
9
+ gem 'simplecov-rcov', :platforms => [:mri_19]#, :mri_20]
10
10
  end
11
11
 
12
12
  gem 'jruby-openssl', :platform=> :jruby
data/History.txt CHANGED
@@ -3,6 +3,7 @@ New solr schema with descriptive field suffixes
3
3
  Added support for RDF lists
4
4
  RDF does not index terms by default
5
5
  count is now a scoped query.
6
+ ActiveFedora::Base.reindex_everything
6
7
 
7
8
  5.6.1
8
9
  Fixed delegating enumerable methods (join, [], each_with_index, to_a, etc) on an RdfNode::TermProxy
data/lib/active_fedora.rb CHANGED
@@ -30,17 +30,15 @@ module ActiveFedora #:nodoc:
30
30
  autoload :ContentModel
31
31
  autoload :Callbacks
32
32
  autoload :Config
33
- autoload :FileConfigurator
34
- autoload :Reflection
35
- autoload :RelationshipGraph
36
33
  autoload :Datastream
37
34
  autoload :DatastreamHash
38
35
  autoload :Datastreams
39
36
  autoload :Delegating
40
37
  autoload :DigitalObject
41
- autoload :UnsavedDigitalObject
42
- autoload :SolrDigitalObject
38
+ autoload :FileConfigurator
39
+ autoload :Indexing
43
40
  autoload :Model
41
+ autoload :NestedAttributes
44
42
  autoload :NokogiriDatastream
45
43
  autoload :NomDatastream
46
44
  autoload :NtriplesRDFDatastream
@@ -54,13 +52,16 @@ module ActiveFedora #:nodoc:
54
52
  autoload :RdfNode
55
53
  autoload :RdfObject
56
54
  autoload :RdfxmlRDFDatastream
55
+ autoload :Reflection
57
56
  autoload :Relation
57
+ autoload :RelationshipGraph
58
58
  autoload :RelsExtDatastream
59
59
  autoload :ServiceDefinitions
60
60
  autoload :SemanticNode
61
61
  autoload :SimpleDatastream
62
+ autoload :SolrDigitalObject
62
63
  autoload :SolrService
63
- autoload :NestedAttributes
64
+ autoload :UnsavedDigitalObject
64
65
  autoload :FixtureLoader
65
66
  autoload :FixtureExporter
66
67
  autoload :DatastreamCollections
@@ -149,39 +149,6 @@ module ActiveFedora
149
149
  ds_specs[dsid] ? ds_specs[dsid].fetch(:type, ActiveFedora::Datastream) : ActiveFedora::Datastream
150
150
  end
151
151
 
152
- # Creates an object (or multiple objects) and saves it to the repository, if validations pass.
153
- # The resulting object is returned whether the object was saved successfully to the repository or not.
154
- #
155
- # The +attributes+ parameter can be either be a Hash or an Array of Hashes. These Hashes describe the
156
- # attributes on the objects that are to be created.
157
- #
158
- # ==== Examples
159
- # # Create a single new object
160
- # User.create(:first_name => 'Jamie')
161
- #
162
- # # Create an Array of new objects
163
- # User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }])
164
- #
165
- # # Create a single object and pass it into a block to set other attributes.
166
- # User.create(:first_name => 'Jamie') do |u|
167
- # u.is_admin = false
168
- # end
169
- #
170
- # # Creating an Array of new objects using a block, where the block is executed for each object:
171
- # User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }]) do |u|
172
- # u.is_admin = false
173
- # end
174
- def self.create(attributes = nil, &block)
175
- if attributes.is_a?(Array)
176
- attributes.collect { |attr| create(attr, &block) }
177
- else
178
- object = new(attributes)
179
- yield(object) if block_given?
180
- object.save
181
- object
182
- end
183
- end
184
-
185
152
  def clone
186
153
  new_object = self.class.create
187
154
  clone_into(new_object)
@@ -297,61 +264,6 @@ module ActiveFedora
297
264
  end
298
265
  end
299
266
 
300
- # Return a Hash representation of this object where keys in the hash are appropriate Solr field names.
301
- # @param [Hash] solr_doc (optional) Hash to insert the fields into
302
- # @param [Hash] opts (optional)
303
- # If opts[:model_only] == true, the base object metadata and the RELS-EXT datastream will be omitted. This is mainly to support shelver, which calls .to_solr for each model an object subscribes to.
304
- def to_solr(solr_doc = Hash.new, opts={})
305
- unless opts[:model_only]
306
- c_time = create_date
307
- c_time = Time.parse(c_time) unless c_time.is_a?(Time)
308
- m_time = modified_date
309
- m_time = Time.parse(m_time) unless m_time.is_a?(Time)
310
- Solrizer.set_field(solr_doc, 'system_create', c_time, :stored_sortable)
311
- Solrizer.set_field(solr_doc, 'system_modified', m_time, :stored_sortable)
312
- Solrizer.set_field(solr_doc, 'active_fedora_model', self.class.inspect, :symbol)
313
- solr_doc.merge!(SOLR_DOCUMENT_ID.to_sym => pid)
314
- solrize_profile(solr_doc)
315
- end
316
- datastreams.each_value do |ds|
317
- solr_doc = ds.to_solr(solr_doc)
318
- end
319
- solr_doc = solrize_relationships(solr_doc) unless opts[:model_only]
320
- solr_doc
321
- end
322
-
323
- def solr_name(*args)
324
- ActiveFedora::SolrService.solr_name(*args)
325
- end
326
-
327
- def solrize_profile(solr_doc = Hash.new) # :nodoc:
328
- profile_hash = { 'datastreams' => {} }
329
- if inner_object.respond_to? :profile
330
- inner_object.profile.each_pair do |property,value|
331
- if property =~ /Date/
332
- value = Time.parse(value) unless value.is_a?(Time)
333
- value = value.xmlschema
334
- end
335
- profile_hash[property] = value
336
- end
337
- end
338
- self.datastreams.each_pair { |dsid,ds| profile_hash['datastreams'][dsid] = ds.solrize_profile }
339
- solr_doc[self.class.profile_solr_name] = profile_hash.to_json
340
- end
341
-
342
- # Serialize the datastream's RDF relationships to solr
343
- # @param [Hash] solr_doc @deafult an empty Hash
344
- def solrize_relationships(solr_doc = Hash.new)
345
- relationships.each_statement do |statement|
346
- predicate = RelsExtDatastream.short_predicate(statement.predicate)
347
- literal = statement.object.kind_of?(RDF::Literal)
348
- val = literal ? statement.object.value : statement.object.to_str
349
- ::Solrizer::Extractor.insert_solr_field_value(solr_doc, solr_name(predicate, :symbol), val )
350
- end
351
- return solr_doc
352
- end
353
-
354
-
355
267
  # This method adapts the inner_object to a new ActiveFedora::Base implementation
356
268
  # This is intended to minimize redundant interactions with Fedora
357
269
  def adapt_to(klass)
@@ -387,52 +299,6 @@ module ActiveFedora
387
299
  self.init_with DigitalObject.find(self.class,self.pid)
388
300
  end
389
301
 
390
- # This method can be used instead of ActiveFedora::Model::ClassMethods.find.
391
- # It works similarly except it populates an object from Solr instead of Fedora.
392
- # It is most useful for objects used in read-only displays in order to speed up loading time. If only
393
- # a pid is passed in it will query solr for a corresponding solr document and then use it
394
- # to populate this object.
395
- #
396
- # If a value is passed in for optional parameter solr_doc it will not query solr again and just use the
397
- # one passed to populate the object.
398
- #
399
- # It will anything stored within solr such as metadata and relationships. Non-metadata datastreams will not
400
- # be loaded and if needed you should use find instead.
401
- def self.load_instance_from_solr(pid,solr_doc=nil)
402
- if solr_doc.nil?
403
- result = find_with_conditions(:id=>pid)
404
- raise ActiveFedora::ObjectNotFoundError, "Object #{pid} not found in solr" if result.empty?
405
- solr_doc = result.first
406
- #double check pid and id in record match
407
- raise ActiveFedora::ObjectNotFoundError, "Object #{pid} not found in Solr" unless !result.nil? && !solr_doc.nil? && pid == solr_doc[SOLR_DOCUMENT_ID]
408
- else
409
- raise "Solr document record id and pid do not match" unless pid == solr_doc[SOLR_DOCUMENT_ID]
410
- end
411
- klass = if class_str = solr_doc[ActiveFedora::SolrService.solr_name('has_model', :symbol)]
412
- ActiveFedora::SolrService.class_from_solr_document(solr_doc)
413
- else
414
- ActiveFedora::Base
415
- end
416
-
417
- profile_json = Array(solr_doc[ActiveFedora::Base.profile_solr_name]).first
418
- unless profile_json.present?
419
- raise ActiveFedora::ObjectNotFoundError, "Object #{pid} does not contain a solrized profile"
420
- end
421
- profile_hash = ActiveSupport::JSON.decode(profile_json)
422
- obj = klass.allocate.init_with(SolrDigitalObject.new(solr_doc, profile_hash, klass))
423
- #set by default to load any dependent relationship objects from solr as well
424
- #need to call rels_ext once so it exists when iterating over datastreams
425
- obj.rels_ext
426
- obj.datastreams.each_value do |ds|
427
- if ds.respond_to?(:profile_from_hash) and (ds_prof = profile_hash['datastreams'][ds.dsid])
428
- ds.profile_from_hash(ds_prof)
429
- end
430
- ds.from_solr(solr_doc) if ds.respond_to?(:from_solr)
431
- end
432
- obj.inner_object.freeze
433
- obj
434
- end
435
-
436
302
  def self.pids_from_uris(uris)
437
303
  if uris.class == String
438
304
  return uris.gsub("info:fedora/", "")
@@ -451,6 +317,7 @@ module ActiveFedora
451
317
  include ActiveFedora::Persistence
452
318
  include Model
453
319
  include Loggable
320
+ include Indexing
454
321
  include ActiveModel::Conversion
455
322
  include Validations
456
323
  include Callbacks
@@ -0,0 +1,139 @@
1
+ module ActiveFedora
2
+ module Indexing
3
+ extend ActiveSupport::Concern
4
+
5
+ # Return a Hash representation of this object where keys in the hash are appropriate Solr field names.
6
+ # @param [Hash] solr_doc (optional) Hash to insert the fields into
7
+ # @param [Hash] opts (optional)
8
+ # If opts[:model_only] == true, the base object metadata and the RELS-EXT datastream will be omitted. This is mainly to support shelver, which calls .to_solr for each model an object subscribes to.
9
+ def to_solr(solr_doc = Hash.new, opts={})
10
+ unless opts[:model_only]
11
+ c_time = create_date
12
+ c_time = Time.parse(c_time) unless c_time.is_a?(Time)
13
+ m_time = modified_date
14
+ m_time = Time.parse(m_time) unless m_time.is_a?(Time)
15
+ Solrizer.set_field(solr_doc, 'system_create', c_time, :stored_sortable)
16
+ Solrizer.set_field(solr_doc, 'system_modified', m_time, :stored_sortable)
17
+ Solrizer.set_field(solr_doc, 'active_fedora_model', self.class.inspect, :symbol)
18
+ solr_doc.merge!(SOLR_DOCUMENT_ID.to_sym => pid)
19
+ solrize_profile(solr_doc)
20
+ end
21
+ datastreams.each_value do |ds|
22
+ solr_doc = ds.to_solr(solr_doc)
23
+ end
24
+ solr_doc = solrize_relationships(solr_doc) unless opts[:model_only]
25
+ solr_doc
26
+ end
27
+
28
+ def solr_name(*args)
29
+ ActiveFedora::SolrService.solr_name(*args)
30
+ end
31
+
32
+ def solrize_profile(solr_doc = Hash.new) # :nodoc:
33
+ profile_hash = { 'datastreams' => {} }
34
+ if inner_object.respond_to? :profile
35
+ inner_object.profile.each_pair do |property,value|
36
+ if property =~ /Date/
37
+ value = Time.parse(value) unless value.is_a?(Time)
38
+ value = value.xmlschema
39
+ end
40
+ profile_hash[property] = value
41
+ end
42
+ end
43
+ self.datastreams.each_pair { |dsid,ds| profile_hash['datastreams'][dsid] = ds.solrize_profile }
44
+ solr_doc[self.class.profile_solr_name] = profile_hash.to_json
45
+ end
46
+
47
+ # Serialize the datastream's RDF relationships to solr
48
+ # @param [Hash] solr_doc @deafult an empty Hash
49
+ def solrize_relationships(solr_doc = Hash.new)
50
+ relationships.each_statement do |statement|
51
+ predicate = RelsExtDatastream.short_predicate(statement.predicate)
52
+ literal = statement.object.kind_of?(RDF::Literal)
53
+ val = literal ? statement.object.value : statement.object.to_str
54
+ ::Solrizer::Extractor.insert_solr_field_value(solr_doc, solr_name(predicate, :symbol), val )
55
+ end
56
+ return solr_doc
57
+ end
58
+
59
+ # Updates Solr index with self.
60
+ def update_index
61
+ if defined?( Solrizer::Fedora::Solrizer )
62
+ #logger.info("Trying to solrize pid: #{pid}")
63
+ solrizer = Solrizer::Fedora::Solrizer.new
64
+ solrizer.solrize( self )
65
+ else
66
+ SolrService.add(self.to_solr)
67
+ SolrService.commit
68
+ end
69
+ end
70
+
71
+
72
+ module ClassMethods
73
+ # This method can be used instead of ActiveFedora::Model::ClassMethods.find.
74
+ # It works similarly except it populates an object from Solr instead of Fedora.
75
+ # It is most useful for objects used in read-only displays in order to speed up loading time. If only
76
+ # a pid is passed in it will query solr for a corresponding solr document and then use it
77
+ # to populate this object.
78
+ #
79
+ # If a value is passed in for optional parameter solr_doc it will not query solr again and just use the
80
+ # one passed to populate the object.
81
+ #
82
+ # It will anything stored within solr such as metadata and relationships. Non-metadata datastreams will not
83
+ # be loaded and if needed you should use find instead.
84
+ def load_instance_from_solr(pid,solr_doc=nil)
85
+ if solr_doc.nil?
86
+ result = find_with_conditions(:id=>pid)
87
+ raise ActiveFedora::ObjectNotFoundError, "Object #{pid} not found in solr" if result.empty?
88
+ solr_doc = result.first
89
+ #double check pid and id in record match
90
+ raise ActiveFedora::ObjectNotFoundError, "Object #{pid} not found in Solr" unless !result.nil? && !solr_doc.nil? && pid == solr_doc[SOLR_DOCUMENT_ID]
91
+ else
92
+ raise "Solr document record id and pid do not match" unless pid == solr_doc[SOLR_DOCUMENT_ID]
93
+ end
94
+ klass = if class_str = solr_doc[ActiveFedora::SolrService.solr_name('has_model', :symbol)]
95
+ ActiveFedora::SolrService.class_from_solr_document(solr_doc)
96
+ else
97
+ ActiveFedora::Base
98
+ end
99
+
100
+ profile_json = Array(solr_doc[ActiveFedora::Base.profile_solr_name]).first
101
+ unless profile_json.present?
102
+ raise ActiveFedora::ObjectNotFoundError, "Object #{pid} does not contain a solrized profile"
103
+ end
104
+ profile_hash = ActiveSupport::JSON.decode(profile_json)
105
+ obj = klass.allocate.init_with(SolrDigitalObject.new(solr_doc, profile_hash, klass))
106
+ #set by default to load any dependent relationship objects from solr as well
107
+ #need to call rels_ext once so it exists when iterating over datastreams
108
+ obj.rels_ext
109
+ obj.datastreams.each_value do |ds|
110
+ if ds.respond_to?(:profile_from_hash) and (ds_prof = profile_hash['datastreams'][ds.dsid])
111
+ ds.profile_from_hash(ds_prof)
112
+ end
113
+ ds.from_solr(solr_doc) if ds.respond_to?(:from_solr)
114
+ end
115
+ obj.inner_object.freeze
116
+ obj
117
+ end
118
+
119
+ # Using the fedora search (not solr), get every object and reindex it.
120
+ def reindex_everything
121
+ connections.each do |conn|
122
+ conn.search(nil) do |object|
123
+ ActiveFedora::Base.find(object.pid, :cast=>true).update_index
124
+ end
125
+ end
126
+ end
127
+
128
+ private
129
+
130
+ def connections
131
+ if ActiveFedora.config.sharded?
132
+ return ActiveFedora.config.credentials.map { |cred| ActiveFedora::RubydoraConnection.new(cred).connection}
133
+ else
134
+ return [ActiveFedora::RubydoraConnection.new(ActiveFedora.config.credentials).connection]
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
@@ -106,7 +106,7 @@ module ActiveFedora
106
106
  end
107
107
 
108
108
  def content_changed?
109
- return false if new? and !xml_loaded
109
+ return false if !xml_loaded
110
110
  super
111
111
  end
112
112
 
@@ -1,6 +1,7 @@
1
1
  module ActiveFedora
2
2
  # = Active Fedora Persistence
3
3
  module Persistence
4
+ extend ActiveSupport::Concern
4
5
 
5
6
  #Saves a Base object, and any dirty datastreams, then updates
6
7
  #the Solr index for this object.
@@ -79,15 +80,38 @@ module ActiveFedora
79
80
  delete
80
81
  end
81
82
 
82
- # Updates Solr index with self.
83
- def update_index
84
- if defined?( Solrizer::Fedora::Solrizer )
85
- #logger.info("Trying to solrize pid: #{pid}")
86
- solrizer = Solrizer::Fedora::Solrizer.new
87
- solrizer.solrize( self )
88
- else
89
- SolrService.add(self.to_solr)
90
- SolrService.commit
83
+ module ClassMethods
84
+ # Creates an object (or multiple objects) and saves it to the repository, if validations pass.
85
+ # The resulting object is returned whether the object was saved successfully to the repository or not.
86
+ #
87
+ # The +attributes+ parameter can be either be a Hash or an Array of Hashes. These Hashes describe the
88
+ # attributes on the objects that are to be created.
89
+ #
90
+ # ==== Examples
91
+ # # Create a single new object
92
+ # User.create(:first_name => 'Jamie')
93
+ #
94
+ # # Create an Array of new objects
95
+ # User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }])
96
+ #
97
+ # # Create a single object and pass it into a block to set other attributes.
98
+ # User.create(:first_name => 'Jamie') do |u|
99
+ # u.is_admin = false
100
+ # end
101
+ #
102
+ # # Creating an Array of new objects using a block, where the block is executed for each object:
103
+ # User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }]) do |u|
104
+ # u.is_admin = false
105
+ # end
106
+ def create(attributes = nil, &block)
107
+ if attributes.is_a?(Array)
108
+ attributes.collect { |attr| create(attr, &block) }
109
+ else
110
+ object = new(attributes)
111
+ yield(object) if block_given?
112
+ object.save
113
+ object
114
+ end
91
115
  end
92
116
  end
93
117
 
@@ -107,7 +131,6 @@ module ActiveFedora
107
131
 
108
132
  private
109
133
 
110
-
111
134
  # Deals with preparing new object to be saved to Fedora, then pushes it and its datastreams into Fedora.
112
135
  def create
113
136
  assign_pid
@@ -136,7 +159,5 @@ module ActiveFedora
136
159
  refresh
137
160
  return !!result
138
161
  end
139
-
140
-
141
162
  end
142
163
  end
@@ -103,7 +103,6 @@ module ActiveFedora
103
103
  cast ? af_base.adapt_to_cmodel : af_base
104
104
  end
105
105
 
106
-
107
106
  private
108
107
 
109
108
  # Returns a solr query for the supplied conditions
@@ -46,6 +46,8 @@ module ActiveFedora
46
46
  end
47
47
 
48
48
  def content_changed?
49
+ # we haven't touched the graph, so it isn't changed (avoid a force load)
50
+ return false unless instance_variable_defined? :@graph
49
51
  @content = serialize
50
52
  super
51
53
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "6.0.0.rc2"
2
+ VERSION = "6.0.0.rc3"
3
3
  end
@@ -34,6 +34,7 @@ describe "Nested Rdf Objects" do
34
34
  ds.parts = comp
35
35
  ds.parts.first.label.should == ["Alternator"]
36
36
  end
37
+
37
38
  it "should be able to nest many complex objects" do
38
39
  comp1 = SpecDatastream::Component.new ds.graph
39
40
  comp1.label = ["Alternator"]
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,17 @@
1
1
  ENV["environment"] ||= 'test'
2
2
  require "bundler/setup"
3
3
 
4
- require 'simplecov'
5
- require 'simplecov-rcov'
6
4
 
7
- SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
8
- SimpleCov.start
5
+ begin
6
+ require 'simplecov'
7
+ require 'simplecov-rcov'
8
+
9
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
10
+ SimpleCov.start
11
+ rescue LoadError
12
+ #It's nbd if we don't have simplecov
13
+ $stderr.puts "Couldn't load simplecov"
14
+ end
9
15
 
10
16
  require 'active-fedora'
11
17
  require 'rspec'
@@ -75,6 +75,19 @@ describe ActiveFedora::Base do
75
75
 
76
76
  end
77
77
 
78
+ describe "reindex_everything" do
79
+ it "should call update_index on every object" do
80
+ Rubydora::Repository.any_instance.should_receive(:search).
81
+ and_yield(stub(pid:'XXX')).and_yield(stub(pid:'YYY')).and_yield(stub(pid:'ZZZ'))
82
+ mock_update = stub(:mock_obj)
83
+ mock_update.should_receive(:update_index).exactly(3).times
84
+ ActiveFedora::Base.should_receive(:find).with('XXX', :cast=>true).and_return(mock_update)
85
+ ActiveFedora::Base.should_receive(:find).with('YYY', :cast=>true).and_return(mock_update)
86
+ ActiveFedora::Base.should_receive(:find).with('ZZZ', :cast=>true).and_return(mock_update)
87
+ ActiveFedora::Base.reindex_everything
88
+ end
89
+ end
90
+
78
91
  describe "With a test class" do
79
92
  before :all do
80
93
  class FooHistory < ActiveFedora::Base
@@ -376,4 +376,23 @@ describe ActiveFedora::OmDatastream do
376
376
  @mods_ds.term_values(*term_pointer)
377
377
  end
378
378
  end
379
+ describe "an instance that exists in the datastore, but hasn't been loaded" do
380
+ before do
381
+ class MyObj < ActiveFedora::Base
382
+ has_metadata 'descMetadata', type: Hydra::ModsArticleDatastream
383
+ end
384
+ @obj = MyObj.new
385
+ @obj.descMetadata.title = 'Foobar'
386
+ @obj.save
387
+ end
388
+ after do
389
+ @obj.destroy
390
+ Object.send(:remove_const, :MyObj)
391
+ end
392
+ subject { @obj.reload.descMetadata }
393
+ it "should not load the descMetadata datastream when calling content_changed?" do
394
+ @obj.inner_object.repository.should_not_receive(:datastream_dissemination).with(hash_including(:dsid=>'descMetadata'))
395
+ subject.should_not be_content_changed
396
+ end
397
+ end
379
398
  end
@@ -1,5 +1,33 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::RDFDatastream do
4
- its(:metadata?) { should be_true}
4
+ describe "a new instance" do
5
+ its(:metadata?) { should be_true}
6
+ its(:content_changed?) { should be_false}
7
+ end
8
+ describe "an instance that exists in the datastore, but hasn't been loaded" do
9
+ before do
10
+ class MyDatastream < ActiveFedora::NtriplesRDFDatastream
11
+ map_predicates do |map|
12
+ map.title(:in => RDF::DC)
13
+ end
14
+ end
15
+ class MyObj < ActiveFedora::Base
16
+ has_metadata 'descMetadata', type: MyDatastream
17
+ end
18
+ @obj = MyObj.new
19
+ @obj.descMetadata.title = 'Foobar'
20
+ @obj.save
21
+ end
22
+ after do
23
+ @obj.destroy
24
+ Object.send(:remove_const, :MyDatastream)
25
+ Object.send(:remove_const, :MyObj)
26
+ end
27
+ subject { @obj.reload.descMetadata }
28
+ it "should not load the descMetadata datastream when calling content_changed?" do
29
+ @obj.inner_object.repository.should_not_receive(:datastream_dissemination).with(hash_including(:dsid=>'descMetadata'))
30
+ subject.should_not be_content_changed
31
+ end
32
+ end
5
33
  end
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: 6.0.0.rc2
4
+ version: 6.0.0.rc3
5
5
  prerelease: 6
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-02-15 00:00:00.000000000 Z
14
+ date: 2013-02-22 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.9.0.pre1
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.9.0.pre1
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: 3.0.0.pre7
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: 3.0.0.pre7
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,7 +146,7 @@ dependencies:
146
146
  requirement: !ruby/object:Gem::Requirement
147
147
  none: false
148
148
  requirements:
149
- - - "~>"
149
+ - - ~>
150
150
  - !ruby/object:Gem::Version
151
151
  version: '1.4'
152
152
  type: :runtime
@@ -154,7 +154,7 @@ dependencies:
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  none: false
156
156
  requirements:
157
- - - "~>"
157
+ - - ~>
158
158
  - !ruby/object:Gem::Version
159
159
  version: '1.4'
160
160
  - !ruby/object:Gem::Dependency
@@ -162,7 +162,7 @@ dependencies:
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: 1.0.0
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: 1.0.0
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: '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: '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: 1.2.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: 1.2.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: 2.9.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: 2.9.0
304
304
  - !ruby/object:Gem::Dependency
@@ -306,7 +306,7 @@ dependencies:
306
306
  requirement: !ruby/object:Gem::Requirement
307
307
  none: false
308
308
  requirements:
309
- - - ">="
309
+ - - ! '>='
310
310
  - !ruby/object:Gem::Version
311
311
  version: '0'
312
312
  type: :development
@@ -314,7 +314,7 @@ dependencies:
314
314
  version_requirements: !ruby/object:Gem::Requirement
315
315
  none: false
316
316
  requirements:
317
- - - ">="
317
+ - - ! '>='
318
318
  - !ruby/object:Gem::Version
319
319
  version: '0'
320
320
  description: ActiveFedora provides for creating and managing objects in the Fedora
@@ -327,8 +327,8 @@ extra_rdoc_files:
327
327
  - LICENSE
328
328
  - README.textile
329
329
  files:
330
- - ".gitignore"
331
- - ".gitmodules"
330
+ - .gitignore
331
+ - .gitmodules
332
332
  - CONSOLE_GETTING_STARTED.textile
333
333
  - Gemfile
334
334
  - History.txt
@@ -367,6 +367,7 @@ files:
367
367
  - lib/active_fedora/file_configurator.rb
368
368
  - lib/active_fedora/fixture_exporter.rb
369
369
  - lib/active_fedora/fixture_loader.rb
370
+ - lib/active_fedora/indexing.rb
370
371
  - lib/active_fedora/locale/en.yml
371
372
  - lib/active_fedora/model.rb
372
373
  - lib/active_fedora/nested_attributes.rb
@@ -564,13 +565,13 @@ require_paths:
564
565
  required_ruby_version: !ruby/object:Gem::Requirement
565
566
  none: false
566
567
  requirements:
567
- - - ">="
568
+ - - ! '>='
568
569
  - !ruby/object:Gem::Version
569
570
  version: 1.9.3
570
571
  required_rubygems_version: !ruby/object:Gem::Requirement
571
572
  none: false
572
573
  requirements:
573
- - - ">"
574
+ - - ! '>'
574
575
  - !ruby/object:Gem::Version
575
576
  version: 1.3.1
576
577
  requirements: []