forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject Re: Exception to "forrest clean"
Date Sun, 21 Jan 2007 19:12:42 GMT
On Fri, 2007-01-19 at 16:23 -0500, Li, Don wrote:
> I’m wondering if cocoon or ant supports a command like “keep”, to keep
> a directory and its associated files created by another app during
> “forrest clean” process.
> 

Out of the box no. Well let´s say yes it is because if we analyze the
result of the command it should do NOTHING as I understand it.

If you want to develop such a task it should not be hard. You just need
to specify better what should be deleted.

>  
> 
> <!-- Please note, I’m using the “clean” subset command, “clean-site”
> for demo and clarity sake  -->
> 
> <!--  as is -->
> 
> <target name="clean-site" depends="init-props"
> 
>       description="* Clean the project generated documents directory">
> 
>     <delete failonerror="false" dir="${project.site-dir}"/>
> 
>     <delete failonerror="false" file="${project.brokenlinkfile}"/>
> 
>  </target>
> 
>  
> 
> <!--  to be or desirable state --> 
> 
> <target name="clean-site" depends="init-props"
> 
>       description="* Clean the project generated documents directory">
> 
>     <delete failonerror="false" dir="${project.site-dir}"/>

Here you need to specify which dirs you want to delete. The delete
command will act the following way. Imaging you have the "normal"
FORREST build structure. 

I assume ${project.site-dir} is equivalent to build/site. Then you
should not use this root if you have files/dirs in there that you want
to keep.

> 
>     <delete failonerror="false" file="${project.brokenlinkfile}"/>
> 
>    <!-- NEW -- >  
> 
>     <keep failonerror="false" dir="${project.site-keep-dir}"/>
> 

Assuming the "keep" dir is a dir under build/site that cannot work
because you already have delete it in the step before using your given
example.

>  
> 
>   <!-- project.site-keep-dir is defined elsewhere in this xml file
> -->  
> 
>  </target>
> 
>  
> 
> Is this approach doable? 

No, with my assumption not.

However why not:
<target name="clean-site-keep" depends="init-props"
      description="copies the keep dir and clean the project generated
documents directory">
   <!-- NEW -- >  
  <!-- project.site-keep-dir-src 
and destination (des) is defined elsewhere in this xml file -->  
    <copy failonerror="false" dir="${project.site-keep-dir-src}"
todir="${project.site-keep-dir-des}"/>
    <delete failonerror="false" dir="${project.site-dir}"/>
    <delete failonerror="false" file="${project.brokenlinkfile}"/>
 </target>

That should do want you want. Have a look at the ant manual.

HTH

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)



Mime
View raw message