File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -7,4 +7,6 @@ bin/configlet
7
7
bin /configlet.exe
8
8
bin /exercise
9
9
bin /exercise.exe
10
+ bin /canonical_data_syncer
11
+ bin /canonical_data_syncer.exe
10
12
exercises /* /Cargo.lock
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -eo pipefail
4
+
5
+ readonly LATEST=' https://api.github.com/repos/exercism/canonical-data-syncer/releases/latest'
6
+
7
+ case " $( uname) " in
8
+ (Darwin* ) OS=' mac' ;;
9
+ (Linux* ) OS=' linux' ;;
10
+ (Windows* ) OS=' windows' ;;
11
+ (MINGW* ) OS=' windows' ;;
12
+ (MSYS_NT-* ) OS=' windows' ;;
13
+ (* ) OS=' linux' ;;
14
+ esac
15
+
16
+ case " $OS " in
17
+ (windows* ) EXT=' zip' ;;
18
+ (* ) EXT=' tgz' ;;
19
+ esac
20
+
21
+ case " $( uname -m) " in
22
+ (* 64* ) ARCH=' 64bit' ;;
23
+ (* 686* ) ARCH=' 32bit' ;;
24
+ (* 386* ) ARCH=' 32bit' ;;
25
+ (* ) ARCH=' 64bit' ;;
26
+ esac
27
+
28
+ if [ -z " ${GITHUB_TOKEN} " ]
29
+ then
30
+ HEADER=' '
31
+ else
32
+ HEADER=" authorization: Bearer ${GITHUB_TOKEN} "
33
+ fi
34
+
35
+ FILENAME=" canonical_data_syncer-${OS} -${ARCH} .${EXT} "
36
+
37
+ get_url () {
38
+ curl --header " $HEADER " -s " $LATEST " |
39
+ awk -v filename=$FILENAME ' $1 ~ /browser_download_url/ && $2 ~ filename { print $2 }' |
40
+ tr -d ' "'
41
+ }
42
+
43
+ URL=$( get_url)
44
+
45
+ case " $EXT " in
46
+ (* zip)
47
+ curl --header " $HEADER " -s --location " $URL " -o bin/latest-canonical_data_syncer.zip
48
+ unzip bin/latest-canonical_data_syncer.zip -d bin/
49
+ rm bin/latest-canonical_data_syncer.zip
50
+ ;;
51
+ (* ) curl --header " $HEADER " -s --location " $URL " | tar xz -C bin/ ;;
52
+ esac
You can’t perform that action at this time.
0 commit comments