root/trunk/build.xml

Revision 4392, 4.1 kB (checked in by bergie, 2 years ago)

Minor fixes to the component scaffold

@tarjei: I think we should consistently call components components instead of packages and modules

  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?xml version="1.0"?>
2 <project name="MidCOM" default="dummy" basedir=".">
3 <!-- plan:
4     target scaffold is the one that will create a
5     new component directory
6     It will:
7     a) create the component directory (and fail if it exists)
8     b) create the config, handler, midcom, style and documentation subdirs.
9     c) generate a simple manifest.inc file.
10     d) generate simple viewer.php and admin.php files
11    
12 -->
13    
14     <target name="dummy">
15         <echo>Usage:
16         phing scaffold
17         </echo>
18     </target>
19     <!-- this task creates a new project -->
20     <target name="scaffold" depends="resolve_module_to_dir">
21         <property name="template_dir" value="src/scaffold" />
22         <phingcall target="create_module" />
23
24     </target>
25    
26     <target name="resolve_module_to_dir" >
27         <!-- it is practical to have the basic moduledir for expansion in the files -->
28         <php function="str_replace" returnProperty="module_dir_basic">
29             <param value="."/>
30             <param value="/"/>
31             <param value="${module}"/>
32         </php>       
33         <property name="module_dir" value="src/${module}"/>
34         <php function="str_replace" returnProperty="module_class">
35             <param value="."/>
36             <param value="_"/>
37               <param value="${module}"/>
38         </php>
39         <php function="date" returnProperty="currentDate" >
40             <param value="Y-M-D" />
41         </php>
42            
43         <available
44             file="${basedir}/${module_dir}"
45             property="module_dir_exists"
46             value="yes"
47             type="dir"
48         />
49     </target>
50    
51     <target name="create_module" if="module_dir" unless="module_dir_exists">
52         <mkdir dir="${module_dir}"/>
53         <mkdir dir="${module_dir}/config"/>
54         <mkdir dir="${module_dir}/documentation"/>
55         <mkdir dir="${module_dir}/midcom"/>
56         <mkdir dir="${module_dir}/handler"/>
57         <mkdir dir="${module_dir}/style" />
58         <mkdir dir="${module_dir}/locale" />
59         <mkdir dir="${module_dir}/static/" />
60        
61         <input propertyname="module_description"
62             defaultValue="MidCOM component ${module}"
63             >
64             Enter component description:
65         </input>
66        
67         <copy todir="${module_dir}">
68              <filterchain>
69                 <expandproperties/>
70              </filterchain>
71             <fileset dir="${template_dir}/" >
72                 <include name="*.php" />
73                 <include name="*.xml" />
74             </fileset>
75         </copy>
76        
77         <copy todir="${module_dir}/config">
78              <filterchain>
79                 <expandproperties/>
80              </filterchain>
81             <fileset dir="${template_dir}/config/">
82                 <include name="*.inc" />
83             </fileset>
84         </copy>
85
86         <copy todir="${module_dir}/documentation">
87              <filterchain>
88                 <expandproperties/>
89              </filterchain>
90             <fileset dir="${template_dir}/documentation">
91                 <include name="CHANGES" />
92             </fileset>
93         </copy>
94         <copy todir="${module_dir}/midcom">
95              <filterchain>
96                 <expandproperties/>
97              </filterchain>
98             <fileset dir="${template_dir}/midcom">
99                 <include name="*.php" />
100             </fileset>
101         </copy>
102         <copy todir="${module_dir}/handler">
103              <filterchain>
104                 <expandproperties/>
105              </filterchain>
106             <fileset dir="${template_dir}/handler">
107                 <include name="*.php" />
108             </fileset>
109         </copy>
110         <copy todir="${module_dir}/style">
111             <filterchain>
112                 <expandproperties/>
113             </filterchain>
114             <fileset dir="${template_dir}/style">
115                 <include name="*.php" />
116             </fileset>
117         </copy>
118         <copy todir="${module_dir}/locale">
119             <filterchain>
120                 <expandproperties/>
121             </filterchain>
122             <fileset dir="${template_dir}/locale">
123                 <include name="default.*.txt" />
124             </fileset>
125         </copy>
126     </target>
127 </project>
128    
Note: See TracBrowser for help on using the browser.