|
1 | 1 | <!--
|
2 | 2 | name: build.xml
|
3 |
| - description: The main project build file for phing operations. This file can |
| 3 | + description: The main project build file for phing operations. This file can |
4 | 4 | be overridden with project specific configuration.
|
5 | 5 | -->
|
6 | 6 |
|
7 | 7 | <project name="vd8" default="prepare" phingVersion="2.4.11">
|
8 | 8 |
|
9 |
| - <!-- We set this to optional as is managed by composer --> |
10 |
| - <includepath classpath="vendor/nickschuch/drupal-install" /> |
11 |
| - <import file="vendor/nickschuch/drupal-install/build.xml" optional="true" /> |
12 |
| - |
13 | 9 | <!-- -->
|
14 | 10 | <!-- Properties -->
|
15 | 11 | <!-- ============= -->
|
16 | 12 |
|
17 |
| - <property name="app.uri" value="http://d8.dev" /> |
18 |
| - <property name="app.installUrl" value="core/install.php" /> |
19 |
| - |
20 |
| - <!-- User details. --> |
21 |
| - <property name="app.email" value="user@example.com" /> |
22 |
| - <property name="app.username" value="admin" /> |
23 |
| - <property name="app.password" value="password" /> |
24 |
| - |
25 |
| - <!-- Database options --> |
26 |
| - <property name="app.databaseHost" value="d8.dev" /> |
27 |
| - <property name="app.databasePort" value="3306" /> |
28 |
| - <property name="app.database" value="d8" /> |
29 |
| - <property name="app.databaseUser" value="d8" /> |
30 |
| - <property name="app.databasePass" value="d8" /> |
| 13 | + <!-- Drupal --> |
| 14 | + <property name="drupal.siteName" value="Drupal8" /> |
| 15 | + <property name="drupal.email" value="user@example.com" /> |
| 16 | + <property name="drupal.user" value="admin" /> |
| 17 | + <property name="drupal.pass" value="password" /> |
| 18 | + <property name="drupal.dir" value="${project.basedir}/app" /> |
| 19 | + |
| 20 | + <!-- Mysql --> |
| 21 | + <property name="mysql.host" value="d8.dev" /> |
| 22 | + <property name="mysql.port" value="3306" /> |
| 23 | + <property name="mysql.database" value="d8" /> |
| 24 | + <property name="mysql.user" value="d8" /> |
| 25 | + <property name="mysql.pass" value="d8" /> |
| 26 | + <property name="mysql.queryString" value="mysql://${mysql.user}:${mysql.pass}@${mysql.host}/${mysql.database}" /> |
| 27 | + |
| 28 | + <!-- Drush --> |
| 29 | + <property name="drush.cmd" value="bin/drush -r ${drupal.dir}" /> |
| 30 | + |
| 31 | + <!-- Vagrant --> |
| 32 | + <property name="vagrant.dir" value="/vagrant" /> |
| 33 | + |
| 34 | + <!-- Globals for exec commands. The main goal of these were for fast failingin the bot. --> |
| 35 | + <property name="test.output" value="true" /> |
| 36 | + <property name="test.passthru" value="true" /> |
31 | 37 |
|
32 | 38 | <!-- Provide overrides. -->
|
33 | 39 | <property file="build.properties" override="true" />
|
34 | 40 |
|
35 |
| - <!-- Build MySQL connection string using properties --> |
36 |
| - <property name="app.mysql_connect" value="mysql -u${app.databaseUser} -p${app.databasePass} -h${app.databaseHost} -P${app.databasePort}" /> |
37 |
| - |
38 |
| - <!-- --> |
39 |
| - <!-- Basic targets --> |
40 |
| - <!-- ============= --> |
| 41 | + <!-- --> |
| 42 | + <!-- Targets --> |
| 43 | + <!-- ======= --> |
41 | 44 |
|
| 45 | + <!-- Prepare the project --> |
42 | 46 | <target name="prepare"
|
43 | 47 | description="Prepare for build">
|
44 |
| - <exec command="composer install" /> |
| 48 | + <exec command="composer install --prefer-dist" |
| 49 | + logoutput="${test.output}" |
| 50 | + passthru="${test.passthru}" /> |
45 | 51 | </target>
|
46 | 52 |
|
47 |
| - <!-- --> |
48 |
| - <!-- Custom targets --> |
49 |
| - <!-- ============== --> |
| 53 | + <!-- Runs a command in the Vagrant host --> |
| 54 | + <target name="vagrant:run" |
| 55 | + if="drush.cmd" |
| 56 | + description="Run a command in the vagrant host."> |
| 57 | + <exec command="vagrant ssh -c '${vagrant.cmd}'" |
| 58 | + logoutput="${test.output}" |
| 59 | + passthru="${test.passthru}" /> |
| 60 | + </target> |
50 | 61 |
|
| 62 | + <!-- Reinstall the Drupal 8 site. --> |
51 | 63 | <target name="reinstall"
|
| 64 | + depends="prepare" |
52 | 65 | description="Reinstall the Drupal 8 site.">
|
53 |
| - <property name="app.default_site" value="${project.basedir}/app/sites/default" /> |
54 |
| - |
55 | 66 | <!-- Drop and create the database -->
|
56 |
| - <exec command="${app.mysql_connect} -e 'DROP DATABASE ${app.database}'" /> |
57 |
| - <exec command="${app.mysql_connect} -e 'CREATE DATABASE ${app.database}'" /> |
| 67 | + <exec command="${drush.cmd} sql-drop -y" |
| 68 | + logoutput="${test.output}" |
| 69 | + passthru="${test.passthru}"/> |
58 | 70 |
|
59 | 71 | <!-- Ensure the files directory is clean -->
|
60 |
| - <exec command="sudo rm -fR ${app.default_site}/files/*" /> |
| 72 | + <exec command="sudo rm -fR ${drupal.dir}/sites/default/files/*" |
| 73 | + logoutput="${test.output}" |
| 74 | + passthru="${test.passthru}" /> |
61 | 75 |
|
62 | 76 | <!-- Ensure we have a fresh settings.php with correct permissions -->
|
63 |
| - <exec command="sudo scp ${app.default_site}/default.settings.php ${app.default_site}/settings.php" /> |
64 |
| - <exec command="sudo chmod 777 ${app.default_site}/settings.php" /> |
| 77 | + <exec command="sudo scp ${drupal.dir}/sites/default/default.settings.php ${drupal.dir}/sites/default/settings.php" |
| 78 | + logoutput="${test.output}" |
| 79 | + passthru="${test.passthru}" /> |
| 80 | + <exec command="sudo chmod 777 ${drupal.dir}/sites/default/settings.php" |
| 81 | + logoutput="${test.output}" |
| 82 | + passthru="${test.passthru}" /> |
65 | 83 |
|
66 |
| - <!-- Install the site and simpletest module using Mink --> |
| 84 | + <!-- Install the site and simpletest --> |
67 | 85 | <phingcall target="install" />
|
68 |
| - <phingcall target="enable:simpletest" /> |
| 86 | + <phingcall target="simpletest:enable" /> |
| 87 | + </target> |
| 88 | + |
| 89 | + <!-- Install the Drupal 8 site. --> |
| 90 | + <target name="install" |
| 91 | + description="Install the Drupal 8 site."> |
| 92 | + <phingcall target="vagrant:run"> |
| 93 | + <!-- After some properties for inside the Vagrant host. --> |
| 94 | + <property name="vagrant.cmd" value="cd ${vagrant.dir}; bin/drush -r ${vagrant.dir}/app site-install -y --db-url=${mysql.queryString} --account-mail=${drupal.email} --account-name=${drupal.user} --account-pass=${drupal.pass} --site-name=${drupal.siteName}" /> |
| 95 | + </phingcall> |
| 96 | + </target> |
| 97 | + |
| 98 | + <!-- Enable Simpletest module --> |
| 99 | + <target name="simpletest:enable" |
| 100 | + description="Enable the Testing module."> |
| 101 | + <phingcall target="vagrant:run"> |
| 102 | + <!-- After some properties for inside the Vagrant host. --> |
| 103 | + <property name="vagrant.cmd" value="cd ${vagrant.dir}; bin/drush -r ${vagrant.dir}/app en -y simpletest" /> |
| 104 | + </phingcall> |
69 | 105 | </target>
|
70 | 106 |
|
71 | 107 | </project>
|
0 commit comments