diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2019-07-08 01:28:14 +0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2019-07-08 01:28:14 +0800 |
commit | 05e4309be03fb2e4144ccafa03160609e2ed0278 (patch) | |
tree | 8ed90db7907ca774ce95d6f9987a346d0582f743 | |
parent | 79a63fb3f12e9fc856e22cdc5eba9095ad882051 (diff) | |
download | mill-05e4309be03fb2e4144ccafa03160609e2ed0278.tar.gz mill-05e4309be03fb2e4144ccafa03160609e2ed0278.tar.bz2 mill-05e4309be03fb2e4144ccafa03160609e2ed0278.zip |
.
-rwxr-xr-x | mill | 4 | ||||
-rwxr-xr-x | millw | 59 |
2 files changed, 4 insertions, 59 deletions
@@ -7,6 +7,10 @@ DEFAULT_MILL_VERSION=0.4.2 set -e +if [ -f ".mill-version" ] ; then + MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)" +fi + if [ -z "$MILL_VERSION" ] ; then MILL_VERSION=$DEFAULT_MILL_VERSION fi @@ -1,59 +0,0 @@ -#!/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 "$@" |