Defect #6324

requires_redmine_plugin should defer loading plugins if not all dependencies are met

Added by Tim Felgentreff about 7 years ago. Updated about 1 year ago.

Status:NewStart date:2010-09-07
Priority:NormalDue date:
Assignee:Jean-Baptiste Barth% Done:

0%

Category:Plugin API
Target version:Candidate for next major release
Resolution: Affected version:

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.

0001-implement-redmine-plugin-loader.patch Magnifier (3.92 KB) Tim Felgentreff, 2010-09-07 22:01

0001-implement-redmine-plugin-loader.patch Magnifier (3.88 KB) Tim Felgentreff, 2010-09-08 01:14

0001-implement-redmine-plugin-loader.patch Magnifier (3.88 KB) Tim Felgentreff, 2010-09-08 11:29

0001-Add-a-Redmine-plugin-locator-to-be-able-to-query-the.patch Magnifier (4.77 KB) Tim Felgentreff, 2010-09-08 11:54

6324_defer_plugin_requirements_evaluation.patch Magnifier (6.97 KB) Jean-Baptiste Barth, 2014-08-14 13:06

init.rb Magnifier - 000_pluginloader (1.39 KB) Michael Krupp, 2016-02-03 18:35

init.rb Magnifier - zzz_pluginloader (160 Bytes) Michael Krupp, 2016-02-03 18:35


Related issues

Related to Redmine - Feature #5638: Use Bundler (Gemfile) for gem management Closed 2010-06-02
Duplicated by Redmine - Feature #23131: Plugin load order defined by inter-plugin dependencies Reopened

History

#1 Updated by Tim Felgentreff about 7 years ago

Remove debugger code

#2 Updated by Tim Felgentreff about 7 years ago

Also, for some reason, the patch I posted doesn't apply with git am. So if you use that, here's one that does. (No code changes)

#3 Updated by Tim Felgentreff about 7 years ago

Just found a bug with my patch where the asset directory wasn't set properly. Changed it to not replace the rails plugin locator, but use Redmine's in addition to the default one. This probably nicer, anyway, in case people want to add locators themselves. In the new implementation, the Redmine plugin locator doesn't load anything, but is only for querying the Rails plugin search path.

#4 Updated by Eric Davis almost 7 years ago

  • Target version set to Unplanned

#5 Updated by Eric Davis almost 7 years ago

  • Assignee deleted (Eric Davis)

I am stepping down from working on Redmine. If someone else is interesting in working on this issue, feel free to reassign it to them.

Eric Davis

#7 Updated by Massimo Rossello over 3 years ago

For anyone not willing to patch the core, not requiring an end user to manage his environment.rb, I found the following workaround to be prepended on the dependent plugin's init.rb:

dep = File.join(Rails.root,'plugins','<plugin name>')
ActiveSupport::Dependencies.autoload_paths += [File.join(dep, 'lib')]
require_dependency File.join(dep, 'init')

#8 Updated by Jean-Baptiste Barth about 3 years ago

Sorry to be late at the party, but I'd like this issue solved as it bothers me from time to time.

I find Tim's proposed implementation a bit complex (and the one integrated in chiliproject is even more complex) where all we'd have to do is defer the requirement check until the end of Redmine::Plugin.load method. Sure it's not as evolved but I think it should be enough.

Here's a proposed patch, I'd like to hear some opinions before committing it, and if you see obvious advantages to Tim's/Chiliproject's approach, let me know.

#9 Updated by Vincent Robert about 3 years ago

It seems to be the simplest fix, straight-forward and easy to understand.
The other implementations, much more complex, are error-prone processes in my opinion.

#10 Updated by Michael Krupp over 1 year ago

As this issue seems to make no real progress in any direction, I implemented Jean-Baptiste's Patch as a plugin.
Just save them as plugins/000_pluginloader/init.rb and plugins/zzz_pluginloader/init.rb. done.

#11 Updated by Mischa The Evil over 1 year ago

  • Duplicated by Feature #23131: Plugin load order defined by inter-plugin dependencies added

#12 Updated by Michael Krupp about 1 year ago

Just a quick update: I merged the two plugin-files into one standalone plugin by abusing the mirror_assets method call in the redmine initializer. This plugin does not change the load order of plugins - it only defers the dependency check, as suggested in #6324-8

https://github.com/michaelkrupp/redmine_pluginloader

Also available in: Atom PDF