From 3bb69a6ba4a8f6ed235556641a5584cb20fa097e Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 6 Feb 2020 18:06:07 +0100 Subject: Automatically generating index.html symlink --- Makefile | 1 + bin/deploy.sh | 2 +- bin/rankings-tables-build.sh | 8 ++------ bin/rankings-tables-generate.sh | 18 ++++++++++++++++++ config/dates.json | 1 + 5 files changed, 23 insertions(+), 7 deletions(-) create mode 100755 bin/rankings-tables-generate.sh diff --git a/Makefile b/Makefile index d95b9b3..b2f0ef1 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ menus: bin/menus-build.sh config/static.json http tables: + find http -type l -delete bin/rankings-tables-build.sh config/dates.json http editions: $(rankfiles) diff --git a/bin/deploy.sh b/bin/deploy.sh index 4229af4..f121698 100755 --- a/bin/deploy.sh +++ b/bin/deploy.sh @@ -1,7 +1,7 @@ #!/bin/bash LOCALPATH=$1 DEPLOYPATH=`cat config/deploy-path` -RSYNCOPTS='-urpP --delete --copy-links --exclude=.menu.html' +RSYNCOPTS='-urpP --delete --links --exclude=.menu.html' if [ -s config/deploy-pass ] then sshpass -f config/deploy-pass rsync $RSYNCOPTS $LOCALPATH/ $DEPLOYPATH diff --git a/bin/rankings-tables-build.sh b/bin/rankings-tables-build.sh index d3806a7..6dee62a 100755 --- a/bin/rankings-tables-build.sh +++ b/bin/rankings-tables-build.sh @@ -1,10 +1,6 @@ #!/bin/bash CONFIG=$1 DIR=$2 + cat $CONFIG | - jq '.[] | .date, .url, .index, .menu_age // "old", .name' | - xargs -n5 | - while read DATE URL INDEX AGEMENU NAME - do - python scripts/rankings-tables-compile.py "$NAME" $INDEX $DIR/.menu.html $DATE "$AGEMENU" > $DIR/$URL - done + jq -r '.[] | [.date, .url, .index, .menu_age // "old", .name, .links // []] | flatten | @sh' | xargs -L 1 bin/rankings-tables-generate.sh $DIR diff --git a/bin/rankings-tables-generate.sh b/bin/rankings-tables-generate.sh new file mode 100755 index 0000000..06743c8 --- /dev/null +++ b/bin/rankings-tables-generate.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +DIR=$1 +DATE=$2 +URL=$3 +INDEX=$4 +AGEMENU=$5 +NAME=$6 + +python scripts/rankings-tables-compile.py "$NAME" $INDEX $DIR/.menu.html $DATE "$AGEMENU" > $DIR/$URL + +shift 6 +LINKS=$@ + +echo $LINKS | grep -v "^$" | while read LINK +do + ln -sf $URL $DIR/$LINK +done diff --git a/config/dates.json b/config/dates.json index 6746d4a..324a92f 100644 --- a/config/dates.json +++ b/config/dates.json @@ -75,6 +75,7 @@ "date": "2019-12-31", "menu_age": "new", "url": "index.html", + "links": ["2020-01.html"], "name": "I 2020", "index": "13" } -- cgit v1.3.1