summaryrefslogtreecommitdiff
path: root/mill
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2019-06-29 22:20:40 -0700
committerLi Haoyi <haoyi.sg@gmail.com>2019-06-29 22:20:40 -0700
commit020e284847b79f94013a8bb56c20314376829ca8 (patch)
treef7bbbc8e2287ab815ba48677a7308e2527b06bf8 /mill
parenta9bb44e70fafe45e7ba5167d6a4726a93ec32eb4 (diff)
downloadmill-020e284847b79f94013a8bb56c20314376829ca8.tar.gz
mill-020e284847b79f94013a8bb56c20314376829ca8.tar.bz2
mill-020e284847b79f94013a8bb56c20314376829ca8.zip
add simple mill wrapper script
Diffstat (limited to 'mill')
-rwxr-xr-xmill32
1 files changed, 32 insertions, 0 deletions
diff --git a/mill b/mill
new file mode 100755
index 00000000..74f1d62f
--- /dev/null
+++ b/mill
@@ -0,0 +1,32 @@
+#!/usr/bin/env sh
+
+# This is a wrapper script, that automatically download mill from GitHub release pages
+# You can give the required mill version with MILL_VERSION env variable
+# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
+DEFAULT_MILL_VERSION=0.4.2
+
+set -e
+
+if [ -z "$MILL_VERSION" ] ; then
+ MILL_VERSION=$DEFAULT_MILL_VERSION
+fi
+
+MILL_DOWNLOAD_PATH="$HOME/.mill/download"
+MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/$MILL_VERSION"
+
+if [ ! -x "$MILL_EXEC_PATH" ] ; then
+ mkdir -p $MILL_DOWNLOAD_PATH
+ DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download
+ MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION%%-*}/$MILL_VERSION"
+ curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL"
+ chmod +x "$DOWNLOAD_FILE"
+ mkdir -p "$MILL_DOWNLOAD_PATH"
+ mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH"
+ unset DOWNLOAD_FILE
+ unset MILL_DOWNLOAD_URL
+fi
+
+unset MILL_DOWNLOAD_PATH
+unset MILL_VERSION
+
+exec $MILL_EXEC_PATH "$@" \ No newline at end of file