-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
214 lines (178 loc) · 8.06 KB
/
build.xml
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
209
210
211
212
213
214
<?xml version="1.0"?>
<project name="booked" default="package">
<property name="version" value="2.6.7"/>
<property name="is.pre.release" value="false"/>
<property name="packagename" value="booked-${version}"/>
<property name="root.dir" value="../.."/>
<property name="zipdirectory" value="${root.dir}/booked_archive/zip/${version}"/>
<property name="archive_directory" value="${root.dir}/booked_archive/src/${version}"/>
<property name="staging" value="${root.dir}/staging"/>
<property name="stagingdir" value="${staging}/booked"/>
<property name="demo.dir" value="${root.dir}/booked_archive/src/demo"/>
<property name="phing.tasks.dir" value="c:/php/pear/phing/tasks/my"/>
<available file="C:/Program Files/MySQL/MySQL Server 5.6/bin" property="mysql.bin" value="C:/Program Files/MySQL/MySQL Server 5.6/bin"/>
<available file="C:\wamp\bin\mysql\mysql5.5.24\bin" property="mysql.bin" value="C:\wamp\bin\mysql\mysql5.5.24\bin"/>
<available file="C:\wamp\bin\mysql\mysql5.6.12\bin" property="mysql.bin" value="C:\wamp\bin\mysql\mysql5.6.12\bin"/>
<available file="C:\wamp64\bin\mysql\mysql5.7.9\bin" property="mysql.bin" value="C:\wamp64\bin\mysql\mysql5.7.9\bin"/>
<property name="mysql.bin.64bit" value="C:/Program Files (x86)/MySQL/MySQL Server 5.1/bin"/>
<property name="mysql.username" value="root"/>
<property name="mysql.password" value="password"/>
<property name="mysql.server" value="127.0.0.1"/>
<property name="mysql.database" value="booked"/>
<property name="sql.file.create.db" value="database_schema/create-db.sql"/>
<property name="sql.file.create.schema" value="database_schema/create-schema.sql"/>
<property name="sql.file.create.user" value="database_schema/create-user.sql"/>
<property name="sql.file.data" value="database_schema/create-data.sql"/>
<property name="sql.file.full" value="database_schema/full-install.sql"/>
<property name="sql.file.test.data" value="database_schema/sample-data-utf8.sql"/>
<target name="setup.db" description="setting up the latest version of the database">
<if>
<equals arg1="${mysql.password}" arg2=""/>
<then>
<input propertyName="mysql.password" defaultValue="" promptChar="?">mysql password</input>
</then>
</if>
<phingcall target="baseline.db">
<property name="mysql.password" value="${mysql.password}"/>
</phingcall>
<phingcall target="upgrade.db">
<property name="mysql.password" value="${mysql.password}"/>
</phingcall>
</target>
<target name="baseline.db" description="baseline db">
<if>
<equals arg1="${mysql.password}" arg2=""/>
<then>
<input propertyName="mysql.password" defaultValue="" promptChar="?">mysql password</input>
</then>
</if>
<echo message="Using MySQL from ${mysql.bin}"/>
<echo message="Create db file: ${sql.file.create.db}"/>
<exec command="mysql --user=${mysql.username} --password=${mysql.password} --host=${mysql.server} mysql < ${application.startdir}/${sql.file.create.db}"
checkreturn="true"
dir="${mysql.bin}"/>
<echo message="Create schema file: ${sql.file.create.schema}"/>
<exec command="mysql --user=${mysql.username} --password=${mysql.password} --host=${mysql.server} ${mysql.database} < ${application.startdir}/${sql.file.create.schema}"
checkreturn="true"
dir="${mysql.bin}"/>
<echo message="Create user file: ${sql.file.create.user}"/>
<exec command="mysql --user=${mysql.username} --password=${mysql.password} --host=${mysql.server} ${mysql.database} < ${application.startdir}/${sql.file.create.user}"
checkreturn="true"
dir="${mysql.bin}"/>
<echo message="Application data file: ${sql.file.data}"/>
<exec command="mysql --user=${mysql.username} --password=${mysql.password} --host=${mysql.server} ${mysql.database} < ${application.startdir}/${sql.file.data}"
checkreturn="true"
dir="${mysql.bin}"/>
</target>
<target name="upgrade.db" depends="custom.tasks">
<if>
<equals arg1="${mysql.password}" arg2=""/>
<then>
<input propertyName="mysql.password" defaultValue="" promptChar="?">mysql password</input>
</then>
</if>
<taskdef name="upgradedb" classname="phing.tasks.my.UpgradeDbTask"/>
<upgradedb username="${mysql.username}" password="${mysql.password}"
host="${mysql.server}" database="${mysql.database}"
schemadir="${application.startdir}/database_schema"/>
<echo message="Test data file: ${sql.file.test.data}"/>
<exec command="mysql --user=${mysql.username} --password=${mysql.password} --host=${mysql.server} ${mysql.database} < ${application.startdir}/${sql.file.test.data}"
checkreturn="true"
dir="${mysql.bin}"/>
</target>
<target name="package" description="packages all required files" depends="stage.files">
<delete dir="${zipdirectory}" failonerror="false"/>
<mkdir dir="${zipdirectory}"/>
<tstamp/>
<property name="zip.file.name" value="${zipdirectory}/${packagename}.zip"/>
<!--<if>-->
<!--<contains string="${project.basedir}" substring="development"/>-->
<!--<then>-->
<!--<echo message="Packaging pre-release version"/>-->
<!--<property name="zip.file.name" value="${zipdirectory}/${packagename}${DSTAMP}.zip" override="true"/>-->
<!--</then>-->
<!--</if>-->
<zip destfile="${zip.file.name}">
<fileset dir="${staging}">
<include name="**/*"/>
</fileset>
</zip>
<delete dir="${archive_directory}" failonerror="false"/>
<mkdir dir="${archive_directory}"/>
<copy todir="${archive_directory}" includeemptydirs="true">
<fileset dir="${staging}">
<include name="**/*"/>
</fileset>
</copy>
<delete dir="${staging}" failonerror="false"/>
</target>
<target name="create.demo" depends="stage.files">
<delete dir="${demo.dir}" failonerror="false"/>
<mkdir dir="${demo.dir}"/>
<copy todir="${demo.dir}" includeemptydirs="true">
<fileset dir="${stagingdir}">
<include name="**/*"/>
</fileset>
</copy>
<delete file="C:/work/demo/reload.v2.sql" failonerror="false"/>
<append destFile="C:/work/demo/reload.v2.sql">
<filelist dir="${demo.dir}/database_schema" files="create-schema.sql,create-data.sql,sample-data-utf8.sql"/>
</append>
</target>
<target name="stage.files">
<delete dir="${staging}" failonerror="false"/>
<mkdir dir="${staging}"/>
<mkdir dir="${stagingdir}"/>
<copy todir="${stagingdir}" includeemptydirs="true">
<fileset dir=".">
<include name="**/*"/>
<exclude name="**.psd"/>
<exclude name="**.bak"/>
<exclude name="*test*"/>
<exclude name=".project"/>
<exclude name="build.bat"/>
<exclude name="build.xml"/>
<exclude name="**/tests/**"/>
<exclude name="**/docs/**"/>
<exclude name="tpl_c/*.php"/>
<exclude name=".*/**"/>
<exclude name=".idea"/>
<exclude name=".idea/**"/>
<exclude name=".settings/**"/>
<exclude name="_excludes.txt"/>
<exclude name="pdt_templates.xml"/>
<exclude name="**/*.zip"/>
<exclude name="**/*.jar"/>
<exclude name="**/phing-tasks/**"/>
<exclude name="*phing-tasks*"/>
<exclude name="**/uploads/images/*"/>
<exclude name="**/uploads/reservation/*"/>
<exclude name="**/config.php"/>
<exclude name="**/*.config.php"/>
<exclude name="config/log4php.config.xml"/>
<include name="**/qrconfig.php" />
</fileset>
</copy>
<copy tofile="${stagingdir}/lib/external/phpqrcode/qrconfig.php" file="./lib/external/phpqrcode/qrconfig.php" />
<phingcall target="combine.db.files">
</phingcall>
<append destFile="${stagingdir}/${sql.file.full}">
<filelist dir="${stagingdir}/database_schema" files="create-db.sql,create-user.sql,create-schema.sql,create-data.sql"/>
</append>
</target>
<target name="combine.db.files" depends="custom.tasks">
<taskdef name="combinedbfiles" classname="phing.tasks.my.CombineDbFilesTask"/>
<combinedbfiles schemadir="${stagingdir}/database_schema"
schemaFile="${stagingdir}/${sql.file.create.schema}"
dataFile="${stagingdir}/${sql.file.data}"/>
</target>
<target name="minify" description="minify javascript and css files">
</target>
<target name="custom.tasks">
<copy todir="${phing.tasks.dir}">
<fileset dir="phing-tasks">
<include name="*.php"/>
</fileset>
</copy>
</target>
</project>