Rails config.plugins exclusions

Posted by admin Thu, 18 Jun 2009 21:03:00 GMT

Running RCOV, and having it complain about a p articular plugin that it should not have been looking at in the first place, made me want to find a way to exclude it. In my usual practical fashion, I hit google up for a quick way to exclude the unwanted plugin.

Here it is re-posted from Dan Mange’s Blog

config.plugins = Rails::Initializer.new(config).send(:find_plugins, config.plugin_paths).map {|path| File.basename(path)}
config.plugins -= %W(plugin_one plugin_two)

UPDATE: JJ Barrett has an update for Rails 2.x… http://www.jjbarrett.net/archives/plugin-ordering-and-exclusion-in-rails-20

  config.plugins = config.plugin_locators.map do |locator|
                     locator.new(Rails::Initializer.new(config)).plugins
                   end.flatten.map{|p| p.name.to_sym}
  config.plugins -= [:do_not_load_plugin_1, :do_not_load_plugin_2]

Posted in  | Tags , ,  | no comments

Comments

(leave url/email »)

   Comment Markup Help Preview comment