diff options
author | Luke Murphy <lukewm@riseup.net> | 2018-01-02 19:04:16 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2018-01-06 19:36:09 +0100 |
commit | c604df8f0582b6b3b85c5df60ecc280fc8deb923 (patch) | |
tree | beb990f563fa46f709309585d7e9562c00cb034b | |
parent | 258b471597a8313b0aa9c0c3531eb8b5fce4596d (diff) | |
download | stylish-haskell-c604df8f0582b6b3b85c5df60ecc280fc8deb923.tar.gz |
Add scripts to run with pipe recipe.
Closes https://github.com/jaspervdj/stylish-haskell/issues/194.
-rw-r--r-- | README.markdown | 9 | ||||
-rwxr-xr-x | scripts/latest.sh | 21 | ||||
-rwxr-xr-x | scripts/stylish-haskell.sh | 4 |
3 files changed, 34 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 9ff46d7..1fe00be 100644 --- a/README.markdown +++ b/README.markdown @@ -149,6 +149,15 @@ Atom integration [ide-haskell]: https://atom.io/packages/ide-haskell [atom-beautify]: Https://atom.io/packages/atom-beautify +Using with Continuous Integration +--------------------------------- + +You can quickly grab the latest binary and run `stylish-haskell` like so: + + curl -sL https://raw.github.com/jaspervdj/stylish-haskell/master/scripts/latest.sh | sh -s . + +Where the `.` can be replaced with the arguments you pass to `stylish-haskell`. + Credits ------- diff --git a/scripts/latest.sh b/scripts/latest.sh new file mode 100755 index 0000000..7119530 --- /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 '\"[^\"]*-x86_64-linux\.tar\.gz\"' | sed s/\"//g | head -n1) +VERSION=$(echo $URL | sed -e 's/.*-\([\.0-9]\+\)-x86_64-linux\.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 $* diff --git a/scripts/stylish-haskell.sh b/scripts/stylish-haskell.sh new file mode 100755 index 0000000..a22712e --- /dev/null +++ b/scripts/stylish-haskell.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# Ported from https://github.com/ndmitchell/hlint/blob/master/misc/travis.sh + +curl -sL https://raw.github.com/jaspervdj/stylish-haskell/master/scripts/latest.sh | sh -s -- stylish-haskell $* |