-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
168 lines (146 loc) · 6.63 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Symfony2 project" default="hello">
<target name="hello">
<echo message="No Default Target set."/>
</target>
<!-- Target that install the symfony2 app -->
<target name="install" depends="vendors">
<echo message="Installed Symfony2 project in ${basedir}"/>
</target>
<!-- Target that deploys a installed symfony2 app -->
<target name="deploy" depends="warmup-cache, doctrine-schema, doctrine-cache, permissions">
<echo message="Deployed Symfony2 project in ${basedir}"/>
</target>
<!-- Rebuilds the database with fixtures -->
<target name="rebuild-database" depends="warmup-cache, database-clear, doctrine-schema, doctrine-cache, database-fixtures-load">
<echo message="Database rebuilded and fixtures loaded"/>
</target>
<target name="make-app-dev-public" description="Remove the ip check from app_dev.php">
<echo message="Remove the ip check from app_dev.php"/>
<exec executable="sed" failonerror="true">
<arg line="-i 's/header(/\/\/header(/i' web/app_dev.php"/>
</exec>
<exec executable="sed" failonerror="true">
<arg line="-i 's/exit(/\/\/exit(/i' web/app_dev.php"/>
</exec>
</target>
<!-- Set folder permissions -->
<target name="permissions">
<echo message="Set Cache folder permissions"/>
<chmod file="${basedir}/app/cache/**" perm="777" type="both"/>
<echo message="Set Logs folder permissions"/>
<chmod file="${basedir}/app/logs/**" perm="777" type="both"/>
<echo message="Set Upload folder permissions"/>
<chmod file="${basedir}/web/uploads/**" perm="777" type="both"/>
</target>
<!-- Checks that parameters.ini File exists -->
<target name="check-parameters" description="Checks if parameters.ini exists">
<echo message="Check if Config file app/config/parameters.yml exists"/>
<available file="${basedir}/app/config/parameters.yml" property="parameters.exist"/>
<fail unless="parameters.exist"
message="Create a 'app/config/parameters.yml' file for your system from the template 'app/config/parameters.yml.dist'"/>
</target>
<!-- Updates symfony2 vendors -->
<target name="vendors-update" description="Updating Symfony2 vendors">
<exec executable="php" failonerror="true">
<arg line="composer.phar update"/>
</exec>
</target>
<target name="vendors" description="Installing Symfony2 vendors">
<exec executable="php" failonerror="true">
<arg line="composer.phar install --prefer-dist"/>
</exec>
</target>
<target name="vendors-dev" description="Installing Symfony2 vendors (dev)">
<exec executable="php" failonerror="true">
<arg line="composer.phar install --prefer-dist --dev"/>
</exec>
</target>
<!-- Updates doctrine schema -->
<target name="doctrine-schema" description="Update doctrine schema">
<exec executable="php" failonerror="true">
<arg line="${basedir}/app/console doctrine:schema:update --force"/>
</exec>
</target>
<!-- Clear doctrine caches -->
<target name="doctrine-cache" description="Clear doctrine caches">
<exec executable="php">
<arg line="${basedir}/app/console doctrine:cache:clear-metadata"/>
</exec>
<exec executable="php">
<arg line="${basedir}/app/console doctrine:cache:clear-query"/>
</exec>
<exec executable="php">
<arg line="${basedir}/app/console doctrine:cache:clear-result"/>
</exec>
</target>
<!-- Deletes cache -->
<target name="clear-cache" description="Cleanup cache">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="app/cache/dev"/>
</delete>
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="app/cache/prod"/>
</delete>
<echo message="Symfony cache cleared"/>
</target>
<target name="clear-cache_OLD" description="Cleanup cache">
<exec executable="php">
<arg line="${basedir}/app/console cache:clear --env=dev --no-warmup"/>
</exec>
<exec executable="php">
<arg line="${basedir}/app/console cache:clear --env=prod --no-warmup"/>
</exec>
<exec executable="php">
<arg line="${basedir}/app/console cache:clear --env=test --no-warmup"/>
</exec>
<echo message="Symfony cache cleared"/>
</target>
<target name="clean" depends="clear-cache_OLD">
<echo file="./app/logs/dev.log"/>
<echo file="./app/logs/prod.log"/>
<echo file="./app/logs/test.log"/>
</target>
<!-- Warmes up cache -->
<target name="warmup-cache" description="Cleanup cache">
<exec executable="php">
<arg line="${basedir}/app/console cache:clear --env=dev"/>
</exec>
<exec executable="php">
<arg line="${basedir}/app/console cache:clear --env=prod"/>
</exec>
<echo message="Symfony cache warmed up"/>
</target>
<!-- Dumps assets -->
<target name="assetic" description="Dumping assets">
<exec executable="${basedir}/app/console" failonerror="true">
<arg value="--env=prod"/>
<arg value="assetic:dump"/>
</exec>
</target>
<!-- installs assets -->
<target name="assets" description="Installing assets">
<exec executable="${basedir}/app/console" failonerror="true">
<arg value="assets:install"/>
<!--<arg value="--symlink"/>-->
<arg value="${basedir}/web"/>
</exec>
</target>
<!-- Clears the database -->
<target name="database-clear" description="Clears database">
<exec executable="php" failonerror="true">
<arg line="${basedir}/app/console doctrine:schema:drop --force"/>
</exec>
<echo message="Cleared database"/>
</target>
<target name="database-fixtures-load" description="Load database fixtures">
<exec executable="php" failonerror="true">
<!--<arg line="${basedir}/app/console doctrine:fixtures:load --no-interaction"/>-->
<arg line="${basedir}/app/console h4cc_alice_fixtures:load:sets src/Loki/CharacterBundle/DataFixtures/ORM/LoadFixtures.php"/>
</exec>
<echo message="Fixtures loaded"/>
</target>
<target name="build" description="Builds Database, laods Fixtures, and installs Assets" depends="rebuild-database, assets">
<echo message="Database built, fixtures loaded, assets installed"/>
</target>
</project>