0

I'm wiring grails plugin. During _Install I would like to append the part of my plugin'sConfig.groovy. The block I'd like to cut and append starts with

// **** PLUGINSTART

and ends with

// **** PLUGINEND

Curently I'm using ant.copy and completely replace the Config.groovy with my plugin's Config.groovy. How to append only this part?

Archer
  • 5,073
  • 8
  • 50
  • 96
  • Can't you separate the custom config in your plugin to another config file and then copy the content of that file during _install? Also can you elaborate with a working sample. – dmahapatro Sep 25 '13 at 13:38
  • No, I can't as I need this data inside the `Config.groovy` for my integration tests. Would not like to duplicate every config item. – Archer Sep 25 '13 at 13:40
  • 1
    Have a look at [Externalized Configuration](http://grails.org/doc/latest/guide/conf.html#configExternalized), particuarly this line: "This can be useful in situations where the config is either coming from a plugin or some other part of your application. A typical use for this is re-using configuration provided by plugins across multiple applications." – dmahapatro Sep 25 '13 at 13:51
  • Man. You're the best ;) Please, post your answer as question answer and I'll select it. – Archer Sep 25 '13 at 13:54
  • 1
    Be carefull: _install gets executed every time someone runs you application not having your plugin in the cache (not only when you install it the first time!). That's why it makes sense to move such code in another script which you run only once manually.... – rdmueller Sep 26 '13 at 04:18

1 Answers1

1

Have a look at Externalized Configuration, particularly the line:

"This can be useful in situations where the config is either coming from a plugin or some other part of your application. A typical use for this is re-using configuration provided by plugins across multiple applications."

dmahapatro
  • 49,365
  • 7
  • 88
  • 117