Module: ActiveFedora::Cleaner
- Defined in:
- lib/active_fedora/cleaner.rb
Class Method Summary collapse
- .clean! ⇒ Object
- .cleanout_fedora ⇒ Object
- .cleanout_solr ⇒ Object
- .connection ⇒ Object
- .delete_root_resource ⇒ Object
- .delete_tombstone ⇒ Object
- .log(message) ⇒ Object
- .reinitialize_repo ⇒ Object
- .root_resource_path ⇒ Object
- .solr_connection ⇒ Object
- .tombstone_path ⇒ Object
Class Method Details
.clean! ⇒ Object
3 4 5 6 7 |
# File 'lib/active_fedora/cleaner.rb', line 3 def self.clean! cleanout_fedora reinitialize_repo cleanout_solr end |
.cleanout_fedora ⇒ Object
9 10 11 12 13 14 |
# File 'lib/active_fedora/cleaner.rb', line 9 def self.cleanout_fedora delete_root_resource delete_tombstone rescue Ldp::HttpError => exception log "#cleanout_fedora in spec_helper.rb raised #{exception}" end |
.cleanout_solr ⇒ Object
41 42 43 44 |
# File 'lib/active_fedora/cleaner.rb', line 41 def self.cleanout_solr restore_spec_configuration if solr_connection.nil? solr_connection.delete_by_query('*:*', params: { 'softCommit' => true }) end |
.connection ⇒ Object
33 34 35 |
# File 'lib/active_fedora/cleaner.rb', line 33 def self.connection ActiveFedora.fedora.connection end |
.delete_root_resource ⇒ Object
16 17 18 19 |
# File 'lib/active_fedora/cleaner.rb', line 16 def self.delete_root_resource connection.delete(root_resource_path) rescue Ldp::Gone end |
.delete_tombstone ⇒ Object
21 22 23 |
# File 'lib/active_fedora/cleaner.rb', line 21 def self.delete_tombstone connection.delete(tombstone_path) end |
.log(message) ⇒ Object
50 51 52 |
# File 'lib/active_fedora/cleaner.rb', line 50 def self.log() ActiveFedora::Base.logger.debug end |
.reinitialize_repo ⇒ Object
46 47 48 |
# File 'lib/active_fedora/cleaner.rb', line 46 def self.reinitialize_repo ActiveFedora::Fedora.reset! end |
.root_resource_path ⇒ Object
29 30 31 |
# File 'lib/active_fedora/cleaner.rb', line 29 def self.root_resource_path ActiveFedora.fedora.root_resource_path end |
.solr_connection ⇒ Object
37 38 39 |
# File 'lib/active_fedora/cleaner.rb', line 37 def self.solr_connection ActiveFedora::SolrService.instance&.conn end |
.tombstone_path ⇒ Object
25 26 27 |
# File 'lib/active_fedora/cleaner.rb', line 25 def self.tombstone_path root_resource_path + "/fcr:tombstone" end |