/
build.xml
142 lines (124 loc) · 6.3 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
<?xml version="1.0"?>
<project name="appendToDrupalBuild" default="help" basedir=".">
<!-- PREPARATION -->
<tstamp/>
<!-- by default use the build.properties file -->
<property file="buildlib/system.properties" />
<property file="config.properties" />
<!-- TARGET DEFINITIONS -->
<!-- TARGET: help -->
<target name="help">
<echo>
-----------------------------------------------------------
+++++ Welcome to appendTo Drupal Platform Builder +++++
-----------------------------------------------------------
This build system will assist with defining, constructing and
developing a Drupal Platform capable of being deployed through
the appendTo Drupal Site Builder System.
Several types of builds can be constructed. See the README
included in this folder for additional information.
Below are the available commands for this sytem.
http://appendto.com
</echo><exec command="phing -l" dir="." passthru="true" />
</target>
<!-- TARGET: verifyEnvironment -->
<target name="local.verify">
<!-- Verify Properties -->
<if><not><isset property="db.super.user" /></not><then>
<fail>!!!!!! Database Super User not specified</fail>
</then></if>
<if><not><isset property="db.host" /></not><then>
<fail>!!!!!! Database Hostname not specified</fail>
</then></if>
<if><not><isset property="db.name" /></not><then>
<fail>!!!!!! Database Name not specified</fail>
</then></if>
<if><not><isset property="db.user" /></not><then>
<fail>!!!!!! Database Username not specified</fail>
</then></if>
<if><not><isset property="db.pass" /></not><then>
<fail>!!!!!! Database Password not specified</fail>
</then></if>
<!-- TODO -->
<!-- Verify existence of Drush -->
<!-- Verify existence of Drush Make -->
</target>
<!-- TARGET: local.db.create -->
<target name="local.db.create" depends="local.verify" description="-> Creates local database environment">
<echo>-------------------------------------------------</echo>
<echo> +++++ Creating Database Environment +++++ </echo>
<echo>-------------------------------------------------</echo>
<copy file="${application.startdir}/buildlib/sql/${db.env.create}" tofile="${application.startdir}/${db.dir}/my_${db.env.create}" overwrite="true" />
<reflexive file="${application.startdir}/${db.dir}/my_${db.env.create}">
<filterchain>
<replacetokens begintoken="##" endtoken="##">
<token key="DBUSER" value="${db.user}" />
<token key="DBPASS" value="${db.pass}" />
<token key="DBNAME" value="${db.name}" />
<token key="DBHOST" value="${db.host}" />
</replacetokens>
</filterchain>
</reflexive>
<exec command="mysql --host=${db.host} -u ${db.super.user} -p < ${application.startdir}/${db.dir}/my_${db.env.create}" dir="." passthru="true" />
<delete file="${application.startdir}/${db.dir}/my_${db.env.create}" />
</target>
<!-- TARGET: local.db.drop -->
<target name="local.db.drop" depends="local.verify" description="-> Drops local database environment">
<copy file="${application.startdir}/buildlib/sql/${db.env.drop}" tofile="${application.startdir}/${db.dir}/my_${db.env.drop}" overwrite="true" />
<reflexive file="${application.startdir}/${db.dir}/my_${db.env.drop}">
<filterchain>
<replacetokens begintoken="##" endtoken="##">
<token key="DBUSER" value="${db.user}" />
<token key="DBNAME" value="${db.name}" />
<token key="DBHOST" value="${db.host}" />
</replacetokens>
</filterchain>
</reflexive>
<exec command="mysql --host=${db.host} -u ${db.super.user} -p < ${application.startdir}/${db.dir}/my_${db.env.drop}" dir="." passthru="true" />
<delete file="${application.startdir}/${db.dir}/my_${db.env.drop}" />
</target>
<!-- TARGET: local.db.reload -->
<target name="local.db.reload" depends="local.verify" description="-> Drops, then re-creates local database environment">
<echo>-------------------------------------------------</echo>
<echo> +++++ Reloading Database Environment +++++ </echo>
<echo>-------------------------------------------------</echo>
<phingcall target="local.db.save" />
<phingcall target="local.db.drop" />
<phingcall target="local.db.create" />
<phingcall target="local.db.load" />
</target>
<!-- TARGET: local.db.save -->
<target name="local.db.save" depends="local.verify" description="-> Saves a database snapshot">
<exec command="mysqldump --host=${db.host} --user=${db.user} --password=${db.pass} --opt ${db.name} > ${application.startdir}/${db.dir}/${db.snapshot}" dir="." passthru="true" />
</target>
<!-- TARGET: local.db.load -->
<target name="local.db.load" depends="local.verify" description="-> Loads a database snapshot">
<exec command="mysql --host=${db.host} -u ${db.user} --password=${db.pass} ${db.name} < ${application.startdir}/${db.dir}/${db.snapshot}" dir="." passthru="true" />
</target>
<!-- TARGET: local.clean -->
<target name="local.clean" depends="local.verify" description="-> Cleans the local environment">
<echo>-------------------------------------------------</echo>
<echo> +++++ Cleaning Installation +++++ </echo>
<echo>-------------------------------------------------</echo>
<exec command="rm -r ${drupal.dir}/*" dir="." passthru="TRUE"/>
<exec command="rm -r ${drupal.dir}/.*" dir="." passthru="TRUE"/>
<exec command="rm -r ${application.startdir}/build/" dir="." passthru="TRUE"/>
<!-- Destroy database -->
<phingcall target="local.db.drop" />
</target>
<!-- target: build.standalone -->
<target name="build.standalone" depends="local.verify" description="-> Builds and configures a local, standlone Drupal site">
<exec command="${application.startdir}/buildlib/drush/drush.php make --prepare-install ${make.filename} ${drupal.standalone.dir}/" dir="." passthru="true" />
</target>
<!-- TARGET: build.platform -->
<target name="build.platform" description="-> Builds local system as an Aegir Platform">
<!-- Create drupal.profile.dir if it doesn't exist -->
<available file="${application.startdir}/${drupal.profile.dir}" type="dir" property="drupal.profile.dir.dirExists" />
<if> <not><isset property="drupal.profile.dir.dirExists" /></not> <then>
<echo> ${drupal.profile.dir} does not exist, attempting to create...</echo>
<mkdir dir="${application.startdir}/${drupal.profile.dir}"/>
</then>
</if>
<exec command="${application.startdir}/buildlib/drush/drush.php make --yes --working-copy --no-core -r ${drupal.profile.dir} ${make.filename}" dir="." passthru="true" />
</target>
</project>