requires_redmine_plugin should defer loading plugins if not all dependencies are met
|Assignee:||Jean-Baptiste Barth||% Done:|
|Target version:||Candidate for next major release|
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.
#3 Updated by Tim Felgentreff almost 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.
#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
- File 6324_defer_plugin_requirements_evaluation.patch added
- Category set to Plugin API
- Assignee set to Jean-Baptiste Barth
- Target version changed from Unplanned to Candidate for next major release
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.
#12 Updated by Michael Krupp 11 months 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