From 51631e2d2d5b6b83f84917f36477dd79c3457ea2 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Tue, 26 Dec 2017 12:09:26 +0100 Subject: Add .circleci/config.yml --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.markdown') diff --git a/README.markdown b/README.markdown index 7191059..4ee7679 100644 --- a/README.markdown +++ b/README.markdown @@ -1,7 +1,7 @@ stylish-haskell =============== -[![Build Status](https://secure.travis-ci.org/jaspervdj/stylish-haskell.svg?branch=master)](http://travis-ci.org/jaspervdj/stylish-haskell) +[![Build Status](https://img.shields.io/circleci/project/github/jaspervdj/stylish-haskell.svg)](https://circleci.com/gh/jaspervdj/stylish-haskell) Introduction ------------ -- cgit v1.2.3 From 336220ca9f3e1ab9091651d60a9491386f77b7ed Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 26 Dec 2017 13:54:48 +0100 Subject: Add platform specific configuration paths --- README.markdown | 8 ++++++-- lib/Language/Haskell/Stylish/Config.hs | 11 ++++++----- stylish-haskell.cabal | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'README.markdown') diff --git a/README.markdown b/README.markdown index 4ee7679..9ff46d7 100644 --- a/README.markdown +++ b/README.markdown @@ -95,9 +95,13 @@ following order: settings) 3. `.stylish-haskell.yaml` in the nearest ancestor directory (useful for per-project settings) -4. `.stylish-haskell.yaml` in your home directory (useful for user-wide +4. `stylish-haskell/config.yaml` in the platform’s configuration directory + (on Windows, it is %APPDATA%, elsewhere it defaults to `~/.config` and + can be overridden by the `XDG_CONFIG_HOME` environment variable; + useful for user-wide settings) +5. `.stylish-haskell.yaml` in your home directory (useful for user-wide settings) -5. The default settings. +6. The default settings. Use `stylish-haskell --defaults > .stylish-haskell.yaml` to dump a well-documented default configuration to a file, this way you can get started diff --git a/lib/Language/Haskell/Stylish/Config.hs b/lib/Language/Haskell/Stylish/Config.hs index 9fddbb5..8952790 100644 --- a/lib/Language/Haskell/Stylish/Config.hs +++ b/lib/Language/Haskell/Stylish/Config.hs @@ -73,12 +73,13 @@ defaultConfigFilePath = getDataFileName "data/stylish-haskell.yaml" configFilePath :: Verbose -> Maybe FilePath -> IO FilePath configFilePath _ (Just userSpecified) = return userSpecified configFilePath verbose Nothing = do - current <- getCurrentDirectory - home <- getHomeDirectory - def <- defaultConfigFilePath - mbConfig <- search $ + current <- getCurrentDirectory + configPath <- getXdgDirectory XdgConfig "stylish-haskell" + home <- getHomeDirectory + def <- defaultConfigFilePath + mbConfig <- search $ [d configFileName | d <- ancestors current] ++ - [home configFileName, def] + [configPath "config.yaml", home configFileName, def] case mbConfig of Just config -> return config diff --git a/stylish-haskell.cabal b/stylish-haskell.cabal index a1716ef..4938334 100644 --- a/stylish-haskell.cabal +++ b/stylish-haskell.cabal @@ -125,7 +125,7 @@ Test-suite stylish-haskell-tests base >= 4.8 && < 5, bytestring >= 0.9 && < 0.11, containers >= 0.3 && < 0.6, - directory >= 1.1 && < 1.4, + directory >= 1.2.3 && < 1.4, filepath >= 1.1 && < 1.5, haskell-src-exts >= 1.18 && < 1.21, mtl >= 2.0 && < 2.3, -- cgit v1.2.3 From c604df8f0582b6b3b85c5df60ecc280fc8deb923 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Tue, 2 Jan 2018 19:04:16 +0100 Subject: Add scripts to run with pipe recipe. Closes https://github.com/jaspervdj/stylish-haskell/issues/194. --- README.markdown | 9 +++++++++ scripts/latest.sh | 21 +++++++++++++++++++++ scripts/stylish-haskell.sh | 4 ++++ 3 files changed, 34 insertions(+) create mode 100755 scripts/latest.sh create mode 100755 scripts/stylish-haskell.sh (limited to 'README.markdown') 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 $* -- cgit v1.2.3