|
@@ -0,0 +1,48 @@
|
|
|
+# This Makefile is used to build documentation in the gh-pages branch.
|
|
|
+
|
|
|
+.PHONY: all gh-pages eunit edoc
|
|
|
+
|
|
|
+all:
|
|
|
+ @echo "Do 'make gh-pages' to commit in the gh-pages branch containing"
|
|
|
+ @echo "the generated EDoc and the EUnit coverage report."
|
|
|
+
|
|
|
+edoc:
|
|
|
+ rebar doc
|
|
|
+
|
|
|
+eunit:
|
|
|
+ rebar eunit | tee .eunit/output
|
|
|
+
|
|
|
+# Build eunit.html containing the coverage report and the eunit output.
|
|
|
+doc/eunit.html: eunit
|
|
|
+ (echo '<!DOCTYPE html>' ; \
|
|
|
+ cat .eunit/index.html | sed 's!</body></html>!!' ; \
|
|
|
+ echo '<h3>Output</h3><pre>' ; \
|
|
|
+ sed 's/&/\&/g; s/</\</g; s/>/\>/g;' .eunit/output ; \
|
|
|
+ echo '</pre>' ; \
|
|
|
+ echo '<p><em>Generated using EUnit,' ; \
|
|
|
+ date -u '+%d %h %Y %H:%M:%S UTC.' ; \
|
|
|
+ echo '</em></p>' ; \
|
|
|
+ echo '</body></html>') > doc/eunit.html
|
|
|
+
|
|
|
+# Update the local 'gh-pages' branch with pregenerated output files
|
|
|
+# (trick from https://groups.google.com/forum/#!topic/github/XYxkdzxpgCo)
|
|
|
+gh-pages: doc/eunit.html edoc
|
|
|
+ @if [ $$(git name-rev --name-only HEAD) != master ] ; then \
|
|
|
+ echo "Not on master. Aborting." ; \
|
|
|
+ false ; \
|
|
|
+ fi
|
|
|
+ cp .eunit/*.COVER.html doc/
|
|
|
+ git update-ref refs/heads/gh-pages origin/gh-pages '' 2>/dev/null || true
|
|
|
+ GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
|
|
|
+ rm -f $${GIT_INDEX_FILE} && \
|
|
|
+ git add -f doc/*.html doc/stylesheet.css doc/erlang.png && \
|
|
|
+ git update-ref refs/heads/gh-pages \
|
|
|
+ $$(echo "Autogenerated html pages for $$(git describe)" \
|
|
|
+ | git commit-tree $$(git write-tree --prefix=doc) \
|
|
|
+ -p refs/heads/gh-pages)
|
|
|
+ rm gitindex.tmp
|
|
|
+ @echo "=== Done ==="
|
|
|
+
|
|
|
+# Credits:
|
|
|
+#
|
|
|
+
|