From 8905ba09f9132370c34220ec48bf4b4a5de97106 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 7 Jun 2017 22:45:28 +0200 Subject: Proper build mechanism --- Makefile | 24 ++++++++++++++++++++++++ bin/build-players.sh | 3 +++ bin/build-rankings.sh | 12 ++++++++++++ bin/make.sh | 2 -- 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 Makefile create mode 100755 bin/build-players.sh create mode 100755 bin/build-rankings.sh delete mode 100755 bin/make.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..83728ee --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +all: rankings players + +rankings: tables editions minimize + +tables: + bin/build-rankings.sh config/dates.json http + +rankfiles := $(patsubst %.html,%.html.ed,$(wildcard http/*.html)) + +editions: $(rankfiles) + +$(rankfiles): + python editions.py $(patsubst %.ed,%,$@) + +tmpfiles := $(patsubst %.html,%.html.tmp,$(wildcard http/*.html)) + +minimize: $(tmpfiles) + +$(tmpfiles): + htmlmin $(patsubst %.tmp,%,$@) $@ + mv $@ $(patsubst %.tmp,%,$@) + +players: + bin/build-players.sh http diff --git a/bin/build-players.sh b/bin/build-players.sh new file mode 100755 index 0000000..93edf63 --- /dev/null +++ b/bin/build-players.sh @@ -0,0 +1,3 @@ +#!/bin/bash +DIR=$1 +python players.py $DIR/players diff --git a/bin/build-rankings.sh b/bin/build-rankings.sh new file mode 100755 index 0000000..1896afb --- /dev/null +++ b/bin/build-rankings.sh @@ -0,0 +1,12 @@ +#!/bin/bash +CONFIG=$1 +DIR=$2 +PREV_DATE="" +cat $CONFIG | + jq '.[] | .date, .url, .index, .name' | + xargs -n4 | + while read DATE URL INDEX NAME + do + python ranking.py "$NAME" $INDEX $DATE $PREV_DATE > $DIR/$URL + PREV_DATE=$DATE + done diff --git a/bin/make.sh b/bin/make.sh deleted file mode 100755 index 4bc8749..0000000 --- a/bin/make.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -bin/build.sh config/dates.json http -- cgit v1.2.3