Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BackgroundFu::Railtie basics

only run rails/init.rb if Rails version <= 2. If not BackgroundFu::Railtie is loaded and should perform same actions as original rails/init.rb
  • Loading branch information...
commit d20918d65b362ae74ad06c4d7ec7e3600e8a0d76 1 parent 54130b6
jrwest authored
View
4 init.rb
@@ -1 +1,3 @@
-require File.join(File.dirname(__FILE__), 'rails', 'init')
+if Rails::VERSION <= 2
+ require File.join(File.dirname(__FILE__), 'rails', 'init')
+end
View
6 lib/background_fu.rb
@@ -7,3 +7,9 @@ module BackgroundFu
CONFIG['monitor_interval'] ||= 10
end
+
+require 'job'
+require 'background_fu/worker_monitoring'
+require 'background_fu/railtie' if defined?(Rails)
+
+
View
9 lib/background_fu/railtie.rb
@@ -0,0 +1,9 @@
+module BackgroundFu
+ class Railtie < Rails::Railtie
+ railtie_name :background_fu
+
+ initializer "background_fu.set_load_paths", :after => :set_load_path do |app|
+ app.config.load_paths += %w('lib/workers')
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.