aboutsummaryrefslogtreecommitdiffstats
path: root/tests/data/fetch.sh
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-11-24 23:51:40 +0100
committerMartin Czygan <martin.czygan@gmail.com>2020-11-24 23:51:40 +0100
commit268e7948e6fa2ee9871430104f60bdab3212464c (patch)
treeb25b96f17767a4f9fdd72e73ccbb5d7b41050314 /tests/data/fetch.sh
parent48d9265ce97e032e4f5fd2aaa3bde7fb8f49d6c5 (diff)
downloadfuzzycat-268e7948e6fa2ee9871430104f60bdab3212464c.tar.gz
fuzzycat-268e7948e6fa2ee9871430104f60bdab3212464c.zip
move towards data subdir
Diffstat (limited to 'tests/data/fetch.sh')
-rwxr-xr-xtests/data/fetch.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/data/fetch.sh b/tests/data/fetch.sh
new file mode 100755
index 0000000..8b2ad02
--- /dev/null
+++ b/tests/data/fetch.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Fetches release entity mentioned in verify.csv and cache them locally.
+
+set -e -u
+set -o pipefail
+
+API="https://api.fatcat.wiki/v0"
+CSV="verify.csv"
+
+# Just release ATM, but could extend to other types.
+mkdir -p release
+
+for ident in $(awk -F, '{print $1"\n"$2}' "$CSV"); do
+ dst="release/$ident"
+ if [ -f "$dst" ]; then
+ echo >&2 "[cached] $dst"
+ continue
+ fi
+ tempfile=$(mktemp)
+ curl -sL --fail "$API/release/$ident" | jq --sort-keys . >"$tempfile" && mv "$tempfile" "$dst"
+ echo >&2 "[fetched] $dst"
+done