forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preview-site.sh
executable file
·38 lines (30 loc) · 918 Bytes
/
preview-site.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
use_docker=true
if [[ -n "$1" ]]; then
if [[ "$1" == "--docker=false" ]]; then
use_docker=false
else
echo "usage: ./preview-site.sh [--docker=false]"
exit 1
fi
fi
# Infer $VTTOP if it was not set.
if [[ -z "$VTTOP" ]]; then
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
VTTOP="${DIR}/.."
fi
if [[ "$use_docker" == true ]]; then
# Call this script from within the Docker container which has all dependencies installed.
docker run -ti --rm -p 4000:4000 -v $VTTOP:/vttop -e VTTOP=/vttop vitess/publish-site /vttop/vitess.io/preview-site.sh --docker=false
exit $?
fi
# Non-docker mode. Jekyll dependencies must be installed.
set -e
PREVIEW_DIR=$VTTOP/preview-vitess.io
rm -rf $PREVIEW_DIR
mkdir $PREVIEW_DIR
# launch web site locally
cd $VTTOP/vitess.io
bundle install
bundle exec jekyll serve --config _config_dev.yml --destination $PREVIEW_DIR
rm -rf $PREVIEW_DIR