Skip to content

Support plugin to be defined as module instead of object

This makes possible for a plugin to be defined as module and have its main class defined inside it with the name Base (e.g. MyPlugin::Base).

The advantages of this is to correctly scope plugins constants inside the module. There are many conflicts with the core if the plugin is defined as klass, for example:

  • if you define a MyPlugin::DisplayHelper you'll get the error 'warning: toplevel constant DisplayHelper referenced by MyPlugin::DisplayHelper' and your class won't be loaded unless you put a "require 'my_plugin/display_helper'"
  • require is also needed for contants with the sames of constants declared under Noosfero::Plugin. For example, if you define a MyPlugin::Manager or MyPlugin::Settings, Noosfero::Plugin::Manager or Noosfero::Plugin::Settings will be returned instead of your plugin's definition.
  • other hard to debug errors may also happen.

This also encapsulates loading procedures into methods of Noosfero::Plugin.

Merge request reports