forked from acquia/blt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblt.xml
125 lines (107 loc) · 8 KB
/
blt.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
<project name="blt" default="update">
<target name="create-project" hidden="true">
<exec dir="${repo.root}" command="git init" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
<!-- Write BLT version to blt/.schema-version. -->
<exec dir="${repo.root}" command="echo ${blt.version} > ${blt.config-files.schema-version}" checkreturn="true" logoutput="true" passthru="false" level="${blt.exec_level}"/>
<!-- Remove files leftover from acquia/blt-project. -->
<delete failonerror="false">
<fileset dir="${repo.root}">
<include name=".travis.yml"/>
<include name="LICENSE.txt"/>
<include name="README.md"/>
</fileset>
</delete>
<!-- Pull in initial template files. -->
<exec dir="${repo.root}" command="blt blt:rsync-template" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
<exec dir="${repo.root}" command="blt blt:update-composer" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
<!--Write project.machine_name to project.yml, using name of working directory as value.. -->
<exec dir="${repo.root}" command="result=${PWD##*/}; printf '%s\n' "${PWD##*/}"" logoutput="false" checkreturn="true" level="${blt.exec_level}" passthru="false" outputProperty="dirname"/>
<exec dir="${repo.root}" command="${composer.bin}/yaml-cli update:value ${blt.config-files.project} project.machine_name '${dirname}'" logoutput="true" checkreturn="false" level="${blt.exec_level}" passthru="true"/>
<!-- Remove default git remote -->
<exec dir="${repo.root}" command="${composer.bin}/yaml-cli update:value ${blt.config-files.project} git.remotes.0 ''" logoutput="true" checkreturn="false" level="${blt.exec_level}" passthru="true"/>
<echo>Updating composer dependencies, this make take a while...</echo>
<exec dir="${repo.root}" command="composer update --no-interaction" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
<copy file="${repo.root}/docroot/profiles/contrib/lightning/lightning.extend.yml" tofile="${repo.root}/docroot/sites/default/lightning.extend.yml"/>
<exec dir="${repo.root}" command="git add -A" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
<exec dir="${repo.root}" command="git commit -m 'Initial commit.'" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
<exec dir="${repo.root}" command="cat ${blt.root}/scripts/blt/ascii-art.txt" logoutput="true" passthru="true" checkreturn="false"/>
</target>
<target name="doctor" description="Inspects your local blt configuration for possible issues.">
<drush command="status" returnProperty="drush.return" haltonerror="false" passthru="false" verbose="false" logoutput="false">
<option name="include">../vendor/acquia/blt/drush</option>
</drush>
<if>
<equals arg1="${drush.return}" arg2="0"/>
<then>
<drush command="blt-doctor" verbose="false" dir="${docroot}" uri="">
<option name="include">../vendor/acquia/blt/drush</option>
</drush>
</then>
<else>
<drush command="blt-doctor" verbose="false" dir="${docroot}" alias="" uri="">
<option name="include">../vendor/acquia/blt/drush</option>
</drush>
</else>
</if>
</target>
<target name="blt:rsync-template" hidden="true">
<echo>Copying files from BLT's template into your project...</echo>
<exec dir="${repo.root}" command="rsync -a --no-g ${blt.root}/template/ ${repo.root}/ --exclude-from=${blt.update.ignore-existing-file}" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
<!--Rsync files without overwriting existing-->
<exec dir="${repo.root}" command="rsync -a --no-g ${blt.root}/template/ ${repo.root}/ --include-from=${blt.update.ignore-existing-file} --ignore-existing" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
</target>
<target name="update" depends="blt:rsync-template, blt:update-composer, blt:update-yml, blt:update-delta, cleanup" hidden="true">
<phingcall target="install-alias">
<property name="create_alias" value="true"/>
</phingcall>
</target>
<target name="blt:update-delta" description="Performs scripted updates for a specific BLT version delta." hidden="true">
<echo>Executing scripted updates for version delta ${blt.schema-version} -> ${blt.version}...</echo>
<exec dir="${repo.root}" command="${repo.root}/vendor/bin/blt-console blt:update ${blt.schema-version} ${blt.version} ${repo.root} --yes" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
<exec dir="${repo.root}" command="echo ${blt.version} > ${blt.config-files.schema-version}" checkreturn="true" logoutput="true" passthru="false" level="${blt.exec_level}"/>
</target>
<target name="blt:update-composer" description="Updates project composer.json with a subset of new key value pairs from upstream. This WILL overwrite existing values." hidden="true">
<echo level="verbose">Merging BLT's composer.json template with your project's composer.json.</echo>
<echo level="verbose">This MAY overwrite some existing values.</echo>
<exec dir="${repo.root}" command="${repo.root}/vendor/bin/blt-console composer:munge ${repo.root}/composer.json ${blt.root}/template/composer.json > ${repo.root}/composer.json.tmp" logoutput="true" checkreturn="true" level="${blt.exec_level}" returnProperty="composer.munge.return"/>
<if>
<equals arg1="${composer.munge.return}" arg2="0"/>
<then>
<!--@todo Find out why can't we just redirect output directly back to composer.json. -->
<exec dir="${repo.root}" command="mv ${repo.root}/composer.json.tmp ${repo.root}/composer.json" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
</then>
</if>
</target>
<target name="blt:update-yml" description="Updates project BLT .yml files with new key value pairs from upstream. This WILL NOT overwrite existing values." hidden="true">
<!--@todo Output different message if project.yml does not exist-->
<echo level="verbose">Merging BLT's project.yml template with your project's project.yml.</echo>
<echo level="verbose">This WILL NOT overwrite existing values.</echo>
<!--Values in the project's existing project.yml file will be preserved and not overridden.-->
<exec dir="${repo.root}" command="${repo.root}/vendor/bin/blt-console yaml:munge ${blt.root}/template/blt/project.yml ${blt.config-files.project} > ${blt.config-files.project}.tmp" logoutput="true" checkreturn="true" level="${blt.exec_level}"/>
<!--@todo Find out why can't we just redirect output directly back to project.yml. -->
<exec dir="${repo.root}" command="mv ${blt.config-files.project}.tmp ${blt.config-files.project}" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true"/>
<echo>${blt.config-files.project} was modified.</echo>
</target>
<target name="cleanup" description="Removes deprecated BLT files and directories.">
<exec dir="${repo.root}" command="${blt.root}/scripts/blt/remove-deprecated.sh" logoutput="true" checkreturn="true" level="${blt.exec_level}" passthru="true" />
</target>
<target name="version" description="Display the currently installed version of BLT.">
<echo>BLT version is ${blt.version}</echo>
</target>
<target name="install-alias" description="Installs the BLT alias for command line usage." hidden="true">
<if>
<not><equals arg1="${create_alias}" arg2="false"/></not>
<then>
<if>
<equals arg1="${create_alias}" arg2="true"/>
<then>
<exec dir="${blt.root}/scripts/blt" command="./install-alias.sh -y" logoutput="true" level="${blt.exec_level}" passthru="true"/>
</then>
<else>
<exec dir="${blt.root}/scripts/blt" command="./install-alias.sh" logoutput="true" level="${blt.exec_level}" passthru="true"/>
</else>
</if>
</then>
</if>
</target>
</project>