views:

125

answers:

0

Hi everyone,

I am trying to do the following in ANT but I am stuck.


  1. Read which projects are installed in my project workspace.

    workspace
        buildtools
            build.xml
        project1
            build.xml
                project.name = "project1"
                IP = "44.55.66.77"
                SERVER_NAME = "project1.local"
                DOCUMENT_ROOT = "c:\inetpub\project1"
        project2
            build.xml
                project.name = "project2"
                IP = "44.55.66.77"
                SERVER_NAME = "project2.local"
                DOCUMENT_ROOT = "c:\inetpub\project2"
        ....
    
  2. Create an Apache virtualhost directive for each project.

    <VirtualHost 44.55.66.77>
       DocumentRoot "c:\inetpub\project1"
       ServerName project1.local
    </VirtualHost>
    
    
    <VirtualHost 44.55.66.77>
       DocumentRoot "c:\inetpub\project2"
       ServerName project2.local
    </VirtualHost>
    ....
    
  3. Concatenate the virtualhost directives into an Apache configuration file.


I have spent many hours studying the different tasks that I could use. Concat, loadproperties, fileset, filterreaders, etc.. I get overwhelmed with all the possibilities and my head spins.

Here is my horrible guess at how this might be done:

<concat destfile={$apache.config.file}>
    <fileset>
        <include name="**/build.xml"/>
        <loadproperties resource="fileset.item.project.name???"/>
        <filterchain>       
            <replacetokens>
                <token key="IP"
                       value="${p.IP}"/>
                <token key="DOCUMENT_ROOT"
                       value="${p.DOCUMENT_ROOT}"/>
                <token key="SERVER_NAME"
                       value="${p.SERVER_NAME}"/>                   
            </replacetokens>        
        </filterchain>
    </fileset>
<concat>

Thanks for the help!