-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.xml
95 lines (73 loc) · 3.48 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="phpguide" default="main">
<!-- ============================================ -->
<!-- Target: main, the all stuf -->
<!-- ============================================ -->
<target name="main" depends="finish"> </target>
<target name="gitupdate" >
<echo msg="cleaning existing repo" />
<exec command="rm -rf /home/phpgTempGitClone" />
<exec command="mkdir /home/phpgTempGitClone" />
<echo msg="Cloning git repo" />
<exec command="git clone git://github.com/intval/phpguide.git /home/phpgTempGitClone" />
<echo msg="Repo cloned" />
<echo msg="Removing .git dir from clone" />
<exec command="rm -rf /home/phpgTempGitClone/.git" />
</target>
<target name="cleanPrevBuild" depends="gitupdate">
<delete includeemptydirs="true">
<fileset dir="/home/www/phpguide">
<exclude name="protected/config/dbconnection.php" />
<exclude name="protected/config/services.php" />
<exclude name="protected/config/config.php" />
<exclude name="protected/runtime/state.bin" />
<exclude name="protected/yiic*" />
<exclude name="build.xml" />
</fileset>
</delete>
</target>
<target name="copy" depends="cleanPrevBuild">
<copy todir="/home/www/phpguide" overwrite="true" includeemptydirs="true">
<fileset dir="/home/phpgTempGitClone">
<exclude name="protected/config/*.example.php" />
<exclude name="protected/runtime/*" />
<exclude name="protected/tests**" />
<exclude name=".gitignore" />
<exclude name="assets/*" />
<exclude name="dummy.php" />
<exclude name="Readme.md" />
<exclude name="**/.gitignore" />
<exclude name=".git" />
<exclude name=".nginx.conf" />
</fileset>
</copy>
</target>
<target name="finish" depends="copy">
<echo msg="setting permissions" />
<exec command="chown www:www1 -R /home/www" />
<exec command="chmod +x /home/www/phpguide/protected/yiic" />
<echo msg="deleting cloned repo" />
<exec command="rm -rf /home/phpgTempGitClone" />
<echo msg="running composer" />
<exec command="composer update -o --no-dev" />
<echo msg="setting permissions again" />
<exec command="chown www:www1 -R /home/www" />
<exec command="chmod +x /home/www/phpguide/protected/yiic" />
<echo msg="setting permissions to writable dirs" />
<exec command="chown -R www:www1 /home/www/phpguide" />
<exec command="chmod -R g+rw /home/www/phpguide/assets" />
<exec command="chomd -R g+rw /home/www/phpguide/cache" />
<exec command="chmod -R g+rw /home/www/phpguide/protected/runtime" />
<exec command="chmod -R g+rw /home/www/phpguide/static/sitemap.xml" />
<echo msg="running migrations" />
<exec command="/home/www/phpguide/protected/yiic migrate --interactive=0" />
<echo msg="cleaning nginx error_log" />
<exec command=" echo '' > /var/log/nginx/error.log" />
<echo msg="cleaning nginx cache" />
<exec command="rm -rf /tmp/ngx_pagespeed_cache/*" />
<echo msg="restarting php-fpm to clear apc cache" />
<exec command="service php-fpm restart" />
<echo msg="restarting nginx to reset cache" />
<exec command="service nginx restart" />
</target>
</project>