[prev in list] [next in list] [prev in thread] [next in thread] 

List:       groovy-user
Subject:    Re: [groovy-user] calling a groovy script from another groovy script.
From:       Roshan Dawrani <roshandawrani () codehaus ! org>
Date:       2009-10-27 11:55:14
Message-ID: 522638960910270455y4825b795j1c4cedfff4b44aee () mail ! gmail ! com
[Download RAW message or body]

Or you can also do it like:

================Script1.groovy================
....some Script1 code....

this.evaluate(new File('....Script2.groovy'))

....some more Script1 code....
===========================================

-- Roshan

On Tue, Oct 27, 2009 at 5:15 PM, Hamlet D'Arcy <hamletdrc@gmail.com> wrote:

> You can load and execute a Groovy File by doing something like this:
>
> http://groovy.codehaus.org/api/groovy/lang/GroovyClassLoader.html
>
> Class c = new GroovyClassLoader().parseClass(new File(...))
> ((Script)c).run()
>
> --
> Hamlet D'Arcy
> hamletdrc@gmail.com
>
>
>
>
> On Mon, Oct 26, 2009 at 10:15 PM, Mauro Zallocco <mzallocco@gmail.com>
> wrote:
> > I am in the process of converting a number of dos batch files into groovy
> > scripts.
> > My approach is to create a groovy equivalent for each dos batch file
> which
> > executes with the same functionality.
> > Now the dos batch files call other batch files sometimes in other
> > directories.
> >
> > So I have something like the following:
> > file1.bat
> > echo "hello world"
> > pushd ..\..\build
> > call file2.bat
> > popd
> > echo "done"
> >
> > file1.groovy
> > println "hello world"
> > ?????
> > println "done"
> >
> > Any suggestions would be appreciated.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

[Attachment #3 (text/html)]

Or you can also do it \
like:<br><br>================Script1.groovy================<br>....some Script1 \
code....<br><br>this.evaluate(new File(&#39;....Script2.groovy&#39;))<br><br>....some \
more Script1 code....<br>===========================================<br> <br>-- \
Roshan<br><br><div class="gmail_quote">On Tue, Oct 27, 2009 at 5:15 PM, Hamlet \
D&#39;Arcy <span dir="ltr">&lt;<a \
href="mailto:hamletdrc@gmail.com">hamletdrc@gmail.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> You can load and execute a \
Groovy File by doing something like this:<br> <br>
<a href="http://groovy.codehaus.org/api/groovy/lang/GroovyClassLoader.html" \
target="_blank">http://groovy.codehaus.org/api/groovy/lang/GroovyClassLoader.html</a><br>
 <br>
Class c = new GroovyClassLoader().parseClass(new File(...))<br>
((Script)c).run()<br>
<br>
--<br>
Hamlet D&#39;Arcy<br>
<a href="mailto:hamletdrc@gmail.com">hamletdrc@gmail.com</a><br>
<br>
<br>
<br>
<br>
On Mon, Oct 26, 2009 at 10:15 PM, Mauro Zallocco &lt;<a \
href="mailto:mzallocco@gmail.com">mzallocco@gmail.com</a>&gt; wrote:<br> &gt; I am in \
the process of converting a number of dos batch files into groovy<br> &gt; \
scripts.<br> &gt; My approach is to create a groovy equivalent for each dos batch \
file which<br> &gt; executes with the same functionality.<br>
&gt; Now the dos batch files call other batch files sometimes in other<br>
&gt; directories.<br>
&gt;<br>
&gt; So I have something like the following:<br>
&gt; file1.bat<br>
&gt; echo &quot;hello world&quot;<br>
&gt; pushd ..\..\build<br>
&gt; call file2.bat<br>
&gt; popd<br>
&gt; echo &quot;done&quot;<br>
&gt;<br>
&gt; file1.groovy<br>
&gt; println &quot;hello world&quot;<br>
&gt; ?????<br>
&gt; println &quot;done&quot;<br>
&gt;<br>
&gt; Any suggestions would be appreciated.<br>
&gt;<br>
&gt;<br>
<br>
---------------------------------------------------------------------<br>
To unsubscribe from this list, please visit:<br>
<br>
    <a href="http://xircles.codehaus.org/manage_email" \
target="_blank">http://xircles.codehaus.org/manage_email</a><br> <br>
<br>
</blockquote></div><br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic