summaryrefslogtreecommitdiffhomepage
path: root/scripts/latest.sh
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2018-05-13 10:42:46 -0700
committerSean Whitton <spwhitton@spwhitton.name>2018-05-13 10:42:46 -0700
commitb3102087ce4cfceb395ce981c4ac167a9d6b7642 (patch)
tree1feb8e3fd4a877a765afa6efa6c2a3be35dcbd7a /scripts/latest.sh
parent01298b15d95aec5945be8c5839045763d57657fc (diff)
parent7fac380bd83d51191e223560449d808e323d7ca6 (diff)
downloadstylish-haskell-b3102087ce4cfceb395ce981c4ac167a9d6b7642.tar.gz
Merge tag 'v0.9.2.0'
v0.9.2.0
Diffstat (limited to 'scripts/latest.sh')
-rwxr-xr-xscripts/latest.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/latest.sh b/scripts/latest.sh
new file mode 100755
index 0000000..dc5c345
--- /dev/null
+++ b/scripts/latest.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Ported from https://raw.githubusercontent.com/ndmitchell/neil/master/misc/travis.sh
+
+set -e
+
+PACKAGE=stylish-haskell
+echo Downloading and running $PACKAGE...
+
+RELEASES=$(curl --silent https://github.com/jaspervdj/$PACKAGE/releases)
+URL=https://github.com/$(echo $RELEASES | grep -o '\"[^\"]*-linux-x86_64\.tar\.gz\"' | sed s/\"//g | head -n1)
+VERSION=$(echo $URL | sed -e 's/.*-\([\.0-9]\+\)-linux-x86_64\.tar\.gz/\1/')
+TEMP=$(mktemp --directory .$PACKAGE-XXXXX)
+
+cleanup(){
+ rm -r $TEMP
+}
+trap cleanup EXIT
+
+curl --progress-bar --location -o$TEMP/$PACKAGE.tar.gz $URL
+tar -xzf $TEMP/$PACKAGE.tar.gz -C$TEMP
+$TEMP/$PACKAGE-$VERSION/$PACKAGE $*