2019-08-21 00:48:59 -04:00
|
|
|
#!/bin/bash -eu
|
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2019-09-24 21:19:06 -04:00
|
|
|
if [ "$#" -ne 2 ] && [ "$#" -ne 3 ]; then
|
2019-08-27 21:36:13 -04:00
|
|
|
echo "Illegal number of parameters, should one or two: the version, or the version and website-src directory";
|
2019-08-21 00:48:59 -04:00
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
2019-09-24 21:19:06 -04:00
|
|
|
URL_VERSION=$1
|
|
|
|
DRUID_VERSION=$2
|
2019-08-27 21:36:13 -04:00
|
|
|
WEBSRC="../../incubator-druid-website-src"
|
|
|
|
|
2019-09-24 21:19:06 -04:00
|
|
|
if [ "$#" -gt 2 ]; then
|
|
|
|
WEBSRC=$3
|
2019-08-27 21:36:13 -04:00
|
|
|
fi
|
|
|
|
|
2019-09-24 21:19:06 -04:00
|
|
|
echo "Building to docs for '$URL_VERSION' to $WEBSRC ..."
|
2019-08-21 00:48:59 -04:00
|
|
|
|
|
|
|
npm run compile-scss
|
|
|
|
|
|
|
|
npm run build | tee ./build-log.txt
|
|
|
|
|
|
|
|
if grep -q "unresolved links in file" ./build-log.txt; then
|
|
|
|
echo "There are unresolved links, please fix";
|
|
|
|
rm build-log.txt;
|
|
|
|
#exit 1
|
|
|
|
else
|
|
|
|
rm build-log.txt
|
|
|
|
fi
|
|
|
|
|
2019-09-24 21:19:06 -04:00
|
|
|
node script/fix-path.js $URL_VERSION $DRUID_VERSION
|
2019-08-21 00:48:59 -04:00
|
|
|
|
|
|
|
echo "Cleaning..."
|
2019-09-24 21:19:06 -04:00
|
|
|
rm -rf $WEBSRC/docs/$URL_VERSION/
|
|
|
|
mkdir -p $WEBSRC/docs/$URL_VERSION/
|
2019-08-21 00:48:59 -04:00
|
|
|
|
2019-09-24 21:19:06 -04:00
|
|
|
cp -r ./build/ApacheDruid/docs/* $WEBSRC/docs/$URL_VERSION/
|
2019-08-21 00:48:59 -04:00
|
|
|
|
2019-08-27 21:36:13 -04:00
|
|
|
mkdir -p $WEBSRC/css
|
|
|
|
cp ./build/ApacheDruid/css/* $WEBSRC/css
|
2019-08-21 00:48:59 -04:00
|
|
|
|
2019-08-27 21:36:13 -04:00
|
|
|
mkdir -p $WEBSRC/js
|
|
|
|
cp ./build/ApacheDruid/js/* $WEBSRC/js
|