-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
live-render.sh
executable file
·48 lines (40 loc) · 1.16 KB
/
live-render.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
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
#
# ------------------------------------------------------------------------
# Copyright (c) 2018-2024 Alexandre Bento Freire. All rights reserved.
# Licensed under the MIT License.
# ------------------------------------------------------------------------
# this script is designed only for testing abeamer cli in a bash enviroment
# using `abeamer serve` as a live server.
# e.g. ./live-render.sh ./gallery/animate-colors
if [ "$1" == "" ]; then
echo "usage: ./live-render.sh [--gif] [PORT] (FOLDER)"
else
GEN_GIF=0
if [ "$1" == "--gif" ]; then
GEN_GIF=1
shift
fi
PORT=$1
PARAM_TEST=${PORT//[0-9]}
if [ "$PARAM_TEST" != "" ]; then
PORT=9000
else
shift
fi
FOLDER=$1
shift
FOLDER=${FOLDER%/}
DFOLDER=${FOLDER//\.\//}
URL="http://localhost:$PORT/$DFOLDER/"
CONFIG="./$DFOLDER/abeamer.ini"
echo "PORT=$PORT"
echo "FOLDER=$DFOLDER"
echo "URL=$URL"
echo "CONFIG=$CONFIG"
echo "node ./cli/abeamer-cli.js render $@ --dp --url $URL --config $CONFIG"
node ./cli/abeamer-cli.js render "$@" --dp --url "$URL" --config "$CONFIG"
if [ $GEN_GIF == 1 ]; then
node ./cli/abeamer-cli.js gif "./$DFOLDER"
fi
fi