diff --git a/issues/Makefile b/issues/Makefile index 0767360..fec46c8 100644 --- a/issues/Makefile +++ b/issues/Makefile @@ -1,16 +1,22 @@ -generate-site: +TEMPDIR=/tmp/openbsd-webzine/ + +generate-site: clean ls | grep issue- | sort -n | xargs ./make_issue.sh ./make_issue.sh _index ../public/index.html all: generate-site clean: - rm ../dev/*html + rm -f ../dev/*html ../public/* test: - ./make_issue.sh current /tmp/current-issue.html - xdg-open /tmp/current-issue.html + mkdir -p ${TEMPDIR} + ./make_issue.sh current ${TEMPDIR}/current-issue.html + xdg-open ${TEMPDIR}/current-issue.html -testsite: generate-site - cp -fr ../public /tmp/ - xdg-open /tmp/public/index.html +testsite: clean + ls | grep issue- | sort -n | xargs ./make_issue.sh -t + ./make_issue.sh _index ../public/index.html + mkdir -p ${TEMPDIR} + cp -fr ../public ${TEMPDIR}/ + xdg-open ${TEMPDIR}/public/index.html diff --git a/issues/make_issue.sh b/issues/make_issue.sh index f8215b2..b33f4f6 100755 --- a/issues/make_issue.sh +++ b/issues/make_issue.sh @@ -10,6 +10,13 @@ die() { exit 1 } +testsite=0 +if [ "$1" = "-t" ] +then + testsite=1 + shift +fi + DIR=$(basename $1) DESTFILENAME=$2 CURINODE=$(stat -f "%i" current/) @@ -18,7 +25,7 @@ test -d "$DIR" || usage test -d ../public/ || die "You must run this from openbsd-webzine/current" ls $DIR/*.html 2>&1 >/dev/null || die "no html file in $DIR" -if [ "$(stat -f '%i' $DIR)" -eq "$CURINODE" ] +if [ $testsite -eq 0 ] && [ "$(stat -f '%i' $DIR)" -eq "$CURINODE" ] then DEST=dev else