<?xml version="1.0"?>
<project name="MidCOM 3" default="help" basedir=".">
<property file="build.properties" />
<property name="absolute_basedir" value="" />
<property name="phpdocdir" value="documentation/api" />
<property name="coreVersion" value="0.1beta" />
<property name="version" value="" />
<property name="state" value="" />
<resolvepath propertyName="absolute_basedir" file="${project.basedir}"/>
<taskdef classname="build.resolveComponentsStyleHandle"
name="resolveComponentsStyleHandle"
classpath="/${project.basedir}"
/>
<taskdef classname="build.resolveComponentNamePart"
name="resolveComponentNamePart"
classpath="/${project.basedir}"
/>
<taskdef classname="build.symlinkStatics"
name="symlinkStatics"
classpath="/{$project.basedir}"
/>
<target name="help">
<echo>
Usage:
To create a new component:
phing scaffold -Dcomponent=com_example_mycomponent
To run all tests: (this must be done as root or by sudo) (DEPRECATED)
phing runtests
To create symlinks for all static folders:
phing linkstatics
Current settings:
install_dir = ${install_dir} // this is the dir that is linked to this checkout.
target_dir = ${target_dir} // this is where pear packages are saved.
</echo>
</target>
<fileset dir="." id="statics">
<include name="**/static/" />
<exclude name="static/" />
<exclude name="scaffold/static/" />
</fileset>
<fileset dir="." id="alltests">
<include name="tests/*Test.php" />
<include name="**/tests/*Test.php" />
<exclude name="scaffold/tests/*Test.php" />
</fileset>
<fileset dir="." id="midcom">
<include name="*.php" />
<include name="**/*.php" />
<exclude name="build/*.php" />
<exclude name="build/**/*.php" />
<exclude name="scaffold/*.php" />
<exclude name="scaffold/**/*.php" />
<exclude name="static/*.php" />
<exclude name="static/**/*.php" />
<exclude name="**/static/*.php" />
<exclude name="**/static/**/*.php" />
<exclude name="midcom_core/httpd/midcom-root.php" />
<exclude name="midcom_helper_datamanager/*.php" />
<exclude name="midcom_helper_datamanager/**/*.php" />
<exclude name="net_nemein_notifications/*.php" />
<exclude name="net_nemein_notifications/**/*.php" />
<exclude name="templates/*.xhtml" />
<exclude name="**/templates/*.xhtml" />
<exclude name="tests/*.php" />
<exclude name="**/tests/*.php" />
<exclude name="*Test.php" />
<exclude name="**/*Test.php" />
</fileset>
<target name="linkstatics">
<mkdir dir="static" />
<symlinkStatics static_dir="${static_dir}">
<fileset refid="statics" />
</symlinkStatics>
</target>
<target name="scaffold" depends="resolve_component_to_dir">
<property name="template_dir" value="scaffold" />
<phingcall target="create_component" />
</target>
<target name="resolve_component_to_dir" >
<php function="str_replace" returnProperty="component">
<param value="."/>
<param value="_"/>
<param value="${component}"/>
</php>
<property name="component_dir" value="${component}"/>
<resolveComponentsStyleHandle
component="${component}"
returnProperty="component_style_handle"
/>
<resolveComponentNamePart
component="${component}"
part="name"
returnProperty="component_parts_name"
/>
<resolveComponentNamePart
component="${component}"
part="host"
returnProperty="component_parts_host"
/>
<resolveComponentNamePart
component="${component}"
part="domain"
returnProperty="component_parts_domain"
/>
<available
file="${basedir}/${component_dir}"
property="component_dir_exists"
value="yes"
type="dir"
/>
<property name="midcom_root" value="${project.basedir}" />
</target>
<target name="create_component" if="component_dir" unless="component_dir_exists">
<mkdir dir="${component_dir}"/>
<mkdir dir="${component_dir}/configuration"/>
<mkdir dir="${component_dir}/controllers"/>
<mkdir dir="${component_dir}/templates" />
<mkdir dir="${component_dir}/static" />
<mkdir dir="${component_dir}/tests" />
<input propertyname="component_description"
defaultValue="MidCOM component ${component}"
>
Enter component description:
</input>
<copy todir="${component_dir}">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/" >
<include name="*.php" />
<include name="*.yml" />
</fileset>
</copy>
<copy todir="${component_dir}/configuration">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/configuration/">
<include name="*.yml" />
</fileset>
</copy>
<copy todir="${component_dir}/controllers">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/controllers">
<include name="*.php" />
</fileset>
</copy>
<copy todir="${component_dir}/templates">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/templates">
<include name="xxx-show-index.xhtml" />
</fileset>
</copy>
<exec command="mv templates/xxx-show-index.xhtml templates/${component_style_handle}-show-index.xhtml"
dir="${component_dir}"
/>
<copy todir="${component_dir}/static">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/static">
<include name="component.js" />
</fileset>
</copy>
<copy todir="${component_dir}/tests">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/tests">
<include name="*.php" />
</fileset>
</copy>
</target>
</project>