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.

requires_redmine_plugin should defer loading plugins if not all dependencies are met (Bug #256)


Added by Holger Just at 2011-03-03 03:57 pm. Updated at 2011-08-25 04:47 pm.


Status:Closed Start date:2011-03-03
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Plugin API
Target version:2.2.0
Remote issue URL:http://www.redmine.org/issues/6324 Affected version:master

Description

requires_redmine_plugin is a nice facility to track inter-plugin dependencies, however, it is useless if I do not want (or cannot) rename plugins I depend on.

I propose that plugins are deferred and loaded at a later time, if possible.
See attached patch for a proposed solution.

The patch and this issue is copied from http://www.redmine.org/issues/6324. The patch was developed by Tim Felgentreff.


0001-Add-a-Redmine-plugin-locator-to-be-able-to-query-the.patch (4.8 kB) Holger Just, 2011-03-03 03:58 pm


Related issues

related to Feature #344: Allow a plugin to specify its own load order Open 2011-04-18
related to Feature #275: Implement requires_chiliproject and requires_chiliproject... Closed 2011-03-13

Associated revisions

Revision a24a24eb
Added by Felix Schäfer at 2011-08-25 06:46 pm

Add deferred loading for plugins which's requirements aren't all met yet #256

History

Updated by Holger Just at 2011-03-03 03:58 pm

  • File 0001-Add-a-Redmine-plugin-locator-to-be-able-to-query-the.patch added

Updated by Felix Schäfer at 2011-03-05 12:00 pm

As I don't have much knowledge of those parts of rails it's OK with me if it's Tim and Holger approved. Is it used in production yet at Finnlabs?

Updated by Tim Felgentreff at 2011-03-05 06:52 pm

Felix Schäfer wrote:

As I don't have much knowledge of those parts of rails it's OK with me if it's Tim and Holger approved. Is it used in production yet at Finnlabs?

We have been deploying with this patch for some time (we also use acts_as_journalized internally, this patch was written at the same time, iirc)

Updated by Eric Davis at 2011-03-06 02:28 am

Tim:

I can test this out with my redmine_contracts plugin. It requires two other plugins to be loaded first but in the standard A-Z loading they are loaded last.

One question: so if a plugin can't find a dependency, it gets added to @deferred_plugins as long as Rails sees that it's dependency will be loaded later (has_plugin?). Than as each plugin is loaded, all of the @deferred_plugins are loaded again to see if their dependencies are now met. Is that right?

Updated by Tim Felgentreff at 2011-03-06 08:39 am

Eric Davis wrote:

One question: so if a plugin can't find a dependency, it gets added to @deferred_plugins as long as Rails sees that it's dependency will be loaded later (has_plugin?). Than as each plugin is loaded, all of the @deferred_plugins are loaded again to see if their dependencies are now met. Is that right?

Yes, that's right. So with your redmine_contracts plugin, it will fail to load and add it to @deferred_plugins[:redmine_overhead]. Once redmine_overhead is loaded, it'll try loading redmine_contracts, again, and fail, because redmine_rate hasn't been loaded. So it is added to @deferred_plugins[:redmine_rate] and will be finally loaded after redmine_rate has loaded.

Updated by Eric Davis at 2011-03-07 11:15 pm

Thanks Tim. It also looks like it handles cyclic requirements, which would be other other concern.

I'll review it and do some testing.

  • Assignee set to Eric Davis

Updated by Felix Schäfer at 2011-08-21 04:31 pm

Scheduling this for 2.2.0, this shouldn't break anything and make things easier on plugins that depend on a specific load order. The current status is at pull request 99

@Tim: Could you have a quick look at the pull request and confirm it? Thanks.

  • Target version set to 2.2.0
  • Assignee changed from Eric Davis to Felix Schäfer
  • (deleted custom field) set to master

Updated by Holger Just at 2011-08-21 04:32 pm

@Felix: When committing, could you please squash the commits?

Updated by Tim Felgentreff at 2011-08-21 11:21 pm

Felix Schäfer wrote:

@Tim: Could you have a quick look at the pull request and confirm it? Thanks.

Affirmative :) Will be good to see this finally merged

Updated by Felix Schäfer at 2011-08-22 10:03 am

Eric Davis wrote:

It also looks like it handles cyclic requirements, which would be other other concern.

I tested this and found out that though it won't die/hang on cyclic requirements, it silently fails to load all the plugins in the cycle. I added detection and an error for cyclic dependencies in a80e846, it would be great if anyone could review that part so that I can finally merge it.

For anyone wanting the whole picture, pull request 99 still has it.

Updated by Felix Schäfer at 2011-08-22 10:03 am

  • Assignee deleted (Felix Schäfer)

Updated by Felix Schäfer at 2011-08-25 04:47 pm

Merged in a24a24e, thanks Tim.

  • Status changed from Ready for review to Closed

Also available in: Atom PDF