make compile.sh work on any given directory

This commit is contained in:
Sami Samhuri 2015-04-19 11:00:17 -07:00
parent e44afbe80d
commit 5949cf20bd
2 changed files with 8 additions and 7 deletions

View file

@ -2,7 +2,7 @@ all: compile
compile:
@echo
./bin/compile.sh
./bin/compile.sh .
publish: compile
@echo

View file

@ -1,22 +1,23 @@
#!/bin/bash
#!/bin/zsh
# bail on errors
set -e
DIR=$(dirname "$0")
HARP="node_modules/harp/bin/harp"
TARGET="${1:-www}"
BLOG_DIR="${1:-${DIR}/..}"
TARGET="${BLOG_DIR%/}/${2:-www}"
function main() {
echo "* compile rss feed"
compile_rss
echo "* harp compile . $TARGET"
echo "* harp compile $BLOG_DIR $TARGET"
rm -rf "$TARGET"
"$HARP" compile . "$TARGET"
"$HARP" compile "$BLOG_DIR" "$TARGET"
# clean up temporary feed
rm public/feed.xml
rm $BLOG_DIR/public/feed.xml
echo "* munge html files to make them available without an extension"
munge_html
@ -29,7 +30,7 @@ function main() {
}
function compile_rss() {
ruby -w $DIR/rss.rb public
ruby -w $DIR/rss.rb $BLOG_DIR/public
}
function munge_html() {