You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bahir.apache.org by ck...@apache.org on 2017/03/06 09:33:49 UTC
bahir-website git commit: [MINOR] Help text and pwd fix in
update-doc.sh
Repository: bahir-website
Updated Branches:
refs/heads/master 4142e1e34 -> 9c5bcb98a
[MINOR] Help text and pwd fix in update-doc.sh
- script failed when run outside bahir-website directory
- add help text
- allow to run for either Bahir (Spark) or Bahir-Flink extensions only
Project: http://git-wip-us.apache.org/repos/asf/bahir-website/repo
Commit: http://git-wip-us.apache.org/repos/asf/bahir-website/commit/9c5bcb98
Tree: http://git-wip-us.apache.org/repos/asf/bahir-website/tree/9c5bcb98
Diff: http://git-wip-us.apache.org/repos/asf/bahir-website/diff/9c5bcb98
Branch: refs/heads/master
Commit: 9c5bcb98a2a91108f1a6f9e29b18826abb6b6fa9
Parents: 4142e1e
Author: Christian Kadner <ck...@us.ibm.com>
Authored: Mon Mar 6 01:33:09 2017 -0800
Committer: Christian Kadner <ck...@us.ibm.com>
Committed: Mon Mar 6 01:33:09 2017 -0800
----------------------------------------------------------------------
update-doc.sh | 153 ++++++++++++++++++++++++++++++++++-------------------
1 file changed, 98 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/bahir-website/blob/9c5bcb98/update-doc.sh
----------------------------------------------------------------------
diff --git a/update-doc.sh b/update-doc.sh
index d5615a5..618f795 100755
--- a/update-doc.sh
+++ b/update-doc.sh
@@ -16,43 +16,74 @@
# limitations under the License.
#
-##############################################################################
-# This script generates the documentation for the individual Bahir modules #
-# from the README.md files found in the modules in the Bahir source repo #
-# #
-# bahir (source repo) bahir-website #
-# . \u2514\u2500site #
-# . \u2514\u2500docs #
-# . \u2514\u2500spark #
-# \u251c\u2500sql-streaming-mqtt �\u2514\u2500current #
-# \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500spark-sql-streaming-mqtt.md #
-# \u251c\u2500streaming-akka \u2502 #
-# \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500spark-streaming-akka.md #
-# \u251c\u2500streaming-mqtt \u2502 #
-# \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500spark-streaming-mqtt.md #
-# \u251c\u2500streaming-twitter \u2502 #
-# \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500spark-streaming-twitter.md #
-# \u2514\u2500streaming-zeromq \u2502 #
-# �\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u2514\u2500spark-streaming-zeromq.md #
-# #
-# Page header with license text comes from the respective template files #
-# under site/docs/spark/templates #
-##############################################################################
+function exit_with_usage {
+ cat << EOF
+
+ USAGE: update-doc.sh [spark] [flink]
+
+ This script generates the documentation for the individual Bahir (Spark) and
+ Bahir-Flink modules from the contents of the respective module's README.md
+ files as found in the Bahir and Bahir-Flink source repositories.
+
+ bahir (source repo) bahir-website
+ . \u2514\u2500site
+ . \u2514\u2500docs
+ . \u2514\u2500spark
+ \u251c\u2500sql-streaming-mqtt �\u2514\u2500current
+ \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500spark-sql-streaming-mqtt.md
+ \u251c\u2500streaming-akka \u2502
+ \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500spark-streaming-akka.md
+ \u251c\u2500streaming-mqtt \u2502
+ \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500spark-streaming-mqtt.md
+ \u251c\u2500streaming-twitter \u2502
+ \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500spark-streaming-twitter.md
+ \u2514\u2500streaming-zeromq \u2502
+ �\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u2514\u2500spark-streaming-zeromq.md
+
+ bahir-flink (source repo) bahir-website
+ . \u2514\u2500site
+ . \u2514\u2500docs
+ . \u2514\u2500flink
+ \u251c\u2500sql-streaming-mqtt �\u2514\u2500current
+ \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500flink-streaming-activemq.md
+ \u251c\u2500streaming-akka \u2502
+ \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500flink-streaming-akka.md
+ \u251c\u2500streaming-mqtt \u2502
+ \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500flink-streaming-flume.md
+ \u251c\u2500streaming-twitter \u2502
+ \u2502�\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u251c\u2500flink-streaming-netty.md
+ \u2514\u2500streaming-zeromq \u2502
+ �\u2514\u2500README.md \u2500\u2500\u2500\u2500\u2500> \u2514\u2500flink-streaming-redis.md
+
+
+ Page header with license text comes from the respective template files
+ under:
+ site/docs/spark/templates
+ site/docs/flink/templates
+
+EOF
+ exit 1
+}
+
+if [[ "$@" =~ "-h" ]]; then
+ exit_with_usage
+fi
+REPOS="${@:-'spark flink'}"
set -e
-BASE_DIR=$(pwd)
+BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-SPARK_WEBSITE_TEMPLATES_DIR=$BASE_DIR/site/docs/spark/templates
-SPARK_WEBSITE_DOC_DIR=$BASE_DIR/site/docs/spark/current
+SPARK_WEBSITE_TEMPLATES_DIR=site/docs/spark/templates
+SPARK_WEBSITE_DOC_DIR=site/docs/spark/current
SPARK_REPO_NAME=bahir
-SPARK_BAHIR_SOURCE_DIR=$BASE_DIR/target/$SPARK_REPO_NAME
+SPARK_BAHIR_SOURCE_DIR=target/$SPARK_REPO_NAME
-FLINK_WEBSITE_TEMPLATES_DIR=$BASE_DIR/site/docs/flink/templates
-FLINK_WEBSITE_DOC_DIR=$BASE_DIR/site/docs/flink/current
+FLINK_WEBSITE_TEMPLATES_DIR=site/docs/flink/templates
+FLINK_WEBSITE_DOC_DIR=site/docs/flink/current
FLINK_REPO_NAME=bahir-flink
-FLINK_BAHIR_SOURCE_DIR=$BASE_DIR/target/$FLINK_REPO_NAME
+FLINK_BAHIR_SOURCE_DIR=target/$FLINK_REPO_NAME
function checkout_code {
# Checkout code
@@ -80,11 +111,13 @@ function update_docs {
[ ! -d "$WEBSITE_DOC_DIR" ] && mkdir "$WEBSITE_DOC_DIR"
+ echo "Updating documents ..."
+
while [ $# -ne 0 ]; do
- echo "Syncing document $WEBSITE_DOC_DIR/$1.md with source $SOURCE_DIR/$2/README.md"
+ echo " $WEBSITE_DOC_DIR/$1.md <-- $SOURCE_DIR/$2/README.md"
rm -f "$WEBSITE_DOC_DIR/$1.md"
- cp "$WEBSITE_TEMPLATES_DIR/$1.template" "$WEBSITE_DOC_DIR/$1.md"
- cat "$SOURCE_DIR/$2/README.md" >> "$WEBSITE_DOC_DIR/$1.md"
+ cp "$WEBSITE_TEMPLATES_DIR/$1.template" "$WEBSITE_DOC_DIR/$1.md"
+ cat "$SOURCE_DIR/$2/README.md" >> "$WEBSITE_DOC_DIR/$1.md"
shift 2
done
}
@@ -94,7 +127,7 @@ function check_version_strings {
echo
echo "TODO: Replace '...-SNAPSHOT' version strings:"
echo
- grep -r -n "[0-9]-SNAPSHOT" "$1"/*.md | sed -e 's|'"$(pwd)"/'||g' | grep --color "[0-9.]*-SNAPSHOT"
+ grep -r -n "[0-9]-SNAPSHOT" "$1"/*.md | sed 's/^/ /' | grep --color "[0-9.]*-SNAPSHOT"
echo
echo "i.e. to replace '2.1.0-SNAPSHOT' with '2.0.2' run the following command:"
echo
@@ -108,34 +141,44 @@ function check_version_strings {
fi
}
-echo
-echo "================= Updating Apache Spark Extension documents ================="
-echo
+function update_spark {
+ echo
+ echo "================= Updating Apache Spark Extension documents ================="
+ echo
-checkout_code $SPARK_REPO_NAME
+ checkout_code $SPARK_REPO_NAME
-update_docs "$SPARK_WEBSITE_TEMPLATES_DIR" "$SPARK_WEBSITE_DOC_DIR" "$SPARK_BAHIR_SOURCE_DIR" \
- spark-sql-streaming-mqtt sql-streaming-mqtt \
- spark-streaming-akka streaming-akka \
- spark-streaming-mqtt streaming-mqtt \
- spark-streaming-twitter streaming-twitter \
- spark-streaming-zeromq streaming-zeromq
+ update_docs "$SPARK_WEBSITE_TEMPLATES_DIR" \
+ "$SPARK_WEBSITE_DOC_DIR" "$SPARK_BAHIR_SOURCE_DIR" \
+ spark-sql-streaming-mqtt sql-streaming-mqtt \
+ spark-streaming-akka streaming-akka \
+ spark-streaming-mqtt streaming-mqtt \
+ spark-streaming-twitter streaming-twitter \
+ spark-streaming-zeromq streaming-zeromq
-check_version_strings "$SPARK_WEBSITE_DOC_DIR"
+ check_version_strings "$SPARK_WEBSITE_DOC_DIR"
+}
-echo
-echo "================= Updating Apache Flink Extension documents ================="
-echo
+function update_flink {
+ echo
+ echo "================= Updating Apache Flink Extension documents ================="
+ echo
-checkout_code $FLINK_REPO_NAME
+ checkout_code $FLINK_REPO_NAME
+
+ update_docs "$FLINK_WEBSITE_TEMPLATES_DIR" \
+ "$FLINK_WEBSITE_DOC_DIR" "$FLINK_BAHIR_SOURCE_DIR" \
+ flink-streaming-activemq flink-connector-activemq \
+ flink-streaming-akka flink-connector-akka \
+ flink-streaming-flume flink-connector-flume \
+ flink-streaming-netty flink-connector-netty \
+ flink-streaming-redis flink-connector-redis
+
+ check_version_strings "$FLINK_WEBSITE_DOC_DIR"
+}
-update_docs "$FLINK_WEBSITE_TEMPLATES_DIR" "$FLINK_WEBSITE_DOC_DIR" "$FLINK_BAHIR_SOURCE_DIR" \
- flink-streaming-activemq flink-connector-activemq \
- flink-streaming-akka flink-connector-akka \
- flink-streaming-flume flink-connector-flume \
- flink-streaming-netty flink-connector-netty \
- flink-streaming-redis flink-connector-redis
-check_version_strings "$FLINK_WEBSITE_DOC_DIR"
+[[ "$REPOS" =~ "spark" ]] && update_spark
+[[ "$REPOS" =~ "flink" ]] && update_flink
set +e