-
Notifications
You must be signed in to change notification settings - Fork 15
/
update-assets.sh
executable file
·37 lines (29 loc) · 1.42 KB
/
update-assets.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p jq wget
rm -r javascript/generated
hfile="src/Eventlog/AssetVersions.hs"
echo "-- Generated by ./update-assets.sh" > $hfile
echo "module Eventlog.AssetVersions where" >> $hfile
for row in $(cat versions.json | jq -r '.[] | @base64'); do
_jq(){
echo ${row} | base64 --decode | jq -r ${1}
}
version=$(_jq '.version')
raw_url=$(_jq '.url')
raw_name=$(_jq '.hname')
url=${raw_url/<>/$version}
wget -P javascript/generated $url
echo "${raw_name}Version,${raw_name}URL :: String" >> $hfile
echo "${raw_name}Version = \"$version\"" >> $hfile
echo "${raw_name}URL = \"$url\"" >> $hfile
done
tmp_dir=$(mktemp -d)
wget -P $tmp_dir https://datatables.net/media/images/sort_asc.png
wget -P $tmp_dir https://datatables.net/media/images/sort_desc.png
wget -P $tmp_dir https://datatables.net/media/images/sort_both.png
b1=$(cat $tmp_dir/sort_asc.png | base64 -w0)
b2=$(cat $tmp_dir/sort_desc.png | base64 -w0)
b3=$(cat $tmp_dir/sort_both.png | base64 -w0)
echo "table.dataTable thead .sorting_asc { background-image: url(data:image/png;base64,$b1) !important }" > javascript/generated/overide_images.css
echo "table.dataTable thead .sorting_desc { background-image: url(data:image/png;base64,$b2) !important }" >> javascript/generated/overide_images.css
echo "table.dataTable thead .sorting { background-image: url(data:image/png;base64,$b3) }" >> javascript/generated/overide_images.css