| author | Tomas Zeman <tomas@functionals.cz> |
| Tue, 15 Dec 2020 09:22:21 +0100 | |
| changeset 60 | 4267602e8494 |
| permissions | -rwxr-xr-x |
|
60
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
1 |
#!/usr/bin/env sh |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
2 |
|
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
3 |
# This is a wrapper script, that automatically download ammonite from GitHub release pages |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
4 |
# You can give the required mill version with AMM_VERSION env variable |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
5 |
# If no version is given, it falls back to the value of DEFAULT_AMM_VERSION |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
6 |
DEFAULT_AMM_VERSION=2.3.8 |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
7 |
|
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
8 |
set -e |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
9 |
|
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
10 |
if [ -z "$AMM_VERSION" ] ; then |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
11 |
AMM_VERSION=$DEFAULT_AMM_VERSION |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
12 |
fi |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
13 |
|
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
14 |
AMM_DOWNLOAD_PATH="$HOME/.ammonite/download" |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
15 |
AMM_EXEC_PATH="${AMM_DOWNLOAD_PATH}/$AMM_VERSION"
|
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
16 |
|
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
17 |
if [ ! -x "$AMM_EXEC_PATH" ] ; then |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
18 |
mkdir -p $AMM_DOWNLOAD_PATH |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
19 |
DOWNLOAD_FILE=$AMM_EXEC_PATH-tmp-download |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
20 |
AMM_DOWNLOAD_URL="https://github.com/lihaoyi/ammonite/releases/download/${AMM_VERSION%%-*}/2.13-$AMM_VERSION"
|
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
21 |
curl --fail -L -o "$DOWNLOAD_FILE" "$AMM_DOWNLOAD_URL" |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
22 |
chmod +x "$DOWNLOAD_FILE" |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
23 |
mv "$DOWNLOAD_FILE" "$AMM_EXEC_PATH" |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
24 |
unset DOWNLOAD_FILE |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
25 |
unset AMM_DOWNLOAD_URL |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
26 |
fi |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
27 |
|
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
28 |
unset AMM_DOWNLOAD_PATH |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
29 |
unset AMM_VERSION |
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
30 |
|
|
4267602e8494
fs2json: directory structure -> json object converter.
Tomas Zeman <tomas@functionals.cz>
parents:
diff
changeset
|
31 |
exec $AMM_EXEC_PATH "$@" |