/[drupal]/contributions/modules/DAST/site-install.xml
ViewVC logotype

Contents of /contributions/modules/DAST/site-install.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.8 - (show annotations) (download) (as text)
Mon Mar 17 10:58:49 2008 UTC (20 months, 1 week ago) by allisterbeharry
Branch: MAIN
CVS Tags: DRUPAL-5--2-1, HEAD
Branch point for: DRUPAL-5--2
Changes since 1.7: +3 -1 lines
File MIME type: text/xml
Committed for 5.x-2.1 release.
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- <![CDATA[
3 $Id: site-install.xml,v 1.7 2007/12/07 23:41:12 allisterbeharry Exp $
4 ]]> -->
5
6 <!-- ==================================================================================================== -->
7 <!-- @file This is the base site-install task in DAST. It runs the Drupal web installer for the specified-->
8 <!-- locale and profile. Profiles can be fetched automatically from CVS. -->
9 <!-- after the build -->
10 <!-- @author Allister Beharry -->
11 <!-- @package org.drupal.dast.tasks -->
12 <!-- ==================================================================================================== -->
13
14 <project name="site-install" default="main">
15 <taskdef name="CreoleSQLExec" classname="phing.tasks.ext.CreoleSQLExecTask"/>
16 <taskdef name="CVS" classname="phing.tasks.system.CVSTask"/>
17 <taskdef name="warn" classname="phing.tasks.system.WarnTask"/>
18 <taskdef name="DumpProperties" classname="DumpPropertiesTask" />
19
20 <!-- =================================
21 target: set-db-url
22 ================================= -->
23 <target name="set-db-url" depends="configure" description="--> Points the $db_url variable in the site's settings.php file to the drupal.database.Url specified in the build">
24
25 <!--Make a backup of the settings file if it exists-->
26 <available file="${drupal.dir}${php.directory_separator}${drupal.settings.location}" property="drupal.settings.location.fileExists" />
27 <if><isset property="drupal.settings.location.fileExists" /><then>
28 <echo>Backing up existing ${drupal.dir}${php.directory_separator}${drupal.settings.location} file</echo>
29 <copy file="${drupal.dir}${php.directory_separator}${drupal.settings.location}" tofile="${drupal.dir}${php.directory_separator}${drupal.settings.location}.dast.bak" overwrite="true" />
30 </then>
31 </if>
32
33 <!--Copy the settings from source if specified -->
34 <if><isset property="drupal.settings.source" /> <then>
35 <copy file="${drupal.dir}${php.directory_separator}${drupal.settings.source}" tofile="${drupal.dir}${php.directory_separator}${drupal.settings.location}" overwrite="true" />
36 </then>
37 </if>
38
39 <!--Bailout if we can't find a settings.php-->
40 <available file="${drupal.dir}${php.directory_separator}${drupal.settings.location}" property="drupal.settings.location.fileExistsAgain" />
41 <if><not><isset property="drupal.settings.location.fileExistsAgain" /></not><then>
42 <fail>Could not find Drupal settings file ${drupal.settings.location}</fail>
43 </then>
44 </if>
45
46
47 <reflexive file="${drupal.dir}${php.directory_separator}${drupal.settings.location}">
48 <filterchain><replaceregexp>
49 <regexp pattern = "\$db_url = 'mysql:\/\/username:password\@localhost\/databasename';" replace="\$db_url = '${drupal.database.Url}';" ignoreCase="true"/>
50 </replaceregexp>
51 </filterchain>
52 </reflexive>
53
54 </target>
55
56
57 <!-- =================================
58 target: run-installer
59 ================================= -->
60 <target name="run-installer" depends="configure" description="--> Performs any token replacement on the specified profile profile and does a GET on drupal.url/index.php">
61 <!--Verify profile exists if not default-->
62 <if><not><equals arg1="${drupal.profile}" arg2="default"/></not><then>
63 <available file="${drupal.dir}${php.directory_separator}${drupal.profiles.path}${php.directory_separator}${drupal.profile}" type="dir" property="profileExists" />
64 <if><not><isset property="profileExists" /></not><then>
65 <fail> The profile ${drupal.dir}${php.directory_separator}${drupal.profiles.path}${php.directory_separator}${drupal.profile} could not be found.</fail>
66 </then>
67 </if>
68 </then>
69 </if>
70
71 <!--Create a files directory if it doesn't exist - new requirement for Drupal 5.3 + -->
72 <available file="${drupal.dir}${php.directory_separator}files" type="dir" property="filedirExists" />
73 <if><not><isset property="filedirExists" /></not><then>
74 <mkdir dir="${drupal.dir}${php.directory_separator}files" /></then>
75 </if>
76
77 <echo>Calling ${drupal.Url}install.php?profile=${drupal.profile}&amp;locale=${drupal.locale}</echo>
78 <exec command="wget &quot;${drupal.Url}install.php?profile=${drupal.profile}&amp;locale=${drupal.locale}&quot;"
79 Output="${build.log.defaultdir}${php.directory_separator}site-install-run-installer-output.log" Error="${build.log.defaultdir}${php.directory_separator}site-install-run-installer-error.log"
80 dir="${dast.tmp}${php.directory_separator}install" escape="false" passthru="false" checkreturn="false"/>
81 <!--chmod settings.php to be readonly after install-->
82 <Chmod Mode="0444" file="${drupal.dir}${php.directory_separator}${drupal.settings.location}" />
83 </target>
84
85
86 <!-- =================================
87 target: fetch-profile
88 ================================= -->
89 <target name="fetch-profile" depends="configure" description="--> Downloads a profile from CVS to be used by the installer.">
90 <echo>-------------------------------------------------</echo>
91 <echo> +++++ Running site-install.xml fetch-profile +++++ </echo>
92 <echo>-------------------------------------------------</echo>
93 <!--Check for required CVS properties-->
94 <if><not><isset property="drupal.profiles.Cvs.CvsRoot"/></not>
95 <then>
96 <fail>drupal.profiles.Cvs.CvsRoot property not set, check the properties files files for omissions or bad syntax</fail>
97 </then>
98 </if>
99 <if><not><isset property="drupal.profiles.Cvs.Command"/></not>
100 <then>
101 <fail>drupal.profiles.Cvs.Command property not set, check the properties files files for omissions or bad syntax</fail>
102 </then>
103 </if>
104 <if><not><isset property="drupal.profiles.Cvs.Revision"/></not>
105 <then>
106 <fail>drupal.profiles.Cvs.Revision property not set, check the properties files files for omissions or bad syntax</fail>
107 </then>
108 </if>
109 <if><not><isset property="drupal.profiles.Cvs.Path"/></not>
110 <then>
111 <fail>drupal.profiles.Cvs.Path property not set, check the properties files files for omissions or bad syntax</fail>
112 </then>
113 </if>
114
115 <!--Set optional CVS properties with defaults if they aren't set-->
116 <if><not><isset property="drupal.profiles.Cvs.Port"/></not>
117 <then>
118 <property name="drupal.profiles.Cvs.Port" value="2401"/>
119 <echo>drupal.profiles.Cvs.Port property not set, using default value 2401.</echo>
120 </then>
121 </if>
122 <if><not><isset property="drupal.profiles.Cvs.CompressionLevel"/></not>
123 <then>
124 <property name="drupal.profiles.Cvs.CompressionLevel" value="6"/>
125 <echo>drupal.profiles.Cvs.CompressionLevel property not set, using default value 6.</echo>
126 </then>
127 </if>
128 <if><not><isset property="drupal.profiles.Cvs.Quiet"/></not>
129 <then>
130 <property name="drupal.profiles.Cvs.Quiet" value="false"/>
131 <echo>drupal.profiles.Cvs.Quiet property not set, using default value false.</echo>
132 </then>
133 </if>
134 <if><not><isset property="drupal.profiles.Cvs.FailOnError"/></not>
135 <then>
136 <property name="drupal.profiles.Cvs.FailOnError" value="true"/>
137 <echo>drupal.profiles.Cvs.FailOnError property not set, using default value true.</echo>
138 </then>
139 </if>
140 <if><not><isset property="drupal.profiles.Cvs.Output"/></not>
141 <then>
142 <property name="drupal.profiles.Cvs.Output" value="${build.log.defaultdir}${php.directory_separator}site-fetch-cvs-profile-output.log"/>
143 <echo>drupal.profiles.Cvs.Output property not set, using default value ${build.log.defaultdir}${php.directory_separator}site-install-cvs-fetch-profile-output.log.</echo>
144 </then>
145 </if>
146 <if><not><isset property="drupal.profiles.Cvs.Error"/></not>
147 <then>
148 <property name="drupal.profiles.Cvs.Error" value="${build.log.defaultdir}${php.directory_separator}site-install-cvs-profile-error.log"/>
149 <echo>drupal.profiles.Cvs.Error property not set, using default value ${build.log.defaultdir}${php.directory_separator}site-install-cvs-fetch-profile-error.log.</echo>
150 </then>
151 </if>
152
153 <!--Run CVS operation-->
154 <echo>Executing CVS command to fetch profile ${drupal.profile}...see ${drupal.profiles.Cvs.Output} and ${drupal.profiles.Cvs.Error} for details when completed.</echo>
155 <CVS CvsRoot="${drupal.profiles.Cvs.CvsRoot}" Port="${drupal.profiles.Cvs.Port}" Command="${drupal.profiles.Cvs.Command}" CompressionLevel="${drupal.profiles.Cvs.CompressionLevel}"
156 Quiet="${drupal.profiles.Cvs.Quiet}" FailOnError="${drupal.profiles.Cvs.FailOnError}"
157 Module="${drupal.profile}" ModulePath="${drupal.profiles.Cvs.Path}" Tag="${drupal.profiles.Cvs.Revision}" Dest="${drupal.dir}${php.directory_separator}${drupal.profiles.path}"
158 Output="${drupal.profiles.Cvs.Output}-${drupal.profile}.log" Error="${drupal.profiles.Cvs.Error}-${drupal.profile}.log"/>
159 </target>
160
161
162 <!-- =================================
163 target: main
164 ================================= -->
165 <target name="main" depends="configure" description="--> Runs set-db-Url and run-installer in that sequence">
166 <phingcall target="set-db-url" />
167 <if><equals arg1="${drupal.profile.fetch}" arg2="yes" /><then>
168 <phingcall target="fetch-profile" />
169 </then>
170 </if>
171 <phingcall target="run-installer" />
172 </target>
173
174 <!-- =================================
175 target: configure
176 ================================= -->
177 <target name="configure" description="--> Configures the build with properties from properties file.">
178 <if><isset property="basePropertiesFile"/><then>
179 <available file="${project.basedir}${php.directory_separator}${basePropertiesFile}" property="basePropertiesFileExists"/>
180 <if><not><isset property="basePropertiesFileExists"/></not><then>
181 <fail>Could not find the specified base properties file ${project.basedir}${php.directory_separator}${basePropertiesFile}. Stopping.</fail>
182 </then>
183 <else>
184 <property name="build.basePropertiesFile" value="${project.basedir}${php.directory_separator}${basePropertiesFile}" />
185 <echo>Using ${build.basePropertiesFile} as base properties file.</echo>
186 </else>
187 </if>
188 </then>
189
190 <else> <!--Use default base properties file -->
191 <available file="${project.basedir}${php.directory_separator}drupalorg_testing-site-base.properties" property="basePropertiesFileExists"/>
192 <if><not><isset property="basePropertiesFileExists"/></not><then>
193 <warn>Could not find the default base properties file ${project.basedir}${php.directory_separator}drupalorg_testing-site-base.properties. Only the user properties file can be used.</warn>
194 </then>
195 <else>
196 <property name="build.basePropertiesFile" value="${project.basedir}${php.directory_separator}drupalorg_testing-site-base.properties" />
197 <echo>Using default base properties file ${build.basePropertiesFile}.</echo>
198 </else>
199 </if>
200 </else>
201 </if>
202
203 <if><isset property="propertiesFile"/><then>
204 <!--Use user properties from specified file -->
205 <available file="${project.basedir}${php.directory_separator}${propertiesFile}" property="propertiesFileExists"/>
206 <if><not><isset property="propertiesFileExists"/></not><then>
207 <fail>Could not find the specified user properties file ${project.basedir}${php.directory_separator}${propertiesFile}. Stopping.</fail>
208 </then>
209 <else>
210 <property name="build.propertiesFile" value="${project.basedir}${php.directory_separator}${propertiesFile}" />
211 <echo>Using ${build.propertiesFile} as user properties file.</echo>
212 </else>
213 </if>
214 </then>
215
216 <else> <!--Use default user properties file -->
217 <available file="${project.basedir}${php.directory_separator}drupalorg_testing-site.properties" property="propertiesFileExists"/>
218 <if><not><isset property="propertiesFileExists"/></not><then>
219 <warn>Could not find the default user properties file ${project.basedir}${php.directory_separator}drupalorg_testing-site.properties. Only the base properties file will be used.</warn>
220 </then>
221 <else>
222 <property name="build.propertiesFile" value="${project.basedir}${php.directory_separator}drupalorg_testing-site.properties" />
223 <echo>Using ${build.propertiesFile} as default user properties file.</echo>
224 </else>
225 </if>
226 </else>
227 </if>
228
229
230 <if><and><not><isset property="build.basePropertiesFile" /></not><not><isset property="build.propertiesFile" /></not></and><then>
231 <fail>Cannot use either the user or base properties files. Stopping </fail>
232 </then>
233 </if>
234
235 <if><isset property="build.basePropertiesFile" /><then>
236 <property file="${build.basePropertiesFile}" override="true"/>
237 </then>
238 <else><echo>No base properties file used.</echo></else>
239 </if>
240
241 <if><isset property="build.propertiesFile" /><then>
242 <if><equals arg1="${build.propertiesFile}" arg2="${dast.home}${php.directory_separator}drupalorg_testing-site.properties" /><then>
243 <if><and><isset property="build.basePropertiesFile" /><not><equals arg1="${build.basePropertiesFile}" arg2="${dast.home}${php.directory_separator}drupalorg_testing-site-base.properties" /></not></and><then>
244 <echo>The base properties file ${build.basePropertiesFile} is not the default so the default user properties file will not be loaded.</echo>
245 </then>
246 <else>
247 <property file="${build.propertiesFile}" override="true"/>
248 <echo>Using default user properties file ${dast.home}${php.directory_separator}drupalorg_testing-site.properties.</echo>
249 </else>
250 </if>
251 </then>
252 <else><property file="${build.propertiesFile}" override="true"/></else>
253 </if>
254 </then>
255 <else><echo>No user properties file used.</echo></else>
256 </if>
257
258 <if><not><isset property="build.log.defaultdir"/></not><then>
259 <fail>build.log.defaultdir property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
260 </then>
261 </if>
262 <available file="${build.log.defaultdir}" property="build.log.defaultdirExists"/>
263 <if><not><isset property="build.log.defaultdirExists"/></not><then>
264 <echo>${build.log.defaultdir} doesn't exist, attempting to create...</echo>
265 <mkdir dir="${build.log.defaultdir}"/>
266 </then>
267 </if>
268
269 <if>
270 <not><isset property="drupal.dir"/></not>
271 <then>
272 <fail>drupal.dir property not set, check the properties files for omissions or bad syntax</fail>
273 </then>
274 </if>
275
276 <if>
277 <not><isset property="drupal.Url"/></not>
278 <then>
279 <fail>drupal.Url property not set, check the properties files for omissions or bad syntax</fail>
280 </then>
281 </if>
282
283 <if>
284 <not><isset property="drupal.locale"/></not>
285 <then>
286 <fail>drupal.locale property not set, check the properties files for omissions or bad syntax</fail>
287 </then>
288 </if>
289
290 <if>
291 <not><isset property="drupal.profile"/></not>
292 <then>
293 <fail>drupal.profile property not set, check the properties files for omissions or bad syntax</fail>
294 </then>
295 </if>
296
297 <if><not><isset property="drupal.profile.fetch"/></not><then>
298 <fail>drupal.profile.fetch property not set, check the properties files for omissions or bad syntax</fail>
299 </then>
300 </if>
301
302 <if>
303 <not><isset property="drupal.settings.location"/></not>
304 <then>
305 <fail>drupal.settings.location property not set, check the properties files for omissions or bad syntax</fail>
306 </then>
307 </if>
308
309 <if>
310 <not><isset property="drupal.database.Url"/></not>
311 <then>
312 <fail>drupal.database.Url property not set, check the properties files for omissions or bad syntax</fail>
313 </then>
314 </if>
315
316 <!--Get the root of the dir specified - this will be used as the working directory for the drupal module -->
317 <php expression = "realpath('${drupal.dir}/../')" returnProperty="drupal.dir.root" />
318 <!--local dir passed as -d option to CVS -->
319 <php expression = "basename('${drupal.dir}')" returnProperty="drupal.dir.basename" />
320
321 <!--
322 <if>
323 <not><isset property="drupal.profile.replace_tokens"/></not>
324 <then>
325 <fail>drupal.profile.replace_tokens not set, check the properties files for omissions or bad syntax</fail>
326 <if><not><isset property="drupal.profile.tokenizer_script"/></not><then><fail>drupal.profile.tokenizer_script not set, check the properties files for omissions or bad syntax</fail></then></if>
327 <if><not><isset property="drupal.profile.token_properties_file"/></not><then><fail>drupal.profile.token_properties_file not set, check the properties files for omissions or bad syntax</fail></then></if>
328 </then>
329 </if>
330 -->
331 </target>
332
333 <!-- =================================
334 target: dump-config
335 ================================= -->
336 <target name="dump-config" depends="configure" description="--> Dumps all the current properties configuring the build to the screen.">
337 <DumpProperties />
338 </target>
339
340 </project>

  ViewVC Help
Powered by ViewVC 1.1.2