public
Description: MVC framework for PHP and the Midgard content repository
Homepage: http://www.midgard-project.org/
Clone URL: git://github.com/bergie/midcom.git
midcom / build.xml
100644 208 lines (178 sloc) 7.136 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?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>