diff options
author | emkael <emkael@tlen.pl> | 2017-07-04 15:55:04 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-07-04 15:55:46 +0200 |
commit | dc597e9fbf9ea78110905649cf39df5a1662c1d8 (patch) | |
tree | 93712259d14d6d016800d3c48369ae26ec331c8c | |
parent | 7ad97251669963ec81eb9e808e9a8890939a1b1a (diff) |
Build scripts for static content and menu
-rw-r--r-- | Makefile | 8 | ||||
-rwxr-xr-x | bin/generate-statics.sh | 15 | ||||
-rwxr-xr-x | bin/write-menus.sh | 4 |
3 files changed, 26 insertions, 1 deletions
@@ -1,4 +1,4 @@ -all: rankings players +all: statics rankings players menus targetfiles := $(shell bin/target-ranking-files.sh config/dates.json) tmpfiles := $(patsubst %.html,http/%.html.tmp,$(targetfiles)) @@ -17,6 +17,12 @@ $(rankfiles): players: bin/build-players.sh http +statics: + bin/generate-statics.sh config/static.json static http + +menus: + bin/write-menus.sh config/static.json http + minimize: $(tmpfiles) $(tmpfiles): diff --git a/bin/generate-statics.sh b/bin/generate-statics.sh new file mode 100755 index 0000000..f632d69 --- /dev/null +++ b/bin/generate-statics.sh @@ -0,0 +1,15 @@ +#!/bin/bash +CONFIG=$1 +CONTENT_DIR=$2 +OUTPUT_DIR=$3 +cat $1 | + jq -r '.[] | .content, .header, .url' | + while read CONTENT_FILE + do + read HEADER + read OUTPUT_FILE + if [ -n "$CONTENT_FILE" ] + then + python static.py $CONTENT_DIR/$CONTENT_FILE "$HEADER" > $OUTPUT_DIR/$OUTPUT_FILE + fi + done diff --git a/bin/write-menus.sh b/bin/write-menus.sh new file mode 100755 index 0000000..56b0929 --- /dev/null +++ b/bin/write-menus.sh @@ -0,0 +1,4 @@ +#!/bin/bash +CONFIG_FILE=$1 +DIRECTORY=$2 +find $DIRECTORY -name \*.html -exec python static-menu.py $CONFIG_FILE {} $DIRECTORY \; |