prepare for 0.3.0 release
[phorkie.git] / build.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <project name="phorkie" default="zip" basedir=".">
3   <!--
4     phorkie phing build file.
5     This script should provide a one-stop tool for all administrative
6     tasks around phorkie, like creating a release version,
7     tagging a release
8   -->
9   <property file="build.properties" />
10
11   <property name="version-m"  value="0.3" />
12   <property name="version"    value="0.3.0" />
13   <property name="stability"  value="alpha" />
14   <property name="releasenotes" value="
15 Version 0.3.0 - 2012-09-27
16 --------------------------
17
18 * Fix bug #10: error when nothing submitted [cweiske]
19 * Fix bug #11: do not index edit, delete and tool pages [cweiske]
20 * Fix bug #22: Edited pastes not in 'recently created' [cweiske]
21 * Implement request #5: Add OpenID authentication [jnovack]
22 * Implement request #9: autodetect file type [cweiske]
23 * Implement request #12: DOAP and rel='vcs-git' support [cweiske]
24 * Implement request #13: remote forking support [cweiske]
25 * Hide additional file fields by default, button to toggle their visibility
26   [cweiske]
27 * Markdown support [jnovack]
28 * Added nginx rewrite rules to README [skl]
29 " />
30   <property name="zipfile"     value="${phing.project.name}-${version}.tar.bz2" />
31   <property name="pkgfile"     value="${phing.project.name}-${version}.tgz" />
32   <property name="distfile"    value="dist/${zipfile}" />
33   <property name="distpkgfile" value="dist/pear/${pkgfile}" />
34   <property name="sfproject"   value="phorkie" />
35   <property name="sffilepath"  value="p/ph/phorkie/" />
36
37   <fileset id="fs.zip" dir=".">
38    <include name="data/**"/>
39    <include name="scripts/**"/>
40    <include name="src/**"/>
41    <include name="www/**"/>
42
43    <include name="ChangeLog"/>
44    <include name="LICENSE"/>
45    <include name="NEWS.rst"/>
46    <include name="README.rst"/>
47
48    <exclude name="**/.gitignore/"/>
49    <exclude name="data/config.php"/>
50   </fileset>
51
52   <fileset id="fs.doc" dir=".">
53    <include name="README.rst"/>
54    <include name="NEWS.rst"/>
55   </fileset>
56
57   <taskdef name="rST" classname="phing.tasks.ext.rSTTask" />
58   <taskdef name="d51pearpkg2" classname="phing.tasks.ext.d51PearPkg2Task" />
59
60   <target name="zip" depends="check"
61    description="Create zip file for release"
62    >
63     <!--
64       The release file is for end users, so it is safe to
65       remove anything developer-related.
66
67       Test your zip with: unzip -l phorkie-0.1.0.zip
68     -->
69     <echo msg="Creating distribution zip for phorkie ${version}"/>
70     <delete file="${distfile}" failonerror="false"/>
71     <tar compression="bzip2" destfile="${distfile}"
72          prefix="${phing.project.name}-${version}/"
73     >
74      <fileset refid="fs.zip"/>
75     </tar>
76   </target>
77
78
79
80   <target name="package" depends="check"
81    description="Creates the pear package"
82   >
83    <d51pearpkg2 dir="." baseinstalldir="/">
84      <name>phorkie</name>
85      <summary>Self-hosted pastebin software</summary>
86      <description>
87       Self-hosted pastebin software written in PHP.
88       Pastes are editable, may have multiple files and are stored in git repositories.
89      </description>
90      <channel>phorkie.sourceforge.net</channel>
91
92      <lead user="cweiske" name="Christian Weiske" email="cweiske@cweiske.de" />
93      <license>AGPL</license>
94
95      <version   release="${version}"   api="${version}" />
96      <stability release="${stability}" api="${stability}" />
97
98      <notes>${releasenotes}</notes>
99
100      <dependencies>
101        <php minimum_version="5.3.0" />
102        <pear minimum_version="1.9.0" />
103
104        <package name="Date_HumanDiff"
105                 channel="pear.php.net"
106                 minimum_version="0.4.0"
107                 />
108        <package name="HTTP_Request2"
109                 channel="pear.php.net"
110                 minimum_version="2.1.0"
111                 />
112        <package name="OpenID"
113                 channel="pear.php.net"
114                 minimum_version="0.3.3"
115                 />
116        <package name="Pager"
117                 channel="pear.php.net"
118                 minimum_version="2.4.8"
119                 />
120        <package name="Services_Libravatar"
121                 channel="pear.php.net"
122                 minimum_version="0.2.2"
123                 />
124        <package name="VersionControl_Git"
125                 channel="pear.php.net"
126                 minimum_version="0.4.4"
127                 />
128
129        <package name="geshi"
130                 channel="mediawiki.googlecode.com/svn"
131                 minimum_version="1.0.0"
132                 />
133        <package name="Markdown"
134                 channel="pear.michelf.ca"
135                 minimum_version="0.0.2"
136                 />
137        <package name="MIME_Type_PlainDetect"
138                 channel="zustellzentrum.cweiske.de"
139                 minimum_version="0.0.2"
140                 />
141        <package name="Twig"
142                 channel="pear.twig-project.org"
143                 minimum_version="1.6.0"
144                 />
145
146      </dependencies>
147
148      <!-- map directory (key) to role -->
149      <dirroles key="data">data</dirroles>
150      <dirroles key="scripts">data</dirroles>
151      <dirroles key="src">php</dirroles>
152      <dirroles key="www">www</dirroles>
153
154      <!-- do not add the following files to the package.
155           copied from excludes above -->
156      <ignore>**/.gitignore</ignore>
157      <ignore>build*</ignore>
158      <ignore>data/config.php</ignore>
159      <ignore>dist/**</ignore>
160      <ignore>*.properties</ignore>
161      <ignore>*.tgz</ignore>
162
163      <replacement path="www/www-header.php"
164       type="pear-config" from="@data_dir@" to="data_dir"
165       />
166
167
168    </d51pearpkg2>
169
170    <!-- time to fix the package.xml file since the task does not
171         allow everything we need:
172         - strip the base directory names like src, data and www
173         - remove that dumb baseinstalldir from files
174         - md5sums are generated automatically when packaging
175    -->
176    <!-- yes, we need to generate a 2nd file and move it back -->
177    <copy file="package.xml" tofile="package2.xml" overwrite="true">
178     <filterchain>
179      <replaceregexp>
180       <!-- remove md5sums -->
181       <regexp
182        pattern="md5sum=&quot;[a-z0-9]{32}&quot; "
183        replace=""
184        />
185       <!-- remove baseinstalldir for files -->
186       <regexp
187        pattern="&lt;file baseinstalldir=&quot;/&quot;"
188        replace="&lt;file"
189        />
190       <!-- install-as for different directories -->
191       <regexp
192        pattern="(&lt;file name=&quot;data/(.+?)&quot;)"
193        replace="\1 install-as=&quot;\2&quot;"
194        />
195       <regexp
196        pattern="(&lt;file name=&quot;doc/(.+?)&quot;)"
197        replace="\1 install-as=&quot;\2&quot;"
198        />
199       <regexp
200        pattern="(&lt;file name=&quot;tests/(.+?)&quot;)"
201        replace="\1 install-as=&quot;\2&quot;"
202        />
203       <regexp
204        pattern="(&lt;file name=&quot;www/(.+?)&quot;)"
205        replace="\1 install-as=&quot;phorkie/\2&quot;"
206        />
207       <regexp
208        pattern="(&lt;file name=&quot;src/(.+?)&quot;)"
209        replace="\1 install-as=&quot;\2&quot;"
210        />
211      </replaceregexp>
212     </filterchain>
213    </copy>
214    <move file="package2.xml" tofile="package.xml" overwrite="true" />
215
216    <!-- package up -->
217    <exec command="pear package" passthru="true" />
218    <move file="${pkgfile}" todir="dist/pear/" />
219
220    <delete file="package.xml" failonerror="true" />
221   </target>
222
223
224   <target name="build-docs" description="render documentation">
225    <rST format="html" uptodate="true">
226     <fileset refid="fs.doc"/>
227     <mapper type="regexp" from="^(.+?).rst$" to="dist/docs/\1.html"/>
228    </rST>
229   </target>
230
231   <target name="clean-docs" description="delete rendered documentation files">
232    <delete dir="dist/docs" includeemptydirs="yes"/>
233   </target>
234
235
236   <target name="release" depends="check,zip,package,deploy-sf"
237    description="Release the version on sourceforge"
238    >
239    <!-- meta-target -->
240   </target>
241
242
243   <!--
244   /home/frs/project/p/ph/phorkie/phorkie/v0.1/
245   /home/frs/project/p/ph/phorkie/phorkie/v0.1/phorkie-v0.1.0.zip
246   /home/frs/project/p/ph/phorkie/phorkie/v0.1/phorkie-v0.1.1.zip
247   https://sourceforge.net/apps/trac/sourceforge/wiki/Release%20files%20for%20download
248   -->
249   <target name="deploy-sf" depends="check,zip"
250    description="Upload release to sourceforge"
251    >
252     <delete dir="dist/deploy-sf" /><!-- make empty -->
253     <mkdir dir="dist/deploy-sf" />
254     <mkdir dir="dist/deploy-sf/v${version-m}" />
255     <copy file="${distfile}" tofile="dist/deploy-sf/v${version-m}/${zipfile}"/>
256     <!-- test
257     <exec command="rsync -av dist/deploy-sf/ /tmp/test/" escape="false" />
258     -->
259     <exec
260      command="rsync -av -e ssh dist/deploy-sf/ ${sfuser},${sfproject}@frs.sourceforge.net:/home/frs/project/${sffilepath}/${sfproject}/"
261      escape="false" checkreturn="false"
262      />
263     <!-- rsync always returns code 23 on sourceforge releases, so we
264          can't check return values -->
265   </target>
266
267
268   <target name="check"
269    description="Check variables"
270    >
271     <fail unless="version" message="Version not defined!" />
272     <fail unless="sfuser" message="Sourceforge username not defined!" />
273     <fail unless="sfproject" message="Sourceforge project name not defined!" />
274     <fail unless="sffilepath" message="Sourceforge project file path not defined!" />
275
276     <mkdir dir="dist" />
277   </target>
278
279 </project>