Feature #783

Real Plugin-System

Added by Martin Herr over 9 years ago. Updated over 2 years ago.

Status:ClosedStart date:2008-03-04
Priority:HighDue date:
Assignee:-% Done:

100%

Category:-
Target version:0.8
Resolution:

Description

I think it would be extremely useful to have a "real plugin-system" integrated into redmine core. Based on this, it should be possible to modify routing,controllers,models,views,helpers and even core functions.

At the moment it's hard to build extensions without patching the core and even the engines-plugin is just an unstable workaround for me :(

I'm one of the developers of forge.typo3.org and would like to contribute my redmine modifications - but I can't do this by contributing hundreds of patches. There should be a clean way for everyone to extend redmine by developing plugins.

Maybe it makes sense to look at the mephisto guys and how they implemented their plugin-system:
http://mephistoblog.com/
http://jamescrisp.blogspot.com/2007/04/tips-for-developing-mephisto-plugins.html

Any other ideas?


Related issues

Related to Redmine - Feature #1143: Hooks for plugins Closed 2008-04-29
Related to Redmine - Patch #1677: Plugin hook API Closed 2008-07-24

History

#1 Updated by Eric Davis over 9 years ago

Actually Mephisto is in the process of throwing their plugin system away and using Engines instead. You should be able to create a Redmine or Rails plugin to override anything in Redmine without changing the core.

#2 Updated by Martin Herr over 9 years ago

Hey Eric,

I really tried to overload existing redmine-views and -controllers with engines for several days - but couldn't get it to work.. :(

Will try it again :)

@Jean-Philippe: Would it be possible that I could get write access to http://www.redmine.org/wiki/redmine/Plugins that I can add some documentation about my experiences writing redmine plugins?

#3 Updated by Rocco Stanzione over 9 years ago

+1. As the Engines docs say, you can't really clobber models with a plugin - you'd have to copy the whole existing model into the plugin, which kind of defeats the purpose. I was able to get it to work for one page load with some evil hackery, but at the end Rails insists on loading the original plugin.

#4 Updated by Brian Palmer over 9 years ago

-1.

I have to disagree. I'm working on a Redmine plugin and the engines system has worked very well, I think a "real" plugin system would require a huge amount of effort to even reach the same level. Models can be a problem, true, but it's not difficult to inject code into existing models in the plugin initialization code. I added a new has_many association to projects in this way. Some problems can occur in development mode because of reloading, but they can be worked around.

#5 Updated by Jean-Philippe Lang over 9 years ago

@Martin: you should be able to edit the wiki now.

#6 Updated by Chaoqun Zou over 9 years ago

Hi, Brian.
Could you tell us how to do this? "I added a new has_many association to projects in this way."
Thanks.

#7 Updated by Eric Davis over 9 years ago

chaoqun zou wrote:

Hi, Brian.
Could you tell us how to do this? "I added a new has_many association to projects in this way."

This code is working great for me. As you can see in the ClassMethods and InstanceMethods modules, you can easily add or override methods in the Redmine core.

# init.rb
require_dependency 'issue_patch'
# issue_patch.rb
require_dependency 'issue'

module IssuePatch
  def self.included(base) # :nodoc:
    base.extend(ClassMethods)

    base.send(:include, InstanceMethods)

    # Same as typing in the class 
    base.class_eval do
      belongs_to :my_plugin_class
    end

  end

  module ClassMethods   
    # Methods to add to the Issue class
  end

  module InstanceMethods
    # Methods to add to specific issue objects
  end
end

# Add module to Issue
Issue.send(:include, IssuePatch)

#8 Updated by Eric Davis about 9 years ago

  • Status changed from New to Closed
  • Assignee deleted (Jean-Philippe Lang)
  • Target version set to 0.8
  • % Done changed from 0 to 100

I'm going to close this issue. #1677 added some plugin hooks so plugins can start to add in their own HTML or controller logic. r1723 lets any plugin override a view by creating the same named view file.

If any more hooks are needed; open a issue describing where you would like it, what data you would like, and assign it to me.

Thanks.

#9 Updated by Thiyagarajan Thulasi over 2 years ago

Hi,
In my redmine application i added some plugins while overriding a same patch in different plugin but it take priority with the top level i unable to run my bottom plugin patch.

For Example:

Plugin 'A'   Am writing patch for issues controller and issue before_save callBack
plugin 'B' Am overriding same issue controller patch and model before_save callBack

The above scenario Plugin 'A' patch's only running plugin 'B' code does't run

Any one have any solution for this?

#10 Updated by Toshi MARUYAMA over 2 years ago

Thiyagarajan Thulasi wrote:

(snip)

FTR: #19019.

Also available in: Atom PDF