summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Roeser <le.petit.fou@web.de>2019-06-18 16:13:20 +0200
committerTobias Roeser <le.petit.fou@web.de>2019-06-21 22:46:59 +0200
commitaa069edcbb6687a494979a1f5b1363f88079cfa0 (patch)
treead7fd05e9767ee97600de3ea0662a05457ccea99
parent6b81303190e49b94f32c96c4253356afcb25becc (diff)
downloadmill-aa069edcbb6687a494979a1f5b1363f88079cfa0.tar.gz
mill-aa069edcbb6687a494979a1f5b1363f88079cfa0.tar.bz2
mill-aa069edcbb6687a494979a1f5b1363f88079cfa0.zip
Added millw script and config file
-rw-r--r--.mill-version1
-rwxr-xr-xmillw59
2 files changed, 60 insertions, 0 deletions
diff --git a/.mill-version b/.mill-version
new file mode 100644
index 00000000..267577d4
--- /dev/null
+++ b/.mill-version
@@ -0,0 +1 @@
+0.4.1
diff --git a/millw b/millw
new file mode 100755
index 00000000..52752912
--- /dev/null
+++ b/millw
@@ -0,0 +1,59 @@
+#!/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 parameter
+# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
+
+DEFAULT_MILL_VERSION=0.4.1
+
+set -e
+
+if [ -f ".mill-version" ] ; then
+ MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)"
+fi
+
+if [ "x$1" = "x--mill-version" ] ; then
+ shift
+ if [ "x$1" != "x" ] ; then
+ MILL_VERSION="$1"
+ shift
+ else
+ echo "You specified --mill-version without a version."
+ echo "Please provide a version that matches one provided on"
+ echo "https://github.com/lihaoyi/mill/releases"
+ false
+ fi
+fi
+
+MILL_DOWNLOAD_PATH="${HOME}/.mill/download"
+
+if [ "x${MILL_VERSION}" = "x" ] ; then
+ // TODO: try to load latest version from release page
+ echo -n "Retrieving latest mill version..."
+ if [ -e "${MILL_DOWNLOAD_PATH}/.latest" ] ; then
+
+ MILL_VERSION="$(head -n 1 \"${MILL_DOWNLOAD_PATH}/.latest\" 2> /dev/null)"
+ fi
+
+ // Last resort
+ if [ "x${MILL_VERSION}" = "x" ] ; then
+ MILL_VERSION="${DEFAULT_MILL_VERSION}"
+ fi
+fi
+
+MILL="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}"
+
+if [ ! -x "${MILL}" ] ; then
+ DOWNLOAD_FILE=$(mktemp mill.XXXX)
+ # TODO: handle command not found
+ curl -L -o "${DOWNLOAD_FILE}" "https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION%%-*}/${MILL_VERSION}"
+ chmod +x "${DOWNLOAD_FILE}"
+ mkdir -p "${MILL_DOWNLOAD_PATH}"
+ mv "${DOWNLOAD_FILE}" "${MILL}"
+ unset DOWNLOAD_FILE
+fi
+
+unset MILL_DOWNLOAD_PATH
+unset MILL_VERSION
+
+exec $MILL "$@"