Module: Promiscuous::Loader
- Defined in:
- lib/promiscuous/loader.rb
Constant Summary collapse
- CONFIG_FILES =
%w(config/publishers.rb config/subscribers.rb config/promiscuous.rb)
Class Method Summary collapse
Class Method Details
.cleanup ⇒ Object
16 17 18 19 20 |
# File 'lib/promiscuous/loader.rb', line 16 def self.cleanup Promiscuous::Publisher::Model.publishers.clear Promiscuous::Publisher::Model::Mongoid.collection_mapping.clear if defined?(Mongoid) Promiscuous::Subscriber::Model.mapping.values.reject! { |as| as =~ /^Promiscuous::/ } end |
.prepare ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/promiscuous/loader.rb', line 4 def self.prepare CONFIG_FILES.each do |file_name| file = defined?(Rails) ? Rails.root.join(file_name) : File.join('.', file_name) load file if File.exists?(file) end # A one shot recovery on boot if Promiscuous::Config.recovery_on_boot Promiscuous::Publisher::Worker.new.try_recover end end |