summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvmchale <>2018-04-11 09:06:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-04-11 09:06:00 (GMT)
commit68edc2c6dcb789fbff8ba88e480730ca06cad356 (patch)
tree4d24d9f72e578f62b6daf5d5114781cda88fb24e
parenta3759f333ab821dfe359ab39acc9be04f5d57cfd (diff)
version 0.1.0.230.1.0.23
-rw-r--r--.travis.yml67
-rw-r--r--Justfile32
-rw-r--r--README.md2
-rw-r--r--app/Main.hs36
-rw-r--r--appveyor.yml36
-rw-r--r--cabal.project.local4
-rw-r--r--sh/check11
-rw-r--r--src/Toml/Checker.hs36
-rw-r--r--stack.yaml11
-rw-r--r--tomlcheck.cabal116
10 files changed, 83 insertions, 268 deletions
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 46aa494..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,67 +0,0 @@
----
-
-sudo: false
-language: default
-cache:
- directories:
- - $HOME/.stack
-addons:
- apt:
- packages:
- - libgmp3-dev
-matrix:
- include:
-
- # Linux
- - env: TARGET=x86_64-unkown-linux-gnu
-
- # OS X
- - env: TARGET=x86_64-apple-darwin
- os: osx
-
-before_install:
- - mkdir -p ~/.local/bin
- - export PATH=$HOME/.local/bin:$PATH
- - |
- if [ `uname` = "Darwin" ]
- then
- curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
- else
- curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
- fi
- - chmod a+x ~/.local/bin/stack
-
-install:
- - stack --no-terminal --install-ghc test --only-dependencies
- - stack install hlint weeder
-
-script:
- - stack update
- - stack --no-terminal build --haddock --no-haddock-deps
- - hlint .
- - weeder .
- - |
- if [ `uname` = "Darwin" ]
- then
- export BINPATH="$(find . -name tomlcheck -perm 755 | tail -n1)"
- else
- export BINPATH="$(find -name tomlcheck -executable | tail -n2 | head -n1)"
- fi
- - echo $BINPATH
- - mv $BINPATH tomlcheck-$TARGET
- - ls tomlcheck-$TARGET
- - curl -sL https://raw.githubusercontent.com/vmchale/tomlcheck/master/sh/check | sh -s
-
-deploy:
- api_key:
- secure: "j9WeKTBKsnRmrUqBEVfX1itilQ2bfrBb7yIVir4BsBksmwkozc7eNpBFvBi+nAVyZrEouJUi3RSU4UMoO3otIqKPsRpC1pV5+GlNV1Q0yrVQn9+Xi4wzrinzWJuLrFUn3c1yhUAue/XTTBDS7IZHUYRus9Fukr+QAIHjTWxXXX53n1r1OaKR/rcsN84yTFG71UjL60hV/99YE6GLtXvcOCaOgkrkK6N2xutvVYUyTB6U9n2UW8GruiWzB18gvC0TBYg3Sn/311U1gcmxCE0OUdD07grRTaTHnbC3btpaAEWnw8CAZeBQDbulEIFcmtoBeXN9rtx5Q+u6MRzQxGAh9p2ZbItdlm9Bg7PkCTWbPR+soNcw599CGTVLXipfnmkAExT+oo08MIp4qKj4IohHQhMRaUGr0z3aeubrRiVZA85KKB2SzQdYYY6vRDeisduCszlZ90odygvJ9DVcH9YtFY75nj8Vbdpgldzh7IjIgO1WaAizxy9IZZysh9NSRXdfzwixtwJ8p9qskwrg0qapa7t+tOk4GqFJFhcHhjDorFACsDSfayoJ50kbPCwMD3ZsXNFnPtFtQjOLgj8tXVz1EovrMIuj6oFXu6wFK9He5CUa8S9fgmR+GWOKE+GgGgWziC8CSZO3xr9KtwIUYT4Jw7zdX1ODDmJW39Hm6Mi+8AQ="
- file: tomlcheck-$TARGET
- on:
- tags: true
- provider: releases
- skip_cleanup: true
-
-branches:
- only:
- - master
- - /\d+\.\d+\.\d+\.\d+.*$/
diff --git a/Justfile b/Justfile
deleted file mode 100644
index 9f583a1..0000000
--- a/Justfile
+++ /dev/null
@@ -1,32 +0,0 @@
-tokei:
- @tokei -e README.md -e TODO.md -e data/ -e Justfile . .travis.yml
-
-clean:
- sn c .
-
-next:
- @export VERSION=$(cat tomlcheck.cabal | grep -P -o '\d+\.\d+\.\d+\.\d+' tomlcheck.cabal | head -n1 | awk -F. '{$NF+=1; print $0}' | sed 's/ /\./g') && echo $VERSION && sed -i "2s/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/$VERSION/" tomlcheck.cabal && sed -i "4,8s/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/$VERSION/" sh/check
- git commit -am "for release"
-
-bench:
- bench "tomlcheck --file data/sample.toml"
-
-upload:
- rm -rf dist/
- cabal sdist
- cabal upload $(fd '.tar.gz$' -IH) --publish
-
-install:
- cabal new-build -O2
- cp $(fd -IH 'tomlcheck$' | tail -n1) ~/.local/bin
-
-release:
- git tag "$(grep -P -o '\d+\.\d+\.\d+\.\d+' tomlcheck.cabal | head -n1)"
- git push origin --tags
- git tag -d "$(grep -P -o '\d+\.\d+\.\d+\.\d+' tomlcheck.cabal | head -n1)"
-
-name:
- github-release edit -s $(cat .git-token) -u vmchale -r tomlcheck -n "$(madlang run ~/programming/madlang/releases/releases.mad)" -t "$(grep -P -o '\d+\.\d+\.\d+\.\d+' tomlcheck.cabal | head -n1)"
-
-check:
- git diff master origin/master
diff --git a/README.md b/README.md
index a362735..b626237 100644
--- a/README.md
+++ b/README.md
@@ -32,5 +32,5 @@ Install [GHC](https://www.haskell.org/ghc/download.html) along with
Add the following your `.travis.yml` file to check a `.toml` file:
```yaml
- - curl -sL https://raw.githubusercontent.com/vmchale/tomlcheck/master/sh/check | sh -s
+ - curl -sL https://raw.githubusercontent.com/vmchale/tomlcheck/master/sh/check | sh -s Config.toml
```
diff --git a/app/Main.hs b/app/Main.hs
index 4464589..0adbf45 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -1,6 +1,36 @@
-module Main where
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TypeOperators #-}
-import Toml.Checker (exec)
+module Main
+ ( main
+ ) where
+
+import Control.Monad (zipWithM)
+import qualified Data.Text.IO as TIO
+import GHC.Generics (Generic)
+import Options.Generic
+import System.Exit (ExitCode (..), exitWith)
+import Text.Megaparsec (parseErrorPretty)
+import Text.Toml (parseTomlDoc)
+
+newtype Program = Program { file :: [FilePath] <?> "Path to file to be checked." }
+ deriving (Generic)
+
+programModifiers :: Modifiers
+programModifiers = defaultModifiers { shortNameModifier = firstLetter }
+
+instance ParseRecord Program where
+ parseRecord = parseRecordWithModifiers programModifiers
main :: IO ()
-main = exec
+main = do
+ x <- getRecord "Command-line wrapper around htoml"
+ let paths = unHelpful $ file x
+ contents <- traverse TIO.readFile paths
+ case zipWithM parseTomlDoc paths contents of
+ Right _ -> pure ()
+ Left e -> do
+ putStrLn $ parseErrorPretty e
+ exitWith (ExitFailure 1)
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 042004a..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,36 +0,0 @@
----
-
-build: off
-
-before_test:
- - set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
-
- - curl -sS -ostack.zip -L --insecure http://www.stackage.org/stack/windows-i386
- - 7z x stack.zip stack.exe
-
-clone_folder: "c:\\stack"
-environment:
- global:
- STACK_ROOT: "c:\\sr"
-
-test_script:
- - stack setup > nul
- - stack update
- - echo "" | stack --no-terminal install
- - ps: Get-ChildItem . -name -recurse tomlcheck.exe
- - ps: Copy-Item c:\stack\.stack-work\install\e6126bd7\bin\tomlcheck.exe tomlcheck-x86_64-pc-windows.exe
- - ps: Push-AppveyorArtifact tomlcheck-x86_64-pc-windows.exe
-
-deploy:
- artifacts: tomlcheck-x86_64-pc-windows.exe
- provider: GitHub
- on:
- appveyor_repo_tag: true
- auth_token:
- secure: 0qzMr6xmEwRoj/9TJOgDuW/LXWfGVM/4A7kvAXGe0BAwWCF13AWE2SARrYkyc3ji
-
-branches:
- only:
- # Release tags
- - master
- - /\d+\.\d+\.\d+\.\d+.*$/
diff --git a/cabal.project.local b/cabal.project.local
index e83a620..841bf2b 100644
--- a/cabal.project.local
+++ b/cabal.project.local
@@ -1,2 +1,2 @@
-optimization: 1
-constraints: tomlcheck +development +optimize
+optimization: 2
+constraints: tomlcheck +development
diff --git a/sh/check b/sh/check
deleted file mode 100644
index 4a02b66..0000000
--- a/sh/check
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env sh
-if [ "$(uname)" = "Darwin" ]
-then
- wget https://github.com/vmchale/tomlcheck/releases/download/0.1.0.19/tomlcheck-x86_64-apple-darwin -O tomlcheck
- chmod a+x tomlcheck
- ./tomlcheck --file data/sample.toml
-else
- wget https://github.com/vmchale/tomlcheck/releases/download/0.1.0.19/tomlcheck-x86_64-unkown-linux-gnu -O tomlcheck
- chmod a+x tomlcheck
- ./tomlcheck --file data/sample.toml
-fi
diff --git a/src/Toml/Checker.hs b/src/Toml/Checker.hs
deleted file mode 100644
index 55b0b6b..0000000
--- a/src/Toml/Checker.hs
+++ /dev/null
@@ -1,36 +0,0 @@
-{-# LANGUAGE DataKinds #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE TypeOperators #-}
-
-module Toml.Checker
- ( exec
- ) where
-
-import Control.Monad (zipWithM)
-import qualified Data.Text.IO as TIO
-import GHC.Generics (Generic)
-import Options.Generic
-import System.Exit (ExitCode (..), exitWith)
-import Text.Megaparsec (parseErrorPretty)
-import Text.Toml (parseTomlDoc)
-
-newtype Program = Program { file :: [FilePath] <?> "Path to file to be checked." }
- deriving (Generic)
-
-programModifiers :: Modifiers
-programModifiers = defaultModifiers { shortNameModifier = firstLetter }
-
-instance ParseRecord Program where
- parseRecord = parseRecordWithModifiers programModifiers
-
-exec :: IO ()
-exec = do
- x <- getRecord "Command-line wrapper around htoml"
- let paths = unHelpful $ file x
- contents <- traverse TIO.readFile paths
- case zipWithM parseTomlDoc paths contents of
- Right _ -> pure ()
- Left e -> do
- putStrLn $ parseErrorPretty e
- exitWith (ExitFailure 1)
diff --git a/stack.yaml b/stack.yaml
index cc45276..307ac11 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,11 +1,8 @@
-resolver: nightly-2017-10-13
+---
+resolver: lts-11.4
packages:
- './'
extra-deps:
- - megaparsec-6.2.0
- - htoml-megaparsec-1.0.1.11
- - composition-prelude-0.1.1.0
-flags:
- tomlcheck:
- optimize: true
+ - htoml-megaparsec-1.1.0.3
+ - composition-prelude-1.3.0.8
extra-package-dbs: []
diff --git a/tomlcheck.cabal b/tomlcheck.cabal
index 7bf63b1..04e970e 100644
--- a/tomlcheck.cabal
+++ b/tomlcheck.cabal
@@ -1,77 +1,47 @@
-name: tomlcheck
-version: 0.1.0.19
-synopsis: Command-line tool to check syntax of TOML files
-description: This is a command-line wrapper around htoml-megaparsec.
- It is intended to be used as a syntax checker that can be
- called by your text editor.
-homepage: https://github.com/vmchale/tomlcheck#readme
-license: BSD3
-license-file: LICENSE
-author: Vanessa McHale
-maintainer: vanessa.mchale@reconfigure.io
-copyright: Copyright: (c) 2017 Vanessa McHale
-category: Toml, Data
-build-type: Simple
-extra-source-files: cabal.project.local
- , stack.yaml
-cabal-version: >=1.18
-Data-files: .travis.yml
- , appveyor.yml
- , Justfile
- , sh/check
-Extra-doc-files: README.md
+cabal-version: 1.18
+name: tomlcheck
+version: 0.1.0.23
+license: BSD3
+license-file: LICENSE
+copyright: Copyright: (c) 2017-2018 Vanessa McHale
+maintainer: vamchale@gmail.com
+author: Vanessa McHale
+synopsis: Command-line tool to check syntax of TOML files
+description:
+ This is a command-line wrapper around htoml-megaparsec.
+ It is intended to be used as a syntax checker that can be
+ called by your text editor.
+category: Toml, Data
+build-type: Simple
+extra-source-files:
+ cabal.project.local
+ stack.yaml
+extra-doc-files: README.md
-Flag optimize {
- Description: Optimize with -O2
- default: False
-}
-
-Flag native {
- Description: Target current CPU
- manual: True
- default: False
-}
-
-Flag development {
- Description: Enable `-Werror`
- manual: True
- default: False
-}
+source-repository head
+ type: git
+ location: https://github.com/vmchale/tomlcheck
-library
- hs-source-dirs: src
- exposed-modules: Toml.Checker
- build-depends: base >= 4.8 && < 5
- , htoml-megaparsec >= 1.0.1.11
- , optparse-generic
- , megaparsec >= 6.0
- , text
- default-language: Haskell2010
- if flag(native)
- ghc-options: -opta-mtune=native -optc-mtune=native
- if flag(development) && impl(ghc >= 8.0)
- ghc-options: -Werror
- if impl(ghc >= 8.0)
- ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat
- ghc-options: -Wall
+flag development
+ description:
+ Enable `-Werror`
+ default: False
+ manual: True
executable tomlcheck
- hs-source-dirs: app
- main-is: Main.hs
- -- ghc-options: -threaded -rtsopts -with-rtsopts=-N
- build-depends: base
- , tomlcheck
- default-language: Haskell2010
- if flag(native)
- ghc-options: -opta-mtune=native -optc-mtune=native
- if flag(optimize)
- ghc-options: -O2
- if flag(development)
- ghc-options: -Werror
- if impl(ghc >= 8.0)
- ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat
- ghc-options: -Wall
-
-source-repository head
- type: git
- location: https://github.com/vmchale/tomlcheck
+ main-is: Main.hs
+ hs-source-dirs: app
+ default-language: Haskell2010
+ ghc-options: -Wall
+ build-depends:
+ base >=4.8 && <5,
+ htoml-megaparsec >=1.0.1.11,
+ optparse-generic -any,
+ megaparsec >=6.0,
+ text -any
+
+ if flag(development)
+ ghc-options: -Werror
+
+ if impl(ghc >=8.0)
+ ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates