Class: Refinery::PluginLoader
- Inherits:
-
Rails::Plugin::Loader
- Object
- Rails::Plugin::Loader
- Refinery::PluginLoader
- Defined in:
- vendor/plugins/refinery/lib/refinery/initializer.rb
Instance Method Summary collapse
- #add_plugin_load_paths ⇒ Object
-
#ensure_all_registered_plugins_are_loaded! ⇒ Object
We need to overload this because some gems raise errors if they’re not installed rather than just letting the framework handle it so we need to trap them here.
Instance Method Details
#add_plugin_load_paths ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'vendor/plugins/refinery/lib/refinery/initializer.rb', line 20 def add_plugin_load_paths # call rails' add_plugin_load_paths super # add plugin lib paths to the $LOAD_PATH so that rake tasks etc. can be run when using a gem for refinery or gems for plugins. search_for = Regexp.new(File.join(%W(\( #{Refinery.root.join("vendor", "plugins")} \)? .+? lib))) paths = plugins.collect{ |plugin| plugin.load_paths }.flatten.reject{|path| path.scan(search_for).empty? or path.include?('/rails-') } paths = paths.reject{ |path| path.include?(Refinery.root.to_s) } unless Refinery.is_a_gem paths.uniq! ($refinery_gem_plugin_lib_paths = paths).each do |path| $LOAD_PATH.unshift path end $LOAD_PATH.uniq! end |
#ensure_all_registered_plugins_are_loaded! ⇒ Object
We need to overload this because some gems raise errors if they’re not installed rather than just letting the framework handle it so we need to trap them here.
37 38 39 40 41 42 43 |
# File 'vendor/plugins/refinery/lib/refinery/initializer.rb', line 37 def ensure_all_registered_plugins_are_loaded! begin super rescue LoadError => load_error raise LoadError, load_error.to_s unless load_error.to_s =~ /friendly_id|aasm|will_paginate/ end end |