You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2019/12/18 07:52:28 UTC

[isis] 06/25: ISIS-2062: factors out _adoc-antora.sh

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 0a1ca4b21999f69f80911eca996fc32a09cb1650
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Dec 13 17:49:35 2019 +0000

    ISIS-2062: factors out _adoc-antora.sh
---
 scripts/ci/_adoc-antora.sh | 30 ++++++++++++++++++++++++++++++
 scripts/ci/build-site.sh   | 30 ++----------------------------
 2 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/scripts/ci/_adoc-antora.sh b/scripts/ci/_adoc-antora.sh
new file mode 100644
index 0000000..1857053
--- /dev/null
+++ b/scripts/ci/_adoc-antora.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+set -e
+
+SCRIPT_DIR=$( dirname "$0" )
+if [ -z "$PROJECT_ROOT_PATH" ]; then
+  PROJECT_ROOT_PATH=`cd $SCRIPT_DIR/../.. ; pwd`
+fi
+
+SITE_CONFIG=$1
+
+if [ -z "$REVISION" ]; then
+  if [ ! -z "$SHARED_VARS_FILE" ] && [ -f "$SHARED_VARS_FILE" ]; then
+    . $SHARED_VARS_FILE
+    export $(cut -d= -f1 $SHARED_VARS_FILE)
+  fi
+fi
+if [ -z "$REVISION" ]; then
+  export REVISION="SNAPSHOT"
+fi
+
+echo "running antora ..."
+if [ -z "$ANTORA_CMD" ]; then
+  ANTORA_CMD=$(command -v antora 2>/dev/null)
+  if [ -z "$ANTORA_CMD" ]; then
+    ANTORA_CMD=$(npm bin)/antora
+  fi
+fi
+
+$ANTORA_CMD --stacktrace $SITE_CONFIG
+
diff --git a/scripts/ci/build-site.sh b/scripts/ci/build-site.sh
index 3fbcd8a..6eb2645 100644
--- a/scripts/ci/build-site.sh
+++ b/scripts/ci/build-site.sh
@@ -6,19 +6,6 @@ if [ -z "$PROJECT_ROOT_PATH" ]; then
   PROJECT_ROOT_PATH=`cd $SCRIPT_DIR/../.. ; pwd`
 fi
 
-if [ -z "$REVISION" ]; then
-  if [ ! -z "$SHARED_VARS_FILE" ] && [ -f "$SHARED_VARS_FILE" ]; then
-    . $SHARED_VARS_FILE
-    export $(cut -d= -f1 $SHARED_VARS_FILE)
-  fi
-fi
-
-if [ -z "$REVISION" ]; then
-  export REVISION="SNAPSHOT"
-fi
-
-
-SITE_CONFIG=$1
 
 bash $SCRIPT_DIR/_print-environment.sh "build-site"
 
@@ -26,27 +13,14 @@ bash $SCRIPT_DIR/_adoc-copy-examples.sh
 bash $SCRIPT_DIR/_adoc-gen-config.sh
 
 
-##
-## check if anything had not been sync'd
-##
+# check if anything had not been sync'd
 WC=$(git status --porcelain | wc -l)
 if [ "$WC" -ne "0" ]; then
   echo "Some examples are out of date; run sync-examples.sh and commit, then try again" >&2
   exit 1
 fi
 
-
-
-
-##
-## run antora
-##
-echo "running antora ..."
-if [ -z "$ANTORA_CMD" ]; then
-  ANTORA_CMD=$(npm bin)/antora
-fi
-
-$ANTORA_CMD --stacktrace $SITE_CONFIG
+bash $SCRIPT_DIR/_adoc-antora.sh $*
 
 # add a marker, that tells github not to use jekyll on the github pages folder
 touch ${PROJECT_ROOT_PATH}/antora/target/site/.nojekyll