-
Notifications
You must be signed in to change notification settings - Fork 0
/
experimental-make-library
executable file
·61 lines (47 loc) · 1.76 KB
/
experimental-make-library
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
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/zsh
#
# Script to make a library of models to be served
#
# Usage:
#
# ./run PATH_TO_POIETIC_FRAME
#
# Uses the following environment variables:
#
# POIETIC - path to the poietic executable, if not found in PATH (required)
# OUTPUT - path to the output library directory, default: ./ModelLibrary
#
set -e
# -----------------------------------------------------------------------------------
# Some internal config, you might skip this to the next section ...
# Path to the poietic tool.
#
# If this demo project directory share the same parent directory as the Poietic Core,
# then make sure that the tool has been built and run this command using:
#
# POIETIC=../PoieticCore/.build/debug/poietic ./run PATH_TO_BUDNLE.poieticframe
#
POIETIC="${POIETIC:-poietic}"
# Path to the output directory, default ./out
OUTPUT_DIR="${OUTPUT:-./ModelLibrary}"
FRAMES_ROOT="."
if ! command -v ${POIETIC} &> /dev/null
then
echo "ERROR: Poietic command '${TOOL}' not found. Set POIETIC environment variable with a valid executable path." 1>&2
echo "HINT: Follow the installation instructions in the PoieticTool package" 1>&2
echo "HINT: Get the tool at https://github.com/OpenPoiesis/poietic-tool"
echo "HINT: Make sure you have '~/.swiftpm/bin' in your PATH." 1>&2
exit 1
fi
mkdir -p "${OUTPUT_DIR}"
all_frames=($(find $FRAMES_ROOT -name '*.poieticframe' ))
for frame_path in ${all_frames[*]}; do
frame_name=$(basename -- $frame_path)
frame_name=${frame_name%.*}
# frame_name=${${frame_path#$FRAMES_ROOT/}%*.poieticframe}
export POIETIC_DESIGN="$OUTPUT_DIR/${frame_name}.poietic"
echo "--- Processing ${frame_name}"
$POIETIC new --import $frame_path --auto-parameters
done
# rm "${OUTPUT_DIR}/*.json" 2> /dev/null && echo "Removed previous library."
exit 0