Quantcast

Reuse grails scripts

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

Reuse grails scripts

Diogo Outerelo da Silva
Hi,
  Iam using a Gant script to make a customized classes making, but i tried to reuse the grails script like the CreateService, CreateDomainClass and CreateController. Do someone know how to reuse this scripts? 
  I tried to use GrailsScriptRunner.main(), but i can only execute one time, but i need to execute like 5 times de scripts.


--
Thx,
Diogo

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

Re: Reuse grails scripts

Matthias Hryniszak
Reusing of anything in Grails is commonly done with plugins. You might want to familiarize yourself with creation of plugins in the first place (due to the sole nature of Grails) but especially with plugins being used like this:

grails.plugin.location.'plugin-name' = '../plugin-location-goes-here'

That allows you to split pretty much everything into pieces (scripts not withstanding). The relevant documentation piece is


and also here



HTH

Matthias.

2012/2/15 Diogo Outerelo da Silva <[hidden email]>
Hi,
  Iam using a Gant script to make a customized classes making, but i tried to reuse the grails script like the CreateService, CreateDomainClass and CreateController. Do someone know how to reuse this scripts? 
  I tried to use GrailsScriptRunner.main(), but i can only execute one time, but i need to execute like 5 times de scripts.


--
Thx,
Diogo

--

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

Re: Reuse grails scripts

Diogo Outerelo da Silva
I dont know if its really necessary. i just need to make my make some services, controllers and domains in the same gant. the problem is that the create-service, create-controller, etc, use contants like "grails-app/service" and i want to reuse this. if i "includeScript" the script, i cant call this, because the script just has the target default, not like the _<scripts> that is made to be reuseds.
 

On Wed, Feb 15, 2012 at 7:46 PM, Matthias Hryniszak <[hidden email]> wrote:
Reusing of anything in Grails is commonly done with plugins. You might want to familiarize yourself with creation of plugins in the first place (due to the sole nature of Grails) but especially with plugins being used like this:

grails.plugin.location.'plugin-name' = '../plugin-location-goes-here'

That allows you to split pretty much everything into pieces (scripts not withstanding). The relevant documentation piece is


and also here



HTH

Matthias.


2012/2/15 Diogo Outerelo da Silva <[hidden email]>
Hi,
  Iam using a Gant script to make a customized classes making, but i tried to reuse the grails script like the CreateService, CreateDomainClass and CreateController. Do someone know how to reuse this scripts? 
  I tried to use GrailsScriptRunner.main(), but i can only execute one time, but i need to execute like 5 times de scripts.


--
Thx,
Diogo

--




--
Atc,
Diogo

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

Re: Reuse grails scripts

Matthias Hryniszak
OK - I misunderstood your intention. 

Could you prepare a stripped-down version of your script? That'd greatly help me wrap my head around your issue...

Matthias

"

2012/2/15 Diogo Outerelo da Silva <[hidden email]>
I dont know if its really necessary. i just need to make my make some services, controllers and domains in the same gant. the problem is that the create-service, create-controller, etc, use contants like "grails-app/service" and i want to reuse this. if i "includeScript" the script, i cant call this, because the script just has the target default, not like the _<scripts> that is made to be reuseds.
 

On Wed, Feb 15, 2012 at 7:46 PM, Matthias Hryniszak <[hidden email]> wrote:
Reusing of anything in Grails is commonly done with plugins. You might want to familiarize yourself with creation of plugins in the first place (due to the sole nature of Grails) but especially with plugins being used like this:

grails.plugin.location.'plugin-name' = '../plugin-location-goes-here'

That allows you to split pretty much everything into pieces (scripts not withstanding). The relevant documentation piece is


and also here



HTH

Matthias.


2012/2/15 Diogo Outerelo da Silva <[hidden email]>
Hi,
  Iam using a Gant script to make a customized classes making, but i tried to reuse the grails script like the CreateService, CreateDomainClass and CreateController. Do someone know how to reuse this scripts? 
  I tried to use GrailsScriptRunner.main(), but i can only execute one time, but i need to execute like 5 times de scripts.


--
Thx,
Diogo

--




--
Atc,
Diogo

--

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

Re: Reuse grails scripts

Diogo Outerelo da Silva

I want something like that:

includeTargets << grailsScript("CreateService")
target (main,"test") {
   String file1 = "test.test.test"
   String file2 = "test2.test2.test2"

   <createServiceDefaultTarget>(file1)
   <createServiceDefaultTarget>(file2)
}
setDefaultTarget(main)

but i cant make this work, so i made that


includeTargets << grailsScript("CreateService")
target (main,"test") {

   String file1 = "test.test.test"
   String file2 = "test2.test2.test2"

   GrailsScriptRunner.main("create-service ${file1}")
   GrailsScriptRunner.main("create-service ${file2}")
}
setDefaultTarget(main)

and this only execute the first create-service... i tried to make the instance to use the executeCommand method, but didnt work. Also i tried to put it in a thread, but i think that is not the way...
I think that the executeCommand maybe work, but i tried without sucess to make work.

thx,
Diogo

On Wed, Feb 15, 2012 at 8:14 PM, Matthias Hryniszak <[hidden email]> wrote:
OK - I misunderstood your intention. 

Could you prepare a stripped-down version of your script? That'd greatly help me wrap my head around your issue...

Matthias


"

2012/2/15 Diogo Outerelo da Silva <[hidden email]>
I dont know if its really necessary. i just need to make my make some services, controllers and domains in the same gant. the problem is that the create-service, create-controller, etc, use contants like "grails-app/service" and i want to reuse this. if i "includeScript" the script, i cant call this, because the script just has the target default, not like the _<scripts> that is made to be reuseds.
 

On Wed, Feb 15, 2012 at 7:46 PM, Matthias Hryniszak <[hidden email]> wrote:
Reusing of anything in Grails is commonly done with plugins. You might want to familiarize yourself with creation of plugins in the first place (due to the sole nature of Grails) but especially with plugins being used like this:

grails.plugin.location.'plugin-name' = '../plugin-location-goes-here'

That allows you to split pretty much everything into pieces (scripts not withstanding). The relevant documentation piece is


and also here



HTH

Matthias.


2012/2/15 Diogo Outerelo da Silva <[hidden email]>
Hi,
  Iam using a Gant script to make a customized classes making, but i tried to reuse the grails script like the CreateService, CreateDomainClass and CreateController. Do someone know how to reuse this scripts? 
  I tried to use GrailsScriptRunner.main(), but i can only execute one time, but i need to execute like 5 times de scripts.


--
Thx,
Diogo

--




--
Atc,
Diogo

--




Loading...