forked from civilian7/sql-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_docs.sh
More file actions
75 lines (62 loc) · 1.48 KB
/
Copy pathbuild_docs.sh
File metadata and controls
75 lines (62 loc) · 1.48 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# =============================================
# SQL 튜토리얼 MkDocs 빌드 스크립트
# 사용법: ./build_docs.sh [ko|en|all]
# =============================================
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
DOCS_DIR="$SCRIPT_DIR/docs"
OUTPUT_DIR="$SCRIPT_DIR/output/docs"
DEPLOY_DIR="$SCRIPT_DIR/../bin/www/docs/tutorial"
LANG="${1:-all}"
build_lang() {
local lang="$1"
local config="$DOCS_DIR/mkdocs-${lang}.yml"
if [ ! -f "$config" ]; then
echo "[ERROR] $config not found"
return 1
fi
echo "[BUILD] $lang ..."
mkdocs build -f "$config" -q
echo " -> $OUTPUT_DIR/$lang/ ($(find "$OUTPUT_DIR/$lang" -name '*.html' | wc -l) pages)"
}
deploy_lang() {
local lang="$1"
local src="$OUTPUT_DIR/$lang"
local dst="$DEPLOY_DIR/$lang"
if [ ! -d "$src" ]; then
echo "[SKIP] $src not found"
return
fi
mkdir -p "$dst"
cp -r "$src/"* "$dst/"
echo " -> deployed to $dst/"
}
echo "=== SQL Tutorial Build ==="
echo ""
# SQL 블록 동기화 (ko → en)
echo "[SYNC] ko/ SQL → en/ ..."
python "$SCRIPT_DIR/sync_sql.py" --apply
echo ""
case "$LANG" in
ko)
build_lang ko
deploy_lang ko
;;
en)
build_lang en
deploy_lang en
;;
all)
build_lang ko
build_lang en
deploy_lang ko
deploy_lang en
;;
*)
echo "Usage: $0 [ko|en|all]"
exit 1
;;
esac
echo ""
echo "Done."