summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-02-06 18:06:07 +0100
committeremkael <emkael@tlen.pl>2020-02-06 18:12:02 +0100
commit3bb69a6ba4a8f6ed235556641a5584cb20fa097e (patch)
treed3d265297d71ea54431f8d604f1fc2c685b8adb9
parent0bc3f285e8701989e2727eddbb21d3a1840841f2 (diff)
Automatically generating index.html symlink
-rw-r--r--Makefile1
-rwxr-xr-xbin/deploy.sh2
-rwxr-xr-xbin/rankings-tables-build.sh8
-rwxr-xr-xbin/rankings-tables-generate.sh18
-rw-r--r--config/dates.json1
5 files changed, 23 insertions, 7 deletions
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"
}