Hey folks,

Recently a MG developer spoke to me about the Ant script in the
modelglueapplicationtemplate folder. This script is used to create a new
Model-Glue application from the template. The developer uses this script
frequently but found the requirement to edit the script before each run to
be frustrating.

After looking at the script I created an enhanced version with the following
changes:

   - The script now prompts the user for the new application's name and
   directory, with default values provided.
   - If the default application parent directory is set correctly, the
   script will provide the correct default for the application directory.
   - Anyone who doesn't like the prompts can skip them by setting the
   application name or directory in the build.properties file.
   - The following files are now excluded from being copied into the new
   application: .project, readme.txt, build.properties.

I've attached my modified build.xml and build.properties files as text files
to this message. To use them, remove the .txt extension and replace the
existing files in your modelglueapplicationtemplate folder with them. You
must replace both files as the old build.properties file has a setting that
will break the new script.

If you have used the Ant script distributed with Model-Glue to create new
applications from the template, please try out this new version of the
script and let me know what you think.

Cheers,

-- Dennis

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en
<!--
        Ant script to create new Model-Glue 3.0 applications
        
        If you're using CFEclipse, or you know how to use Ant 
(http://ant.apache.org), 
        just run this file to create a ready-to-go Model-Glue application.
        
        To run it in CFEclipse, it's Alt-Shift-X -> Q
        
        Instructions:
        
        Run the script. Answer the prompts. That's it!
        
        Edit the build.properties file in this directory if you wish to change 
the defaults or skip the prompts.
-->     
<project name="New Model-Glue Application" default="build">

        <!-- Get build properties from file before any other sources -->
        <property file="build.properties" />

        <!-- Default values for required properties not found in the 
build.properties file -->
        <property name="templateDirectory" value="." />
        <property name="defaultNewApplicationName" value="myNewApplication" />
        <property name="defaultNewApplicationParentDirectory" value="/webroot" 
/>

        <target name="build" 
depends="newApplicationNameProperty,newApplicationDirectoryProperty" 
description="Create a new Model-Glue application">
                <copy todir="${newApplicationDirectory}">
                        <fileset dir="${templateDirectory}" 
excludes=".project,build.xml,build.properties,readme.txt" />
                </copy>
                <replace dir="${newApplicationDirectory}" 
token="modelglueapplicationtemplate" value="${newApplicationName}" />
        </target>
        
        <target name="newApplicationNameProperty" unless="newApplicationName">
                <input message="New application name:" 
addproperty="newApplicationName" defaultvalue="${defaultNewApplicationName}" />
        </target>

        <target name="newApplicationDirectoryProperty" 
unless="newApplicationDirectory">
                <input message="New application directory:" 
addproperty="newApplicationDirectory" 
defaultvalue="${defaultNewApplicationParentDirectory}/${newApplicationName}" />
        </target>

</project>
# Ant script to create new Model-Glue application
#
# Instructions
#
# Set the "defaultNewApplicationParentDirectory" path to the default value
# for the parent directory where you'd like your new ModelGlue application to 
go.  
# This is normally your webroot.

defaultNewApplicationParentDirectory=/webroot

# For the Windows/IIS crowd
#defaultNewApplicationParentDirectory=c:/inetpub/wwwroot/

#
# Optional settings
#
# If you don't like the Ant script prompting you to input the values for
# "newApplicationName" and "newApplicationDirectory" and would rather set them 
through
# a file, then uncomment the following two lines and set them to your desired 
values:

#newApplicationName=newApplicationName
#newApplicationDirectory=${defaultNewApplicationParentDirectory}/${newApplicationName}

Reply via email to