|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
2 | 2 | <project name="Laravel Project" default="welcome" basedir="../" description="Laravel Project Build Targets">
|
3 | 3 |
|
4 |
| - <property name="reserved.env.name" value="testing" /> |
| 4 | + <property name="reserved.env_name" value="testing" /> |
5 | 5 |
|
| 6 | + <property name="env_name" value="" /> |
| 7 | + |
6 | 8 | <target name="welcome">
|
7 | 9 | <echo message="==================================================" />
|
8 | 10 | <echo message="Hello, welcome to ${phing.project.name} build script!" />
|
|
21 | 23 | <echo message="Hit enter to accept defaults." />
|
22 | 24 | <echo message="Please make sure your local app is up to date first." level="warning" />
|
23 | 25 | <echo message="==================================================" />
|
24 |
| - |
25 |
| - <propertyprompt |
26 |
| - propertyName="env.name" |
27 |
| - promptText="What is your Laravel environment name?" |
28 |
| - defaultValue="local" |
29 |
| - /> |
| 26 | + |
| 27 | + <if> |
| 28 | + <isfalse value="${env_name}"/> |
| 29 | + <then> |
| 30 | + <propertyprompt |
| 31 | + propertyName="env_name" |
| 32 | + promptText="What is your Laravel environment name?" |
| 33 | + defaultValue="local" |
| 34 | + /> |
| 35 | + </then> |
| 36 | + </if> |
30 | 37 |
|
31 | 38 | <if>
|
32 |
| - <isfalse value="${env.name}"/> |
| 39 | + <isfalse value="${env_name}"/> |
33 | 40 | <then>
|
34 | 41 | <fail message="Invalid environment name!" />
|
35 | 42 | </then>
|
36 | 43 | <elseif>
|
37 |
| - <equals arg1="${env.name}" arg2="${reserved.env.name}" /> |
| 44 | + <equals arg1="${env_name}" arg2="${reserved.env_name}" /> |
38 | 45 | <then>
|
39 |
| - <fail message="Environment name cannot be '${reserved.env.name}'" /> |
| 46 | + <fail message="Environment name cannot be '${reserved.env_name}'" /> |
40 | 47 | </then>
|
41 | 48 | </elseif>
|
42 | 49 | </if>
|
43 | 50 |
|
44 | 51 | <if>
|
45 |
| - <available file='app/config/${env.name}' type='dir' /> |
| 52 | + <available file='app/config/${env_name}' type='dir' /> |
46 | 53 | <then>
|
47 | 54 | <!-- do nothing -->
|
48 | 55 | <echo message="Environment found.." />
|
49 | 56 | </then>
|
50 | 57 | <else>
|
51 |
| - <fail message="Environment 'app/config/${env.name}' doesn't exist." /> |
| 58 | + <fail message="Environment 'app/config/${env_name}' doesn't exist." /> |
52 | 59 | </else>
|
53 | 60 | </if>
|
54 | 61 |
|
|
63 | 70 | <!-- migrations -->
|
64 | 71 | <echo message="Running migrations..." />
|
65 | 72 | <exec
|
66 |
| - command="php artisan migrate --env=${env.name}" |
| 73 | + command="php artisan migrate --env=${env_name}" |
67 | 74 | passthru="true"
|
68 | 75 | />
|
69 | 76 | <exec
|
70 |
| - command="php artisan kevbaldwyn:migrate-packages --env=${env.name}" |
| 77 | + command="php artisan kevbaldwyn:migrate-packages --env=${env_name}" |
71 | 78 | passthru="true"
|
72 | 79 | />
|
73 | 80 | <echo message="Done." />
|
|
85 | 92 | <echo message="==================================================" />
|
86 | 93 |
|
87 | 94 | <propertyprompt
|
88 |
| - propertyName="env.name" |
89 |
| - promptText="What is your Laravel environment name. This will create the directory 'app/config/[your-environment-name]' - do not use '${reserved.env.name}'" |
| 95 | + propertyName="env_name" |
| 96 | + promptText="What is your Laravel environment name. This will create the directory 'app/config/[your-environment-name]' - do not use '${reserved.env_name}'" |
90 | 97 | defaultValue="local"
|
91 | 98 | />
|
92 | 99 |
|
93 | 100 | <if>
|
94 |
| - <isfalse value="${env.name}"/> |
| 101 | + <isfalse value="${env_name}"/> |
95 | 102 | <then>
|
96 | 103 | <fail message="Invalid environment name!" />
|
97 | 104 | </then>
|
98 | 105 | <elseif>
|
99 |
| - <equals arg1="${env.name}" arg2="${reserved.env.name}" /> |
| 106 | + <equals arg1="${env_name}" arg2="${reserved.env_name}" /> |
100 | 107 | <then>
|
101 |
| - <fail message="Environment name cannot be '${reserved.env.name}'" /> |
| 108 | + <fail message="Environment name cannot be '${reserved.env_name}'" /> |
102 | 109 | </then>
|
103 | 110 | </elseif>
|
104 | 111 | <elseif>
|
105 |
| - <available file='app/config/${env.name}' type='dir' /> |
| 112 | + <available file='app/config/${env_name}' type='dir' /> |
106 | 113 | <then>
|
107 |
| - <fail message="The environment 'app/config/${env.name}' already exists." /> |
| 114 | + <fail message="The environment 'app/config/${env_name}' already exists." /> |
108 | 115 | </then>
|
109 | 116 | </elseif>
|
110 | 117 | </if>
|
111 | 118 |
|
112 | 119 | <propertyprompt
|
113 |
| - propertyName="env.host" |
| 120 | + propertyName="env_host" |
114 | 121 | promptText="The environment host name of the site, ie 'dev.mylocalserver.local', 'localhost', or 'www.example.com'"
|
115 | 122 | />
|
116 | 123 |
|
117 | 124 | <if>
|
118 |
| - <isfalse value="${env.host}"/> |
| 125 | + <isfalse value="${env_host}"/> |
119 | 126 | <then>
|
120 | 127 | <fail message="Invalid environment host name!" />
|
121 | 128 | </then>
|
|
166 | 173 |
|
167 | 174 | <!-- configure db -->
|
168 | 175 | <echo message="Configuring db..." />
|
169 |
| - <mkdir dir="app/config/${env.name}" /> |
| 176 | + <mkdir dir="app/config/${env_name}" /> |
170 | 177 | <if>
|
171 |
| - <available file='app/config/${env.name}/database.php' type='file' /> |
| 178 | + <available file='app/config/${env_name}/database.php' type='file' /> |
172 | 179 | <then>
|
173 |
| - <delete file="app/config/${env.name}/database.php" failonerror="false" /> |
| 180 | + <delete file="app/config/${env_name}/database.php" failonerror="false" /> |
174 | 181 | </then>
|
175 | 182 | </if>
|
176 |
| - <copy file="build/database.txt" tofile="app/config/${env.name}/database.php" overwrite="true"> |
| 183 | + <copy file="build/database.txt" tofile="app/config/${env_name}/database.php" overwrite="true"> |
177 | 184 | <filterchain>
|
178 | 185 | <replaceregexp>
|
179 | 186 | <regexp pattern="#DB_HOST#" replace="${db.host}" ignoreCase="false" />
|
|
184 | 191 | </filterchain>
|
185 | 192 | </copy>
|
186 | 193 | <if>
|
187 |
| - <available file='app/config/${env.name}/app.php' type='file' /> |
| 194 | + <available file='app/config/${env_name}/app.php' type='file' /> |
188 | 195 | <then>
|
189 |
| - <delete file="app/config/${env.name}/app.php" failonerror="false" /> |
| 196 | + <delete file="app/config/${env_name}/app.php" failonerror="false" /> |
190 | 197 | </then>
|
191 | 198 | </if>
|
192 |
| - <copy file="build/app.txt" tofile="app/config/${env.name}/app.php" overwrite="true"> |
| 199 | + <copy file="build/app.txt" tofile="app/config/${env_name}/app.php" overwrite="true"> |
193 | 200 | <filterchain>
|
194 | 201 | <replaceregexp>
|
195 |
| - <regexp pattern="#HOST#" replace="${env.host}" ignoreCase="false" /> |
| 202 | + <regexp pattern="#HOST#" replace="${env_host}" ignoreCase="false" /> |
196 | 203 | </replaceregexp>
|
197 | 204 | </filterchain>
|
198 | 205 | </copy>
|
|
208 | 215 | <copy file="bootstrap/start.php" tofile="bootstrap/start-tmp.php" overwrite="true">
|
209 | 216 | <filterchain>
|
210 | 217 | <replaceregexp>
|
211 |
| - <regexp pattern="detectEnvironment\(array\(" replace="detectEnvironment(array(${line.separator}${line.separator} '${env.name}' => array('${env.host}')," /> |
| 218 | + <regexp pattern="detectEnvironment\(array\(" replace="detectEnvironment(array(${line.separator}${line.separator} '${env_name}' => array('${env_host}')," /> |
212 | 219 | </replaceregexp>
|
213 | 220 | </filterchain>
|
214 | 221 | </copy>
|
|
219 | 226 |
|
220 | 227 |
|
221 | 228 | <!-- amend .gitignore -->
|
222 |
| - <append destFile=".gitignore" text="${line.separator}app/config/${env.name}" /> |
| 229 | + <append destFile=".gitignore" text="${line.separator}app/config/${env_name}" /> |
223 | 230 |
|
224 | 231 | <!-- composer -->
|
225 | 232 | <echo message="Checking packages..." />
|
|
232 | 239 | <!-- migrations -->
|
233 | 240 | <echo message="Running db migrations..." />
|
234 | 241 | <exec
|
235 |
| - command="php artisan migrate ${db.seedflag}--env=${env.name}" |
| 242 | + command="php artisan migrate ${db.seedflag}--env=${env_name}" |
236 | 243 | passthru="true"
|
237 | 244 | />
|
238 | 245 | <exec
|
239 |
| - command="php artisan kevbaldwyn:migrate-packages --env=${env.name}" |
| 246 | + command="php artisan kevbaldwyn:migrate-packages --env=${env_name}" |
240 | 247 | passthru="true"
|
241 | 248 | />
|
242 | 249 | <echo message="Done." />
|
|
0 commit comments