Quantcast

custom modification of a plugin, what's the best approach?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

custom modification of a plugin, what's the best approach?

Henning Verbeek
Dear community,

I would like to find out what is the best approach to dealing with the custom modification of a grails plugin.

In my case, I'm using the i18n-gettext plugin, but want to avoid usage of java.text.MessageFormat.format(), since it deals so badly with apostrophes (MessageFormat that is, not the plugin). So I have changed a class in the plugin with ~15 lines of code, and everything works as expected. To do so, I modified a file deep in ~/.grails/1.3.7/projects/MyProject/plugins/i18n-gettext-0.98/...

Obviously I can offer my patch to the original creator (and maybe have to, for license reasons, no idea). However, I think most people wouldn't want my patch, they're happy with MessageFormat.

I was surprised to find that `grails clean && grails run-app` kept my changes in place, but wiping ~/.grails/1.3.7/projects/MyProject obviously wouldn't. So how do I keep my changes permanent? Is it possible to override a plugin's class (with code from my own project)? Or should I fork the original plugin and maintain that locally? 

Thanks heaps!
Cheers,
Hank

--
My other signature is a regular expression.
http://www.pray4snow.de
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: custom modification of a plugin, what's the best approach?

ld@ldaley.com

On 21/09/2011, at 1:06 PM, Henning Verbeek wrote:

I would like to find out what is the best approach to dealing with the custom modification of a grails plugin.

In my case, I'm using the i18n-gettext plugin, but want to avoid usage of java.text.MessageFormat.format(), since it deals so badly with apostrophes (MessageFormat that is, not the plugin). So I have changed a class in the plugin with ~15 lines of code, and everything works as expected. To do so, I modified a file deep in ~/.grails/1.3.7/projects/MyProject/plugins/i18n-gettext-0.98/...

Obviously I can offer my patch to the original creator (and maybe have to, for license reasons, no idea). However, I think most people wouldn't want my patch, they're happy with MessageFormat.

I was surprised to find that `grails clean && grails run-app` kept my changes in place, but wiping ~/.grails/1.3.7/projects/MyProject obviously wouldn't. So how do I keep my changes permanent? Is it possible to override a plugin's class (with code from my own project)? Or should I fork the original plugin and maintain that locally? 

You should try as hard as possible to get your change incorporated into the plugin, if you've hit the problem others may too.

Even if by default it uses MessageFormat, and you add the ability to use something else via a config setting or similar that would be the best outcome.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: custom modification of a plugin, what's the best approach?

Henning Verbeek
Thanks for the advice. I will try to do that.

What would you suggest, if the owner of the plugin does not want to include my patch?

On Wed, Sep 21, 2011 at 2:11 PM, Luke Daley <[hidden email]> wrote:

On 21/09/2011, at 1:06 PM, Henning Verbeek wrote:

I would like to find out what is the best approach to dealing with the custom modification of a grails plugin.

In my case, I'm using the i18n-gettext plugin, but want to avoid usage of java.text.MessageFormat.format(), since it deals so badly with apostrophes (MessageFormat that is, not the plugin). So I have changed a class in the plugin with ~15 lines of code, and everything works as expected. To do so, I modified a file deep in ~/.grails/1.3.7/projects/MyProject/plugins/i18n-gettext-0.98/...

Obviously I can offer my patch to the original creator (and maybe have to, for license reasons, no idea). However, I think most people wouldn't want my patch, they're happy with MessageFormat.

I was surprised to find that `grails clean && grails run-app` kept my changes in place, but wiping ~/.grails/1.3.7/projects/MyProject obviously wouldn't. So how do I keep my changes permanent? Is it possible to override a plugin's class (with code from my own project)? Or should I fork the original plugin and maintain that locally? 

You should try as hard as possible to get your change incorporated into the plugin, if you've hit the problem others may too.

Even if by default it uses MessageFormat, and you add the ability to use something else via a config setting or similar that would be the best outcome.






--
My other signature is a regular expression.
http://www.pray4snow.de
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: custom modification of a plugin, what's the best approach?

ld@ldaley.com

On 21/09/2011, at 1:19 PM, Henning Verbeek wrote:

Thanks for the advice. I will try to do that.

What would you suggest, if the owner of the plugin does not want to include my patch?

Take the query to the dev list, and we can consider it. It sounds to me like something that should be there so I doubt we are going to be in the situation where no one agrees with you.

If that fails, I'm not sure. There are no bulletproof approaches besides forking the plugin and maintaining your own copy. It would be much better to make the enhancement available to everyone though.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: custom modification of a plugin, what's the best approach?

Henning Verbeek
thanks again.

On Thu, Sep 22, 2011 at 4:11 PM, Luke Daley <[hidden email]> wrote:

On 21/09/2011, at 1:19 PM, Henning Verbeek wrote:

Thanks for the advice. I will try to do that.

What would you suggest, if the owner of the plugin does not want to include my patch?

Take the query to the dev list, and we can consider it. It sounds to me like something that should be there so I doubt we are going to be in the situation where no one agrees with you.

If that fails, I'm not sure. There are no bulletproof approaches besides forking the plugin and maintaining your own copy. It would be much better to make the enhancement available to everyone though.



--
My other signature is a regular expression.
http://www.pray4snow.de
Loading...