|
Where can I find a reference documenting the various means of modifying the grails templates? For instance, I'm seeing stuff like "@artifact.package@" and "${className}", etc. in the files under src/templates/ - I'd like to see what other variables are accessible from these templates. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On Friday, May 18, 2012 03:28:15 PM eeno wrote:
> > Where can I find a reference documenting the various means of > modifying the grails templates? > > For instance, I'm seeing stuff like "@artifact.package@" and > "${className}", etc. in the files under src/templates/ - I'd > like to see what other variables are accessible from these > templates. > > For instance... What if I wanted to modify the testing/UnitTest.groovy template to something like this: @artifact.package@ import grails.test.mixin.* import grails.test.mixin.support.* import org.junit.* import static org.junit.Assert.* @TestMixin(GrailsUnitTestMixin) class @artifact.name@ { void testMyClass() { fail "Implement MyClass!" } } ... I want to replace the literal string 'MyClass', with the name of the actual class under test, so that it looked more like this: class mypackage.FooBar import grails.test.mixin.* import grails.test.mixin.support.* import org.junit.* import static org.junit.Assert.* @TestMixin(GrailsUnitTestMixin) class FooBar { void testFooBar() { fail "Implement FooBar!" } } --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On Monday, May 21, 2012 11:23:38 AM eeno wrote:
> On Friday, May 18, 2012 03:28:15 PM eeno wrote: > > > > Where can I find a reference documenting the various means of > > modifying the grails templates? > > > > For instance, I'm seeing stuff like "@artifact.package@" and > > "${className}", etc. in the files under src/templates/ - I'd > > like to see what other variables are accessible from these > > templates. > > > > > > > For instance... What if I wanted to modify the testing/UnitTest.groovy > template to something like this: > > @artifact.package@ > import grails.test.mixin.* > import grails.test.mixin.support.* > import org.junit.* > import static org.junit.Assert.* > > > @TestMixin(GrailsUnitTestMixin) > class @artifact.name@ { > > void testMyClass() { > > fail "Implement MyClass!" > } > } > > ... I want to replace the literal string 'MyClass', with the name > of the actual class under test, so that it looked more like this: > > > class mypackage.FooBar > > import grails.test.mixin.* > import grails.test.mixin.support.* > import org.junit.* > import static org.junit.Assert.* > > > @TestMixin(GrailsUnitTestMixin) > class FooBar { > > void testFooBar() { > > fail "Implement FooBar!" > } > } > I just want to know where I can find what all variables are available from within artifact and scaffolding templates. Any clue would be welcome, and appreciated - I'm sorry if I've missed anything obvious in the docs. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On Wednesday, May 23, 2012 08:25:33 AM eeno wrote:
> On Monday, May 21, 2012 11:23:38 AM eeno wrote: > > On Friday, May 18, 2012 03:28:15 PM eeno wrote: > I just want to know where I can find what all variables are available > from within artifact and scaffolding templates. > > Any clue would be welcome, and appreciated - I'm sorry if I've missed > anything obvious in the docs. > Totally Warnocked. https://en.wikipedia.org/wiki/Warnock%27s_Dilemma --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by eeno
On 18/05/2012 23:28, eeno wrote:
> > Where can I find a reference documenting the various means of > modifying the grails templates? > > For instance, I'm seeing stuff like "@artifact.package@" and > "${className}", etc. in the files under src/templates/ - I'd > like to see what other variables are accessible from these > templates. I'm not sure there is documentation as such, like so many things in Grails the only definitive answer is in the source code. These particular cases appear to be hard-coded in scripts/_GrailsCreateArtifacts.groovy. Ian -- Ian Roberts | Department of Computer Science [hidden email] | University of Sheffield, UK --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On Friday, May 25, 2012 04:55:57 PM Ian Roberts wrote:
> On 18/05/2012 23:28, eeno wrote: > > > > Where can I find a reference documenting the various means of > > modifying the grails templates? > > > > For instance, I'm seeing stuff like "@artifact.package@" and > > "${className}", etc. in the files under src/templates/ - I'd > > like to see what other variables are accessible from these > > templates. > > I'm not sure there is documentation as such, like so many things in > Grails the only definitive answer is in the source code. These > particular cases appear to be hard-coded in > scripts/_GrailsCreateArtifacts.groovy. > Excellent, many thanks! You are a gentleman, and a scholar! (c8= ... and indeed I was able to confirm that there are just 4 different variables available which can all be found with within the ...templates//testing/* files anyhow: @artifact.name@ @artifact.package@ @artifact.superclass@ @artifact.testclass@ ( alas I was hoping to have easy access to the name of the class under test without the 'Tests' suffix ) Cheers --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On 25/05/2012 17:09, eeno wrote:
> ( alas I was hoping to have easy access to the name of the class under > test without the 'Tests' suffix ) The events mechanism may come to your rescue here, as createArtifact fires an event that provides that class name as a parameter, so it looks like you could define in your _Events.groovy: eventCreatedArtefact = { file, className -> ant.replace(file:file, token:'@artifact.classUnderTest@', value:className) } (yes, it is eventCreatedArtefact, the script doesn't agree with itself as to whether it should be "ifact" or "efact" and uses both in different contexts...) Ian -- Ian Roberts | Department of Computer Science [hidden email] | University of Sheffield, UK --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On Friday, May 25, 2012 05:26:50 PM Ian Roberts wrote:
> On 25/05/2012 17:09, eeno wrote: > > ( alas I was hoping to have easy access to the name of the class under > > test without the 'Tests' suffix ) > > The events mechanism may come to your rescue here, as createArtifact > fires an event that provides that class name as a parameter, so it looks > like you could define in your _Events.groovy: > > eventCreatedArtefact = { file, className -> > ant.replace(file:file, token:'@artifact.classUnderTest@', value:className) > } > Killer - works like a champ... > (yes, it is eventCreatedArtefact, the script doesn't agree with itself > as to whether it should be "ifact" or "efact" and uses both in different > contexts...) > Fun! <grin> Thanks again for the assist - much appreciated! Beers --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
