Pergunta

I have an ant file to generate coffeescript documentation with docco. It works fine, except that it currently dumps all of the documentation file into the docs folder. I'd like the docs folder to mirror the structure of my scripts directory, rather than just having all files dumped flat into one directory.

<target name="documentation" description="Generate Docco Documentation for coffee files">
    <apply executable="docco" verbose="true" force="true" failonerror="true">
        <srcfile />
        <fileset dir ="${src.script.dir}" >
            <include name="**/*.coffee"/>
        </fileset>
    </apply>
</target>

I know docco has an --output argument, but my I'm not sure how to generate the docs directory path in the docs folder for each file in the fileset without going through them 1 by 1.

Foi útil?

Solução

Using <srcfile> and <targetfile> parameters for apply task should solve the problem.

Here's an example that moves files with .a extension to .b extension:

<apply executable="mv" dir="./" relative="true">
   <mappedresources>
        <fileset dir="." includes="**/*.a"/>
   </mappedresources>
   <mapper type="glob" from="*.a" to="*.b"/>
   <srcfile/>
   <targetfile/>
</apply> 

Take a look at Mapper type, too.

Try something like that for your case:

<target name="documentation" description="Generate Docco Documentation for coffee files">
    <apply executable="docco" verbose="true" force="true" failonerror="true">
        <srcfile />
        <fileset dir ="${src.script.dir}" >
            <include name="**/*.coffee"/>
        </fileset>
        <arg value="--output">
        <mapper type="glob" from "*.coffee" to="*.html"/>
        <targetfile/>
    </apply>
</target>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top