Skip to content

Commit

Permalink
GEODE-7457: publish one wiki page per release instead of overwriting …
Browse files Browse the repository at this point in the history
…previous release (apache#4328)
  • Loading branch information
onichols-pivotal authored Nov 14, 2019
1 parent fcb4d73 commit 82ac712
Showing 1 changed file with 32 additions and 22 deletions.
54 changes: 32 additions & 22 deletions geode-management/src/test/script/update-management-wiki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,11 @@ else
fi

BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ ${BRANCH} != "develop" ]] && [[ ${BRANCH} != "master" ]] ; then
echo "Please git checkout develop or git checkout master before running this script"
if [[ ${BRANCH} != "develop" ]] && [[ ${BRANCH} != "master" ]] && [[ ${BRANCH%/*} != "release" ]] ; then
echo "Please git checkout develop, master, or a release branch before running this script"
exit 1
fi

MASTER_PAGE_ID=115511910
DEVELOP_PAGE_ID=132322415
[[ "${BRANCH}" == "master" ]] && PAGE_ID=$MASTER_PAGE_ID || PAGE_ID=$DEVELOP_PAGE_ID
[[ "${BRANCH}" == "master" ]] && GEODE_VERSION=$($GEODE/bin/gfsh version) || GEODE_VERSION=develop

#skip generating steps if swagger output has already been generated
if ! [ -r static/index.html ] ; then

echo ""
echo "============================================================"
echo "Checking that swagger-codegen is installed (ignore warning/error if already installed)"
echo "============================================================"
brew install swagger-codegen || true
brew upgrade swagger-codegen || true

echo ""
echo "============================================================"
echo "Checking that premailer is installed (ignore warnings/errors if already installed)"
echo "============================================================"
pip install premailer

echo ""
echo "============================================================"
Expand All @@ -90,6 +70,34 @@ else
exit 1
fi


GEODE_VERSION=$($GEODE/bin/gfsh version)
[[ "${GEODE_VERSION%.*}" == "1.10" ]] && PAGE_ID=115511910
[[ "${GEODE_VERSION%.*}" == "1.11" ]] && PAGE_ID=135861023
[[ "${BRANCH}" == "develop" ]] && GEODE_VERSION=develop && PAGE_ID=132322415

if [[ -z "${PAGE_ID}" ]] ; then
echo "Please create a new wiki page for $GEODE_VERSION and add its page ID to $0 near line 77"
exit 1
fi


#skip generating steps if swagger output has already been generated
if ! [ -r static/index.html ] ; then

echo ""
echo "============================================================"
echo "Checking that swagger-codegen is installed (ignore warning/error if already installed)"
echo "============================================================"
brew install swagger-codegen || true
brew upgrade swagger-codegen || true

echo ""
echo "============================================================"
echo "Checking that premailer is installed (ignore warnings/errors if already installed)"
echo "============================================================"
pip install premailer

echo ""
echo "============================================================"
echo "Starting up a locator to access swagger"
Expand Down Expand Up @@ -199,6 +207,8 @@ sed -e '/«.*»/s/,/_/g' |
sed -e 's/«/_/g' -e 's/»//g' |
#work around ever-increasing indent bug
sed -e 's/class="method" style="margin-left:20p/class="method" style="margin-left:0p/' |
# add more information at the top
awk '/More information:/{sub(/More information:/,"Swagger: http://locator:7070/management/docs (requires access to a running locator)<br/>Codegen: <code><small>brew install swagger-codegen; swagger-codegen generate -i http://locator:7070/management'${URI_VERSION}'/api-docs</small></code><br/>More information:")}{print}' |
cat > static/index-xhtml.html
# if file is empty due to some error, abort!
! [ -z "$(cat static/index-xhtml.html)" ]
Expand Down

0 comments on commit 82ac712

Please sign in to comment.