-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
322 lines (268 loc) · 11.6 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?xml version="1.0" encoding="UTF-8"?>
<project name="mysite" default="dummy">
<taskdef name="drush" classname="DrushTask" />
<!-- General targets -->
<target name="dummy">
<echo>Dummy task. It's here to prevent unwanted default execution of the build script.</echo>
</target>
<!-- Local environment meta-targets -->
<target name="loc-prop">
<property file="build.loc.properties" />
</target>
<target name="loc-app" depends="loc-prop,app-configure">
<echo>Local application build done.</echo>
</target>
<target name="loc-test" depends="loc-prop,app-test">
<echo>Test executed.</echo>
</target>
<!-- Dev environment meta-targets -->
<target name="dev-prop">
<property file="build.dev.properties" />
<property name="db.url" value="${source.db.url}"/>
</target>
<target name="dev-app" depends="dev-prop,app-configure,disable-developer-modules,app-upload,app-test">
<echo>Clearing build database.</echo>
<drush command="sql-drop" assume="yes"></drush>
<echo>Dev application build done.</echo>
</target>
<!-- Stage environment meta-targets -->
<target name="stage-prop">
<property file="build.stage.properties" />
<property name="db.url" value="${source.db.url}"/>
</target>
<target name="stage-app" depends="stage-prop,app-configure,disable-developer-modules,app-upload,app-test">
<echo>Clearing build database.</echo>
<drush command="sql-drop" assume="yes"></drush>
<echo>Stage application build done.</echo>
</target>
<target name="stage-app-install" depends="stage-prop,app-configure,disable-developer-modules,app-upload,app-test">
<echo>Clearing build database.</echo>
<drush command="sql-drop" assume="yes"></drush>
<echo>Stage application build done.</echo>
</target>
<target name="stage-app-update" depends="stage-prop,app-configure-files,app-upload-files,app-backup-database,app-revert-features">
<echo>Stage application build done.</echo>
</target>
<!-- Configuration targets -->
<target name="app-configure" if="env">
<phingcall target="app-configure-files" />
<phingcall target="app-configure-database" />
</target>
<target name="app-configure-files" if="env">
<echo>Creating dumps dir.</echo>
<delete dir="dumps" includeemptydirs="true" verbose="true" failonerror="false" />
<mkdir dir="dumps" />
<echo>Creating private path dir.</echo>
<delete dir="sites/default/files/private" includeemptydirs="true" verbose="true" failonerror="false" />
<mkdir dir="sites/default/files/private" />
<chmod file="sites/default/files/private" mode="0755" verbose="true" />
<phingcall target="drush-make" />
</target>
<target name="app-configure-database" if="env">
<phingcall target="drush-site-install" />
<phingcall target="fixture-import" />
</target>
<target name="app-upload" if="env">
<phingcall target="app-upload-files" />
<phingcall target="app-upload-database" />
<phingcall target="app-revert-features" />
</target>
<target name="app-upload-files" if="env">
<echo>Uploading files.</echo>
<drush command="rsync" assume="yes">
<param>./</param>
<param>${destination.sys.user}@${domain}${destination.sys.docroot}</param>
</drush>
</target>
<target name="app-upload-database" if="env">
<echo>Uploading database.</echo>
<tstamp>
<format property="build.time" pattern="%Y%m%d%H%M"/>
</tstamp>
<drush command="sql-sync" assume="yes">
<option name="source-db-url">${source.db.url}</option>
<option name="source-dump">${source.sys.dump_dir}/${phing.project.name}-${build.time}.sql</option>
<option name="target-remote-host">${destination.sys.user}@${domain}</option>
<option name="target-db-url">${destination.db.url}</option>
<option name="target-dump">${destination.sys.dump_dir}/${phing.project.name}-${build.time}.sql</option>
<param>--no-cache</param>
<param>default</param>
<param>${env}</param>
</drush>
</target>
<target name="app-revert-features" if="env">
<echo>Reverting all features.</echo>
<drush command="features-revert-all" assume="yes">
<param>@${drush.alias}</param>
</drush>
</target>
<target name="app-backup-database" if="env">
<echo>Backing up database.</echo>
<tstamp>
<format property="build.time" pattern="%Y%m%d%H%M"/>
</tstamp>
<drush command="sql-dump" assume="yes">
<param>@${drush.alias}</param>
<param>--gzip</param>
<option name="result-file">/tmp/${phing.project.name}-drush-sql-dump-${build.time}.sql</option>
</drush>
</target>
<target name="app-test" if="env">
<echo>Creating behat.yml file.</echo>
<copy file="behat.yml.dist" tofile="behat.yml" overwrite="true">
<filterchain>
<expandproperties />
</filterchain>
</copy>
<echo>Creating test reports dir.</echo>
<delete dir="reports" includeemptydirs="true" verbose="true" failonerror="false" />
<mkdir dir="reports" />
<echo>Creating bin dir.</echo>
<delete dir="bin" includeemptydirs="true" verbose="true" failonerror="false" />
<mkdir dir="bin" />
<echo>Downloading dependencies using composer.</echo>
<exec command="curl -s http://getcomposer.org/installer | php" dir="bin" checkreturn="true"/>
<exec command="php bin/composer.phar install --prefer-dist" dir="." checkreturn="true"/>
<echo>Dumping all the classes for the autoloader.</echo>
<exec command="php bin/composer.phar dump-autoload -o" dir="." checkreturn="true"/>
<phingcall target="enable-testing-modules" />
<echo>Setting WatchdogMailSystem as default mailing system for @{drush.alias}</echo>
<php expression="json_encode(array('default-system' => 'WatchdogMailSystem'));" returnProperty="drupal.mail.system" />
<drush command="@${drush.alias} vset" assume="yes">
<option name="format">json</option>
<param>mail_system</param>
<param>'${drupal.mail.system}'</param>
</drush>
<echo>Running tests.</echo>
<exec command="vendor/behat/behat/bin/behat --format=junit --out=./reports"></exec>
<phingcall target="disable-testing-modules" />
<echo>Setting back default mailing system for @{drush.alias}</echo>
<php expression="json_encode(array('default-system' => 'DefaultMailSystem'));" returnProperty="drupal.mail.system_default" />
<drush command="@${drush.alias} vset" assume="yes">
<option name="format">json</option>
<param>mail_system</param>
<param>'${drupal.mail.system_default}'</param>
</drush>
</target>
<!-- Helper targets -->
<target name="drush-site-install" if="env">
<echo>Installing site.</echo>
<drush command="site-install" assume="yes">
<!-- <option name="locale">${app.locale}</option> -->
<option name="site-name">${site.name}</option>
<option name="site-mail">${site.mail}</option>
<option name="account-mail">${account.mail}</option>
<option name="account-name">${account.name}</option>
<option name="account-pass">${account.pass}</option>
<option name="db-url">${db.url}</option>
<param>${app.profile}</param>
</drush>
</target>
<target name="drush-make" if="env">
<echo>Running Drush Make.</echo>
<drush command="make" assume="yes">
<param>${app.makefile}</param>
</drush>
</target>
<target name="fixture-import" if="env">
<echo>Autoregistering migration classes.</echo>
<drush command="migrate-auto-register" assume="yes">
</drush>
<echo>Importing Fixtures.</echo>
<drush command="migrate-import" assume="yes">
<option name="all" />
</drush>
</target>
<target name="enable-developer-modules" if="env">
<echo>Enabling developer modules.</echo>
<drush command="pm-enable" assume="yes">
<param>devel</param>
<param>devel_generate</param>
<param>devel_themer</param>
<param>diff</param>
<param>email_testing</param>
<param>features_ui</param>
<param>ftools</param>
<param>masquerade</param>
<param>omega_tools</param>
<param>reroute_email</param>
</drush>
</target>
<target name="disable-developer-modules" if="env">
<echo>Disabling developer modules.</echo>
<drush command="pm-disable" assume="yes">
<param>devel</param>
<param>devel_generate</param>
<param>devel_themer</param>
<param>diff</param>
<param>features_ui</param>
<param>ftools</param>
<param>masquerade</param>
<param>omega_tools</param>
</drush>
<echo>Uninstalling developer modules.</echo>
<drush command="pm-uninstall" assume="yes">
<param>devel</param>
<param>devel_generate</param>
<param>devel_themer</param>
<param>diff</param>
<param>features_ui</param>
<param>ftools</param>
<param>masquerade</param>
<param>omega_tools</param>
</drush>
</target>
<target name="enable-testing-modules" if="env">
<echo>Enabling testing modules.</echo>
<drush command="pm-enable" assume="yes">
<param>email_testing</param>
<param>reroute_email</param>
</drush>
<drush command="pm-enable @${drush.alias}" assume="yes">
<param>email_testing</param>
<param>reroute_email</param>
</drush>
</target>
<target name="disable-testing-modules" if="env">
<echo>Disabling testing modules.</echo>
<drush command="pm-disable" assume="yes">
<param>email_testing</param>
<param>reroute_email</param>
</drush>
<drush command="pm-disable @${drush.alias}" assume="yes">
<param>email_testing</param>
<param>reroute_email</param>
</drush>
<echo>Uninstalling testing modules.</echo>
<drush command="pm-uninstall" assume="yes">
<param>email_testing</param>
<param>reroute_email</param>
</drush>
<drush command="pm-uninstall @${drush.alias}" assume="yes">
<param>email_testing</param>
<param>reroute_email</param>
</drush>
</target>
<target name="enable-migrate-modules" if="env">
<echo>Enabling migrate modules.</echo>
<drush command="pm-enable" assume="yes">
<param>migrate_extras</param>
<param>migrate_ui</param>
<param>migrate</param>
</drush>
</target>
<target name="disable-migrate-modules" if="env">
<echo>Disabling migrate modules.</echo>
<drush command="pm-disable" assume="yes">
<param>migrate_extras</param>
<param>migrate_ui</param>
<param>migrate</param>
</drush>
<echo>Uninstalling migrate modules.</echo>
<drush command="pm-uninstall" assume="yes">
<param>migrate_extras</param>
<param>migrate_ui</param>
<param>migrate</param>
</drush>
</target>
</project>