ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <sflo...@nc.rr.com>
Subject Re: help to find not replaced variables
Date Wed, 22 Jul 2009 19:19:16 GMT

I know, I know I always say "script it" :)

Anyway, you can definitely use beanshell to do this - meaning look far an 
occurence in all your files...  But not sure you can include the beanshell 
jars in your environment?

Or perhaps, write a Java class and call it from you Ant script - be about 
the same code as that of scripting w/ beanshell...

Either way you can use Java regular expressions...

Of course, there may be a way to do this with resource collections - 
http://ant.apache.org/manual/CoreTypes/resources.html#tokens

I don't have time at the moment to investigate further...


On Wed, 22 Jul 2009, Júlio Cesar Bueno Cotta wrote:

> I can't use cygwin*
>
> 2009/7/22 Júlio Cesar Bueno Cotta <juliocbcotta@gmail.com>
>
>> I can use cygwin..is not just in my PC..that will be used in all the
>> company. My boss never will let me install cygwin in all the machines. :P
>>
>>
>> 2009/7/22 Avlesh Singh <avlesh@gmail.com>
>>
>>> Cygwin (http://www.cygwin.com/) will make your windows machine "powerful"
>>> :)
>>>
>>>
>>> Cheers
>>> Avlesh
>>>
>>> 2009/7/23 Júlio Cesar Bueno Cotta <juliocbcotta@gmail.com>
>>>
>>>> Thanks for the awnser, but it need to run in windows machines too.
>>>> I wll take a look in your tip.
>>>>
>>>> 2009/7/22 Avlesh Singh <avlesh@gmail.com>
>>>>
>>>>> You basically need to find (or grep) all occurrences of @(.*)@ in your
>>>>> files, once the replace task was performed. Right?
>>>>> If yes, I can think of two solutions:
>>>>>
>>>>>   1. Use a Antelope's grep task.
>>>>>   http://antelope.tigris.org/nonav/docs/manual/bk03ch22.html
>>>>>   2. Call an exec task (
>>> http://ant.apache.org/manual/CoreTasks/exec.html
>>>> )
>>>>>   once your replace task is done. Within the exec "grep" for files to
>>>> find
>>>>> out
>>>>>   the ones which data matching the @(.*)@ pattern. Here's a sample
>>> code
>>>>>
>>>>> <target name="findNonReplacedTokens">
>>>>>>   <exec executable="grep" output="not-replaced.txt">
>>>>>>    <arg line="-r @(.*)@ /path/to/your/directory/."/>
>>>>>>  </exec>
>>>>>> </target>
>>>>>>
>>>>>
>>>>> Your "not-replaced.txt" file (created after calling this task) will
>>> have
>>>>> all
>>>>> the files and their corresponding lines in which such tokens were not
>>>>> replaced. You can additionally run a "uniq" command on this file, to
>>> find
>>>>> out what distinct patterns really needed to be defined as properties
>>> in
>>>>> your
>>>>> build property file.
>>>>>
>>>>> I have assumed that you can execute the grep command on your system.
>>>>> Hope this helps.
>>>>>
>>>>> Cheers
>>>>> Avlesh
>>>>>
>>>>> 2009/7/22 Júlio Cesar Bueno Cotta <juliocbcotta@gmail.com>
>>>>>
>>>>>> I alread have a ant script to replace the variables..and it is
>>> working.
>>>>>> What I need is check if all the variables are beeing replaced.
>>>>>> I have a dev.properties where I have lines like this
>>>>>> @vari@=test
>>>>>>
>>>>>> each @vari@ is replaced to "test" after I run the script.
>>>>>>
>>>>>> But
>>>>>> If I forget to add the variable in the dev.properties , that
>>> variable
>>>>> wont
>>>>>> be replaced.
>>>>>> I want to search all the varibles not replaced.
>>>>>> Thanks.
>>>>>>
>>>>>> 2009/7/22 David Weintraub <qazwart@gmail.com>
>>>>>>
>>>>>>> You can do this with the <copy> task via the <filter>:
>>>>>>>
>>>>>>> A good example is given on this page:
>>>>>>>
>>>>>>> <http://ant.apache.org/manual/CoreTasks/copy.html>
>>>>>>>
>>>>>>> Look for the text "*Copy a set of files to a directory, replacing
>>>>>>> @TITLE@with Foo Bar in all files."
>>>>>>>
>>>>>>> *You can also look here: http://ant.apache.org/manual/index.htmlat
>>>>> the
>>>>>>> <filter> task.
>>>>>>>
>>>>>>> And, take a look over here too:
>>>>>>>
>>>>>>> <http://ant.apache.org/manual/CoreTypes/filterset.html>
>>>>>>>
>>>>>>> This one shows the concept of a "filterset" and how it works
with
>>> the
>>>>>>> <copy>
>>>>>>> task. It also has some excellent examples.
>>>>>>>
>>>>>>> 2009/7/22 Júlio Cesar Bueno Cotta <juliocbcotta@gmail.com>
>>>>>>>
>>>>>>>> Hello there,
>>>>>>>> I am new over here and I need some help.
>>>>>>>> There is a script that replace variables in the files.
>>>>>>>> And I am trying to write a ant script to find in the replaced
>>> files
>>>> (
>>>>>>> into
>>>>>>>> a
>>>>>>>> folder like workspace/web-inf/ ) variables witch were not
>>>> replaced..
>>>>>>>> Someone can help me?
>>>>>>>> Is there some task to do that?
>>>>>>>>
>>>>>>>> I am sorry if I am not clear..my English is not pretty good.
>>>>>>>> Thanks all.
>>>>>>>>
>>>>>>>> --
>>>>>>>>  Júlio Cesar Bueno Cotta
>>>>>>>> Graduando em ciência da computação
>>>>>>>>   Universidade Federal de Viçosa
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> David Weintraub
>>>>>>> qazwart@gmail.com
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>  Júlio Cesar Bueno Cotta
>>>>>> Graduando em ciência da computação
>>>>>>   Universidade Federal de Viçosa
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>   Júlio Cesar Bueno Cotta
>>>> Graduando em ciência da computação
>>>>   Universidade Federal de Viçosa
>>>>
>>>
>>
>>
>>
>> --
>>   Júlio Cesar Bueno Cotta
>> Graduando em ciência da computação
>>    Universidade Federal de Viçosa
>>
>>
>
>
> --
>  Júlio Cesar Bueno Cotta
> Graduando em ciência da computação
>   Universidade Federal de Viçosa
>

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

Mime
View raw message