Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6851 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

[PATCH] respect plugin order in config.plugins

Reported by: lazyatom Assigned to: core
Priority: normal Milestone: 1.2
Component: Railties Version: edge
Severity: normal Keywords: plugin plugins load order initializer configuration patch
Cc: michael@koziarski.com

Description

As discussed on the rails-core ML (14/12/2006), here's a patch to enable the loading of plugins in the order specified in config.plugins. There are a few things to note:

  • since order is important, Rails::Initializer#loaded_plugins is now an Array rather than a Set
  • The semantics of config.plugins were slightly broken. Setting config.plugins = [] should mean that *no* plugins are loaded; if an Array of N names implies that N plugins will be loaded, an Array of 0 names should result in 0 plugins being loaded. The (new) default value config.plugins = nil ensures that *all* plugins are loaded in sorted order (the default behaviour, as before).

Tests are included and I've beefed up the RDoc around config.plugins; I've also added tests for general config.plugins behaviour, since they weren't included in #6418.

Attachments

load_plugins_in_specified_order.patch (4.2 kB) - added by lazyatom on 12/15/06 11:21:34.
Respect order of specification in config.plugins when loading plugins
load_plugins_in_specified_order_with_better_error_handling_for_config_plugins_list.patch (4.6 kB) - added by lazyatom on 12/17/06 17:28:08.
The same patch as before, except with better error handling if config.plugins includes a plugin which doesn't exist

Change History

12/15/06 11:21:34 changed by lazyatom

  • attachment load_plugins_in_specified_order.patch added.

Respect order of specification in config.plugins when loading plugins

12/15/06 23:50:54 changed by lazyatom

  • status changed from new to closed.
  • resolution set to fixed.

(In [5720]) Make config.plugins affect $LOAD_PATH and remove duplication from $LOAD_PATH [James Adam]

Correcting accidental closure of #6581 rather than #6851.

12/16/06 15:43:02 changed by lazyatom

  • cc set to michael@koziarski.com.
  • status changed from closed to reopened.
  • resolution deleted.

This was rolled back in [5721] according to discussion on Rails-Core ML, however it is not responsible for the issue described - please reapply :-)

12/17/06 17:28:08 changed by lazyatom

  • attachment load_plugins_in_specified_order_with_better_error_handling_for_config_plugins_list.patch added.

The same patch as before, except with better error handling if config.plugins includes a plugin which doesn't exist

12/18/06 20:27:06 changed by nzkoz

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [5738]) Reapply plugin load path changes from [5720]

Closes #6842 Closes #6851