-
Notifications
You must be signed in to change notification settings - Fork 217
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·53 lines (45 loc) · 1.29 KB
/
entrypoint.sh
File metadata and controls
executable file
·53 lines (45 loc) · 1.29 KB
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
#!/bin/sh
set -e
TARGET="${1:-all}"
MODEL_FILE="${2:-tm.py}"
MODEL=$(basename "${MODEL_FILE}" .py)
WORK_DIR=/work
OUTPUT_DIR="${WORK_DIR}/${MODEL}"
if [ ! -f "${WORK_DIR}/${MODEL_FILE}" ]; then
echo "Error: ${MODEL_FILE} not found in mounted directory"
echo "Usage: docker run --rm -v \$(pwd):/work pytm [dfd|seq|report|all] [model.py]"
exit 1
fi
mkdir -p "${OUTPUT_DIR}"
run_dfd() {
echo "Generating DFD..."
python "${WORK_DIR}/${MODEL}.py" --dfd | dot -Tpng -o "${OUTPUT_DIR}/dfd.png"
}
run_seq() {
echo "Generating sequence diagram..."
python "${WORK_DIR}/${MODEL}.py" --seq \
| java -Djava.awt.headless=true -jar "${PLANTUML_PATH}" -tpng -pipe \
> "${OUTPUT_DIR}/seq.png"
}
run_report() {
echo "Generating report..."
python "${WORK_DIR}/${MODEL}.py" --report /app/docs/basic_template.md \
| pandoc -f markdown-tex_math_dollars -t html \
> "${OUTPUT_DIR}/report.html"
}
case "${TARGET}" in
dfd) run_dfd ;;
seq) run_seq ;;
report) run_report ;;
all)
run_dfd
run_seq
run_report
;;
*)
echo "Unknown target: ${TARGET}"
echo "Usage: docker run --rm -v \$(pwd):/work pytm [dfd|seq|report|all] [model.py]"
exit 1
;;
esac
echo "Output written to ${MODEL}/"