Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added task for building documentation using Phrocco

Unignore generated html as we need to move it between branches using stashes.
  • Loading branch information...
commit 47acae25ea45ff1a03aaa3249249bd8b0e6275b3 1 parent 2e51ba4
@kasperg kasperg authored
Showing with 49 additions and 2 deletions.
  1. +1 −2  .gitignore
  2. +48 −0 build.xml
View
3  .gitignore
@@ -2,5 +2,4 @@ build.properties
coverage/*
logs/*
tests/*
-tools/*
-*.html
+tools/*
View
48 build.xml
@@ -1270,4 +1270,52 @@ Configuration of which installation profile and database to use in done in
<property name="project.rhino.setup" value="true" />
</target>
+ <!-- ### Build documentation using Phrocco
+
+Generate documentation for the build script using [Phrocco](https://github.com/oneblackbear/phrocco) and prepare for pushing changes to [GitHub pages](http://pages.github.com/).
+
+To use this task you mush have a version of Phrocco with support for XML
+parsing installed. The task is primarily for template developers. -->
+ <target name="phrocco"
+ depends="clean">
+ <!-- Determine current branch -->
+ <exec command="git status --branch --short"
+ outputProperty="phrocco.code.status" />
+ <php expression="array_shift(explode('...', trim('${phrocco.code.status}', '# '), 2))"
+ returnProperty="phrocco.code.branch"/>
+
+ <!-- Generate documentation in the root build directory -->
+ <exec command="phrocco -i . -o . -l xml"
+ passthru="true" checkreturn="true" />
+ <!-- Checkout the GitHub pages branch -->
+ <exec command="git checkout gh-pages"
+ passthru="true" checkreturn="true"/>
+ <!-- We use the documentation for build.xml and root file so rename
+ it to index.html -->
+ <move file="build.html" tofile="index.html" overwrite="true"
+ haltonerror="true" />
+
+ <property name="phrocco.commit.mode" value=""/>
+ <!-- If the local documentation branch is ahead then we have other
+ changes which have not been pushed yet. These have probably also
+ been generated by this script so amend these changes. -->
+ <exec command="git status --branch --short"
+ outputProperty="phrocco.docs.status" />
+ <if>
+ <contains string="${phrocco.docs.status}" substring="[ahead"/>
+ <then>
+ <property name="phrocco.docs.commit" value="--amend"
+ override="true" />
+ </then>
+ </if>
+
+ <!-- Commit the changes -->
+ <exec command="git commit --all -m 'Documentation update' ${phrocco.docs.commit}"
+ passthru="true" checkreturn="true"/>
+
+ <!-- Return to the main branch -->
+ <exec command="git checkout ${phrocco.code.branch}"
+ passthru="true" checkreturn="true"/>
+ </target>
+
</project>
Please sign in to comment.
Something went wrong with that request. Please try again.