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