zodiac/bin/zod.template

34 lines
702 B
Plaintext
Raw Normal View History

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
. zod-internal
_zod_error() {
echo -e ">>> ERROR: $*" >&2
exit 1
}
2011-09-22 17:28:24 +02:00
_zod_exec() {
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
}
[ "$#" -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
_zod_exec "render"
_zod_exec "copy"