Skip to content

Commit 494f2de

Browse files
committed
[#189] Add option to publish to /latest site
1 parent 6d22992 commit 494f2de

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

kaizen-openapi-parser/p2/build.sh

+25-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ unset JOVL_VERSION KZOP_VERSION BUILD_SCRIPT_DIR
44
KZOP_REPO="http://localhost:8000"
55
JOVL_REPO="http://localhost:8000"
66
PUBLISH=false
7+
LATEST=false
78
HELP=false
89

910
function getargs() {
10-
longopts="jovl-version:,kzop-version:,kzop-repo:,jovl-repo:,publish,build-scripts:,help"
11-
shortopts="j:k:K:J:pb:h"
11+
longopts="jovl-version:,kzop-version:,kzop-repo:,jovl-repo:,publish,build-scripts:,latest,help"
12+
shortopts="j:k:K:J:pb:lh"
1213
progname=$(basename "$0")
1314
OPTS=$(getopt -n "$progname" -o "$shortopts" --long "$longopts" -- "$@")
1415
if [[ $? -ne 0 ]] ; then
@@ -29,6 +30,8 @@ function getargs() {
2930
PUBLISH=true ; shift ;;
3031
-b|--build-scripts)
3132
BUILD_SCRIPT_DIR="$2"; shift 2 ;;
33+
-l|--latest)
34+
LATEST=true ; shift ;;
3235
-h|--help)
3336
HELP=true ; shift ;;
3437
--)
@@ -44,6 +47,10 @@ function getargs() {
4447
echo "Must specify build-script directory with -b or --build-scripts option if publishing"
4548
return 1
4649
fi
50+
if $LATEST && ! $PUBLISH ; then
51+
echo "Must specify --publish if --latest is used"
52+
return 1
53+
fi
4754
if [[ -z $JOVL_VERSION || -z $KZOP_VERSION ]] ; then
4855
if [[ -z $KZOP_VERSION ]] ; then
4956
echo "Must specify KaiZen OpenApiParser version with -k or --kzop-version option"
@@ -72,8 +79,10 @@ function usage() {
7279
-p or --publish - publish the newly built update site
7380
* -b or --build-scripts - speicfy location of RepreZen build scripts, including
7481
the "publish" script. This is required only if "-p" is specified
82+
-l or --latest - publish to "latest" site in addition to site named for
83+
version (--publish must also be specified)
7584
-h or --help - print this message and do nothing else
76-
85+
7786
Note on repos: Both ---kzop-repo and --jovl-repo default to
7887
http://localhost:8000, so if you already have the needed versions in
7988
your local maven repo cache, you can set up a simple HTTP server to
@@ -93,6 +102,9 @@ function main() {
93102
buildSite
94103
if $PUBLISH ; then
95104
publishSite
105+
if $LATEST ; then
106+
publishLatest
107+
fi
96108
fi
97109
}
98110

@@ -110,14 +122,23 @@ function buildSite() {
110122
}
111123

112124
function publishSite() {
125+
publish "$KZOP_VERSION"
126+
}
127+
128+
function publishLatest() {
129+
publish "latest"
130+
}
131+
132+
function publish() {
113133
local pub="$BUILD_SCRIPT_DIR/publish"
114-
"$pub" -w -c -d "$KZOP_VERSION" \
134+
"$pub" -w -c -d "$1" \
115135
--ws-host wsw \
116136
--ws-root /data/products/kaizen/openapi-parser/updates \
117137
--local-root target/repository \
118138
\*
119139

120140
}
141+
121142
if ! getargs "$@" ; then
122143
usage
123144
exit 1

0 commit comments

Comments
 (0)