ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Allow a plugin to specify its own load order (Feature #344)


Added by Holger Just at 2011-04-18 05:42 pm. Updated at 2011-04-19 10:12 am.


Status:Open Start date:2011-04-18
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Plugin API
Target version:-
Remote issue URL: Affected version:

Description

Sometimes its desirable for a plugin to be loaded very early or very late in the plugin load order.

This is needed if a plugin e.g. modifies ApplicationController or some helpers. If prior plugins have already patched classes which are children of the mentioned classes, they won't catch up the changes as they already have loaded the class.

It probably makes sense here to have a number of callbacks (accepting blocks) which allow a plugin to run certain monkey patching actions on different stages. Thus, a patch of the ApplicationController could be run at an early stage while other patches of the plugin could be run in the normal order, thus allowing other plugins to further modify ApplicationController.

This could be done by wrappi9ng Dispatcher.to_prepare and staging the code blocks according to their priority.


Related issues

related to Bug #256: requires_redmine_plugin should defer loading plugins if n... Closed 2011-03-03

History

Updated by Eric Davis at 2011-04-18 10:44 pm

How is this different than config.plugins = [:name, :foo, :all] in a config/additional_environment.rb?

Updated by Holger Just at 2011-04-19 10:12 am

Two major points:

  1. using config.plugins, you can only change the load order of whole plugins, not parts of the plugin.
  2. Load order, which I consider dependencies, should not need to be resolved manually, which essentially is what you do when setting config.plugins. Instead, plugins should configure it themselves. Else it becomes really confusing once you have a larger number of plugins doing complex things. Users can not be expected to track load dependencies of many plugins and find a proper resolution themselves.

Also available in: Atom PDF