Skip to content

Commit

Permalink
using asciidoctor docker image in the build process (locally and on t…
Browse files Browse the repository at this point in the history
…ravis ci) (zalando#260)
  • Loading branch information
maxim-tschumak committed Aug 22, 2017
1 parent dee353c commit f3e05b1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
8 changes: 0 additions & 8 deletions BUILD.adoc
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
= Build

== Requirements

* http://asciidoctor.org/docs/install-toolchain/[Install Asciidoctor toolchain]
* Install gems for PDF and EPUB3 generation
** `gem install --pre asciidoctor-pdf`
** `gem install coderay pygments.rb`
** `gem install --pre asciidoctor-epub3`

== Build HTML site, PDF and EPUB3 locally
[source,bash]
----
Expand Down
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

https://travis-ci.org/zalando/restful-api-guidelines[image:https://travis-ci.org/zalando/restful-api-guidelines.svg?branch=master[Build Status]]
Latest published version:
http://zalando.github.io/restful-api-guidelines[*HTML*],
http://zalando.github.io/restful-api-guidelines/[*HTML*],
http://zalando.github.io/restful-api-guidelines/zalando-restful-guidelines.pdf[*PDF*],
http://zalando.github.io/restful-api-guidelines/zalando-restful-guidelines.epub[*EPUB3*]

Expand Down
25 changes: 17 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
#!/usr/bin/env bash
# Script to build Zalando RESTful Guidelines (static HTML, PDF)

set -ex #print commands, exit on failure
set -ex

BUILD_DIR=output
pushd `dirname $0` > /dev/null
SCRIPT_DIR=`pwd -P`
popd > /dev/null
BUILD_DIR=${SCRIPT_DIR}/output

rm -rf ${BUILD_DIR}/* #clean
cp -r assets ${BUILD_DIR}/ #copy assets
cp -r legacy/* ${BUILD_DIR}/ #copy assets
asciidoctor -D ${BUILD_DIR} index.adoc #generate HTML
asciidoctor-pdf -D ${BUILD_DIR} index.adoc #generate PDF
asciidoctor-epub3 -D ${BUILD_DIR} index.adoc #generate EPUB3
rm -rf ${BUILD_DIR}
mkdir ${BUILD_DIR}
docker pull asciidoctor/docker-asciidoctor

./check_uniqueness_of_rule_ids.sh

docker run -v ${SCRIPT_DIR}:/documents/ asciidoctor/docker-asciidoctor asciidoctor -D /documents/output index.adoc
docker run -v ${SCRIPT_DIR}:/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf -D /documents/output index.adoc
docker run -v ${SCRIPT_DIR}:/documents/ asciidoctor/docker-asciidoctor asciidoctor-epub3 -D /documents/output index.adoc

cp -r assets ${BUILD_DIR}/
cp -r -n legacy/* ${BUILD_DIR}/

mv ${BUILD_DIR}/index.pdf ${BUILD_DIR}/zalando-restful-guidelines.pdf
mv ${BUILD_DIR}/index.epub ${BUILD_DIR}/zalando-restful-guidelines.epub

0 comments on commit f3e05b1

Please sign in to comment.