loaded_plugins

loaded_plugins adds Rails.plugins, a list all of the plugins that Rails has loaded.

Resources

API

Wiki

Announcement

Source

Development

Description

During initialization, Rails.plugins will keep track of a list of all of the plugins that have been loaded so far. Once initialization is complete, Rails.plugins will contain all of the plugins loaded in the application.

The order of the plugins will be based on the order in which the plugins were loaded during initialization.

Usage

If you need access to Rails.plugins during initialization of your application, you must use one of two things:

  1. Use config.plugins to specify the order in which plugins are

loaded, for example:

Rails::Initializer.run do |config|
  ...
  config.plugins = [
    'loaded_plugins',
    ...
  ]
end
  1. Require the plugin with the plugin_dependencies plugin installed.

If using require without plugin_dependencies installed, loaded_plugins will not track all of the plugins that were loaded prior to it being loaded until after initialization is complete.

Also, note that the plugins are listed in the order that they are completely loaded. That is, only after the entire initialization of a plugin is complete will it get added to Rails.plugins.

References

This plugin has been heavily influenced by the work James Adam has done in Engines 1.2 (www.rails-engines.org/).