2011-09-22 17:28:24 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# ZODIAC - a simple static site generator
|
2011-09-22 17:43:18 +02:00
|
|
|
# Copyright (c) 2011 Chase Allen James <nx-zodiac@nu-ex.com>
|
2011-09-22 17:28:24 +02:00
|
|
|
|
2011-10-06 23:49:17 +02:00
|
|
|
zod_lib=ZODLIB_PATH
|
2011-10-06 23:52:34 +02:00
|
|
|
proj="$1"
|
|
|
|
target="$2"
|
2011-09-22 17:28:24 +02:00
|
|
|
|
2011-10-24 05:15:46 +02:00
|
|
|
. zod-internal
|
|
|
|
|
2011-10-06 18:27:48 +02:00
|
|
|
_zod_error() {
|
|
|
|
echo -e ">>> ERROR: $*" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
2011-09-22 17:28:24 +02:00
|
|
|
|
2011-10-20 20:29:30 +02:00
|
|
|
_zod_exec() {
|
2011-10-24 05:15:46 +02:00
|
|
|
phase="$1"; shift
|
|
|
|
__zod_config |
|
|
|
|
awk -f "$zod_lib/config.awk" \
|
|
|
|
-f "$zod_lib/find_cmd.awk" \
|
|
|
|
-v phase="$phase" \
|
|
|
|
-v zod_lib="$zod_lib" \
|
|
|
|
-v proj="$proj" \
|
|
|
|
-v target="$target" | sh
|
2011-10-20 20:29:30 +02:00
|
|
|
}
|
|
|
|
|
2011-10-06 23:28:51 +02:00
|
|
|
[ "$#" -ne 2 ] && { echo "usage: zod projectdir targetdir"; exit; }
|
2011-10-06 23:49:17 +02:00
|
|
|
[ ! -d "$proj" ] && _zod_error "project directory does not exist"
|
|
|
|
[ ! -d "$target" ] && _zod_error "target directory does not exist"
|
2011-09-22 17:28:24 +02:00
|
|
|
|
2011-10-20 20:29:30 +02:00
|
|
|
_zod_exec "render"
|
|
|
|
_zod_exec "copy"
|