Search This Blog

Sunday, February 24, 2008

build.xml for An Apache ant way for a management console for SVN

Here it is. The one which i have written till now. it is not complete yet. still, if anyone wanna have a look at it. Please do so, and if you have any bright ideas please let me know.....
so here you go

 

 

<project name = "SVN Management tool" default="manage">

    <taskdef name="antform" classname="com.sardak.antform.AntForm" classpathref="classpath"/>
    <taskdef name="if" classname="net.sf.antcontrib.logic.IfTask" classpathref="classpath"/>
    <path id = "classpath">
        <fileset dir="lib">
            <include name="*.jar"/>
        </fileset>
    </path>
    <property name="repo" value="E:\repos"/>
    <target name="manage">
        <antform title="MANAGE SVN" lookAndFeel="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" showwhenempty="yes">
        <ButtonBar>
            <button label="Create Repository" target="newrepo"/>
        </ButtonBar>
        <ButtonBar>
            <button label="Generate Config" target="config"/>
        </ButtonBar>
        <ButtonBar>
            <button label="Generate ACL" target="acl"/>
        </ButtonBar>
        <ButtonBar>
            <button label="Exit" target="exit"/>
        </ButtonBar>
        <controlbar/>
        </antform>
    </target>

    <target name="newrepo">
        <antform title="Create New Repository" lookAndFeel="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" showwhenempty="yes">
            <textProperty label="Enter new repository name" property="reponame" Required="yes"/>
        <ButtonBar>
            <button label="Create" target="createrepo"/>
            <button label="Back" target="manage"/>
            <button label="Exit" target="exit"/>
        </ButtonBar>
        <controlbar/>
        </antform>
    </target>

    <target name="exit">
        <echo message="Bye Bye"/>
    </target>

    <target name="createrepo">
        <echo message="${reponame}"/>
        <echo message="Checking if the repository already exists"/>
        <available file="${repo}/${reponame}" type="dir" property="repo.present"/>
        <if>
        <equals arg1="${repo.present}" arg2="true"/>
            <then>
                <echo message="Repository with the name already exists"/>
                <property name="repo.present" value="false"/>
                <antform title="Repository Already Exists" lookAndFeel="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" showwhenempty="yes">
                    <ButtonBar>
                        <button label="Ok" target="manage"/>
                        <button label="Exit" target="exit"/>
                    </ButtonBar>
                    <controlbar/>
                </antform>
            </then>
            <else>
                <echo message="creating repository ${reponame}"/>
                <exec executable="svnadmin">
                    <arg value="create"/>
                    <arg value="${repo}\${reponame}"/>
                </exec>
                <available file="${repo}/${reponame}" type="dir" property="repo.present"/>
                <if>
                    <equals arg1="${repo.present}" arg2="true"/>
                    <then>
                        <echo message="Creation of repository ${reponame} successful"/>
                    </then>
                    <else>
                        <echo message="Creation of repositoru ${reponame} failed"/>
                    </else>
                </if>
            </else>
        </if>
    </target>

    <target name="config">
        <antform title="Generate Config" lookAndFeel="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" showwhenempty="yes">
            <textProperty label="Generate For repository : " property="repoconf" Required="yes"/>
            <ButtonBar>
                <button label="Generate" target="config-generator"/>
                <button label="Back" target="manage"/>
                <button label="Exit" target="exit"/>
            </ButtonBar>
            <controlbar/>
        </antform>
    </target>

    <target name="config-generator">
        <exec executable="php">
            <arg value="conf.php"/>
            <arg value="${repoconf}"/>
        </exec>
    </target>

    <target name="acl">
        <antform title="Generate ACL" lookAndFeel="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" showwhenempty="yes">
            <textProperty label="AccessControl For repository : " property="acllist" Required="yes"/>
            <textProperty label="User's list (seperated by space : " property="aclusers" Required="yes"/>
            <ButtonBar>
                <button label="Generate" target="acl-generator"/>
                <button label="Back" target="manage"/>
                <button label="Exit" target="exit"/>
            </ButtonBar>
            <controlbar/>
        </antform>
    </target>

    <target name="acl-generator">
        <exec executable="php">
            <arg value="acl.php"/>
            <arg value="${acllist}"/>
            <arg value="${aclusers}"/>
        </exec>
    </target>

    <target name="users">
        <antform title="Create / Modify user login credentials" lookAndFeel="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" showwhenempty="yes">
            <textProperty label="Enter TMC Number" property="tmc" Required="yes"/>
            <ButtonBar>
                <button label="Create/Modify" target="createmodify"/>
                <button label="Back" target="manage"/>
                <button label="exit" target="exit"/>
            </ButtonBar>
            <controlbar/>
        </antform>
    </target>

    <target name="createmodify">
        <echo message="Creating / Modifying ${tmc}'s Login Credentials"/>
        <exec executable="htpasswd">
            <arg value="-m"/>
            <arg value="d:\svn-auth-file-test"/>
            <arg value="$tmc"/>
        </exec>
    </target>
</project>

No comments:

Post a Comment