forked from mydropteam/drupal-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
261 lines (234 loc) · 10.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
<?xml version="1.0" encoding="UTF-8" ?>
<project name="My Drupal Project" default="help">
<property file="build.properties.local" />
<property file="build.properties" />
<property file="build.properties.dist" />
<target name="help" description="Phing target list">
<exec executable="${phing.bin}"
passthru="true">
<arg value="-l"/>
</exec>
</target>
<includepath classpath="src/Phing" />
<echo msg="Loading Drush task." />
<taskdef name="drush" classname="\Drush\Task" />
<echo msg="Loading PHP Codesniffer Configuration task." />
<taskdef name="phpcodesnifferconfiguration" classname="\DrupalProject\Phing\PhpCodeSnifferConfigurationTask" />
<echo msg="Loading PHPUnit Configuration task." />
<taskdef name="phpunitconfiguration" classname="\DrupalProject\Phing\PhpUnitConfigurationTask" />
<!-- Make the settings folder writeable so that the installer can copy settings.php. -->
<target name="writable-settings-folder">
<chmod mode="0755" failonerror="true" verbose="true" quiet="false" file="${website.settings.dir}" />
</target>
<!-- Make settings.php writeable so that the installer save it. -->
<target name="writable-settings-php">
<if>
<available file="${website.settings.php}" type="file" property="website.settings.php.available" />
<then>
<chmod mode="0644" failonerror="false" verbose="true" quiet="false" file="${website.settings.php}" />
</then>
</if>
</target>
<!-- Install the website. -->
<target name="install" depends="writable-settings-folder, writable-settings-php">
<drush
command="site-install"
assume="yes"
root="${website.drupal.dir}"
bin="${drush.bin}"
verbose="${drush.verbose}">
<option name="db-url" value="${drupal.db.url}"/>
<option name="site-name" value="${website.site.name}"/>
<option name="account-name" value="${drupal.admin.username}"/>
<option name="account-pass" value="${drupal.admin.password}"/>
<option name="account-mail" value="${drupal.admin.email}"/>
<param>${website.profile.name}</param>
<!-- Disable sending of e-mails during installation. -->
<param>install_configure_form.update_status_module='array(FALSE,FALSE)'</param>
</drush>
</target>
<!-- Set up PHP CodeSniffer. -->
<target name="setup-php-codesniffer" description="Generate the configuration file for PHP CodeSniffer.">
<if>
<available file="${phpcs.config}" type="file" property="phpcs.config.available" />
<then>
<echo message="Deleting existing PHP Codesniffer default configuration file." />
<delete file="${phpcs.config}" failonerror="false" />
</then>
</if>
<if>
<available file="${phpcs.global.config}" type="file" property="phpcs.global.config.available" />
<then>
<echo message="Deleting existing PHP Codesniffer global configuration file." />
<delete file="${phpcs.global.config}" failonerror="false" />
</then>
</if>
<phpcodesnifferconfiguration
configFile="${phpcs.config}"
extensions="${phpcs.extensions}"
files="${phpcs.files}"
globalConfig="${phpcs.global.config}"
ignorePatterns="${phpcs.ignore}"
report="${phpcs.report}"
showProgress="${phpcs.progress}"
showSniffCodes="${phpcs.sniffcodes}"
standard="${phpcs.standard}"
/>
<!-- Set up the git pre-push hook. -->
<phingcall target="disable-pre-push"/>
<if>
<equals arg1="${phpcs.prepush.enable}" arg2="1" />
<then>
<symlink link="${phpcs.prepush.destination}" target="${phpcs.prepush.source}" overwrite="true" />
</then>
</if>
</target>
<!-- Disable the PHP CodeSniffer pre-push hook. -->
<target name="disable-pre-push" description="Disable the coding standards check when pushing to a git repository.">
<delete file="${phpcs.prepush.destination}" failonerror="false" />
</target>
<!-- Set up Behat. -->
<target name="setup-behat" description="Generate the configuration file for Behat.">
<if>
<available file="${behat.yml.path}" type="file" property="behat.yml.available" />
<then>
<echo message="Deleting existing behat.yml configuration file" />
<delete file="${behat.yml.path}" failonerror="false" />
</then>
</if>
<echo message="Creating behat.yml configuration file" />
<loadfile property="behat.yml.content" file="${behat.yml.template}">
<filterchain>
<replacetokens>
<token key="behat.base_url" value="${behat.base_url}" />
<token key="behat.files.path" value="${behat.files.path}" />
<token key="website.drupal.dir" value="${website.drupal.dir}" />
<token key="behat.subcontexts.path" value="${behat.subcontexts.path}" />
<token key="behat.formatter.name" value="${behat.formatter.name}" />
</replacetokens>
</filterchain>
</loadfile>
<echo message="${behat.yml.content}" file="${behat.yml.path}" />
</target>
<!-- Set up PHPUnit. -->
<target name="setup-phpunit" description="Generate the configuration file for PHPUnit.">
<if>
<available file="${phpunit.config}" type="file" property="phpunit.config.available" />
<then>
<echo message="Deleting existing PHPUnit configuration file." />
<delete file="${phpunit.config}" failonerror="false" />
</then>
</if>
<phpunitconfiguration
configFile="${phpunit.config}"
distFile="${phpunit.dist}"
files="${phpunit.files}"
directories="${phpunit.directories}"
testsuiteName="${phpunit.testsuite.name}"
baseUrl="${phpunit.base_url}"
dbUrl="${phpunit.db_url}"
/>
</target>
<!-- Link the site root to the document root of the webserver. -->
<target
name="link-docroot"
description="Create a symlink from the site root to the webserver document root.">
<symlink link="${server.docroot}" target="${website.drupal.dir}" overwrite="true" />
</target>
<!-- Create demo users. -->
<target name="create-demo-users" description="Create demo users.">
<foreach list="${drupal.demo.users}" param="drupal.demo.user" target="create-demo-user" delimiter="," />
<!-- Create a user with only "authenticated user" role assigned. -->
<drush
command="user-create"
assume="yes"
root="${website.drupal.dir}"
bin="${drush.bin}"
verbose="${drush.verbose}">
<option name="mail" value="[email protected]"/>
<option name="password" value="user"/>
<param>user</param>
</drush>
</target>
<!-- Create a demo user. Subtarget of "create-demo-users". -->
<target name="create-demo-user">
<drush
command="user-create"
assume="yes"
root="${website.drupal.dir}"
bin="${drush.bin}"
verbose="${drush.verbose}">
<option name="mail" value="${drupal.demo.user}@example.com"/>
<option name="password" value="${drupal.demo.user}"/>
<param>${drupal.demo.user}</param>
</drush>
<drush
command="user-add-role"
assume="yes"
root="${website.drupal.dir}"
bin="${drush.bin}"
verbose="${drush.verbose}">
<option name="name" value="${drupal.demo.user}"/>
<param>${drupal.demo.user}</param>
</drush>
</target>
<!-- Set up development configuration, including on-screen error logging and debugging options. -->
<target name="enable-dev-settings">
<phingcall target="writable-settings-folder"/>
<!-- Copy settings file containing development values, but preserve any existing local settings. -->
<copy file="${website.settings.local.php.example}" tofile="${website.settings.local.php}" overwrite="false" />
<!-- Uncomment the inclusion of the local settings file in settings.php. -->
<phingcall target="writable-settings-php"/>
<reflexive>
<fileset dir="${website.settings.dir}">
<include pattern="settings.php" />
</fileset>
<filterchain>
<replaceregexp>
<regexp
pattern="^# (if \(file_exists\(__DIR__ \. '\/settings\.local\.php'\)\) \{\n)# ( include __DIR__ \. '\/settings\.local\.php';\n)# (\})"
replace="\1\2\3"
modifiers="m"
/>
</replaceregexp>
</filterchain>
</reflexive>
</target>
<!-- Enable development modules. -->
<target name="enable-dev-modules">
<foreach list="${drupal.modules.dev}" param="module" target="enable-module" delimiter=" " />
</target>
<!-- Enable a module. -->
<target name="enable-module">
<drush
command="pm-enable"
assume="yes"
root="${website.drupal.dir}"
bin="${drush.bin}"
verbose="${drush.verbose}">
<param>${module}</param>
</drush>
</target>
<!-- Install Composer dependencies for the build system. -->
<target name="install-composer-dependencies">
<composer command="install" composer="${composer.bin}">
<arg value="--working-dir=${project.basedir}" />
</composer>
</target>
<target
name="build-dev"
description="Build a development environment."
depends="install-composer-dependencies, setup-behat, setup-php-codesniffer, setup-phpunit" />
<target
name="setup-dev"
description="Set up 'development mode' for an installed website."
depends="enable-dev-settings, enable-dev-modules" />
<target
name="setup-acceptance"
description="Set up an acceptance environment."
depends="create-demo-users" />
<target
name="install-dev"
description="Install the website and set up the development environment."
depends="install, build-dev, setup-dev, create-demo-users" />
</project>