From 5949cf20bdb4c13a793e8de46ff0e353173ad1c6 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 19 Apr 2015 11:00:17 -0700 Subject: [PATCH] make compile.sh work on any given directory --- Makefile | 2 +- bin/compile.sh | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 7eb31c4..a9358f8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ all: compile compile: @echo - ./bin/compile.sh + ./bin/compile.sh . publish: compile @echo diff --git a/bin/compile.sh b/bin/compile.sh index 67a99ac..c0a0aea 100755 --- a/bin/compile.sh +++ b/bin/compile.sh @@ -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() {