packages feed

keera-posture 0.2.4.1 → 0.2.4.3

raw patch · 4 files changed

+167/−44 lines, 4 filesdep +hlintdep +regex-posixdep ~base

Dependencies added: hlint, regex-posix

Dependency ranges changed: base

Files

CHANGELOG view
@@ -1,3 +1,8 @@+2017-06-15 Ivan Perez <ivan.perez@keera.co.uk>++        * keera-posture.cabal: Bump (0.2.4.3).+        * Adds SDL_mixer as dependency on every OS (needed by Launchpad PPA).+ 2017-05-08 Ivan Perez <ivan.perez@keera.co.uk>          * keera-posture.cabal: Bump (0.2.4.1).
keera-posture.cabal view
@@ -1,75 +1,41 @@--- auto-generated by cabal init. For additional options, see--- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr.--- The name of the package. Name:                keera-posture---- The package version. See the Haskell package versioning policy--- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for--- standards guiding when and how versions should be incremented.-Version:             0.2.4.1---- A short (one-line) description of the package.+Version:             0.2.4.3 Synopsis:            Get notifications when your sitting posture is inappropriate.---- A longer description of the package. Description:         A program that notifies when you sit in a straining position.---- URL for the project homepage or repository. Homepage:            http://keera.co.uk/projects/keera-posture---- The license under which the package is released. License:             OtherLicense---- The file containing the license text. License-file:        LICENSE---- The package author(s). Author:              Ivan Perez---- An email address to which users can send suggestions, bug reports,--- and patches. Maintainer:          support@keera.co.uk --- A copyright notice.--- Copyright:---- Stability of the package (experimental, provisional, stable...)--- Stability:           Experimental--Tested-With:         GHC == 7.6.3-+Copyright:           2010-2017 Keera Studios+Tested-With:         GHC == 7.8.4 Category:            AI- Build-type:          Simple  Data-files: data/Interface.glade data/warning.wav data/*.png data/haarcascade_frontalface_alt.xml --- Extra files to be distributed with the package, such as examples or--- a README. Extra-source-files:  README                      CHANGELOG --- Constraint on the version of Cabal needed to build this package.-Cabal-version:       >=1.6+cabal-version:       >= 1.10  Executable keera-posture-  -- .hs or .lhs file containing the Main module.+  default-language: Haskell2010+   Main-is: Main.hs   hs-source-dirs: src/    if os(windows)-   ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O2-   -- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O2 -optl-mwindows-   -- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O2 -rtsopts=all+   ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O2 -optl-mwindows   else    ghc-options: -threaded -Wall -fno-warn-unused-do-bind    -- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O2 obj/OpenCVGtkPixbuf.o -  if os(windows)-   extra-libraries: SDL_mixer+  -- if os(windows)+  -- TODO: This should be in SDL-mixer, shouldn't it?+  extra-libraries: SDL_mixer -  -- Packages needed in order to build this package.-  -- Build-depends:   if os(windows)     Build-depends: base >= 4.0 && < 5,                    containers,@@ -214,3 +180,41 @@ source-repository head   type:     git   location: https://github.com/keera-studios/keera-posture.git++-- You can disable the hlint test suite with -f-test-hlint+flag test-hlint+  default: False+  manual: True++-- You can disable the haddock coverage test suite with -f-test-doc-coverage+flag test-doc-coverage+  default: False+  manual: True++test-suite hlint+  type: exitcode-stdio-1.0+  main-is: hlint.hs+  hs-source-dirs: tests+  if !flag(test-hlint)+    buildable: False+  else+    build-depends:+      base,+      hlint >= 1.7++-- Verify that the code is thoroughly documented+test-suite haddock-coverage+  type: exitcode-stdio-1.0+  main-is: HaddockCoverage.hs+  ghc-options: -Wall+  hs-source-dirs: tests++  if !flag(test-doc-coverage)+    buildable: False+  else+    build-depends:+      base >= 4 && < 5,+      directory,+      filepath,+      process,+      regex-posix
+ tests/HaddockCoverage.hs view
@@ -0,0 +1,91 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Main (HaddockCoverage)+-- Copyright   :  (C) 2015 Ivan Perez+-- License     :  BSD-style (see the file LICENSE)+-- Maintainer  :  Ivan Perez <ivan.perez@keera.co.uk>+-- Stability   :  provisional+-- Portability :  portable+--+-- Copyright notice: This file borrows code+-- https://hackage.haskell.org/package/lens-4.7/src/tests/doctests.hsc+-- which is itself licensed BSD-style as well.+--+-- Run haddock on a source tree and report if anything in any+-- module is not documented.+-----------------------------------------------------------------------------+module Main where++import Control.Applicative+import Control.Monad+import Data.List+import System.Directory+import System.Exit+import System.FilePath+import System.IO+import System.Process+import Text.Regex.Posix++main :: IO ()+main = do+  -- Find haskell modules+  -- TODO: Ideally cabal should do this (provide us with the+  -- list of modules). An alternative would be to use cabal haddock+  -- but that would need a --no-html argument or something like that.+  -- Alternatively, we could use cabal haddock with additional arguments.+  --+  -- See:+  -- https://github.com/keera-studios/haddock/commit/d5d752943c4e5c6c9ffcdde4dc136fcee967c495+  -- https://github.com/haskell/haddock/issues/309#issuecomment-150811929+  files <- getSources++  let haddockArgs = [ "--no-warnings", "--ignore-all-exports" ] ++ files+  let cabalArgs   = [ "exec", "--", "haddock" ] ++ haddockArgs+  (code, out, _err) <- readProcessWithExitCode "cabal" cabalArgs ""++  -- Filter out coverage lines, and find those that denote undocumented+  -- modules.+  --+  -- TODO: is there a way to annotate a function as self-documenting,+  -- in the same way we do with ANN for hlint?+  let isIncompleteModule :: String -> Bool+      isIncompleteModule line = isCoverageLine line && not (line =~ "^ *100%")+        where isCoverageLine :: String -> Bool+              isCoverageLine line = line =~ "^ *[0-9]+%"++  let incompleteModules :: [String]+      incompleteModules = filter isIncompleteModule $ lines out++  -- Based on the result of haddock, report errors and exit.+  -- Note that, unline haddock, this script does not+  -- output anything to stdout. It uses stderr instead+  -- (as it should).+  case (code, incompleteModules) of+    (ExitSuccess  , []) -> return ()+    -- (ExitFailure _, _)  -> exitFailure+    (_            , _)  -> do+      hPutStrLn stderr "The following modules are not fully documented:"+      mapM_ (hPutStrLn stderr) incompleteModules+      exitFailure++getSources :: IO [FilePath]+getSources = filter isHaskellFile <$> go "src"+  where+    go dir = do+      (dirs, files) <- getFilesAndDirectories dir+      (files ++) . concat <$> mapM go dirs++    isHaskellFile fp = (isSuffixOf ".hs" fp || isSuffixOf ".lhs" fp)+                     && not (any (`isSuffixOf` fp) excludedFiles)++    excludedFiles = [ ]++getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath])+getFilesAndDirectories dir = do+  c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir+  (,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c++-- find-based implementation (not portable)+--+-- getSources :: IO [FilePath]+-- getSources = fmap lines $ readProcess "find" ["src/", "-iname", "*hs"] ""
+ tests/hlint.hs view
@@ -0,0 +1,23 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Main (hlint)+-- Copyright   :  (C) 2013 Edward Kmett+-- License     :  BSD-style (see the file LICENSE)+-- Maintainer  :  Edward Kmett <ekmett@gmail.com>+-- Stability   :  provisional+-- Portability :  portable+--+-- This module runs HLint on the lens source tree.+-----------------------------------------------------------------------------+module Main where++import Control.Monad+import Language.Haskell.HLint+import System.Environment+import System.Exit++main :: IO ()+main = do+    args <- getArgs+    hints <- hlint $ ["src", "--cross", "--hint=tests/HLint.hs" ] ++ args+    unless (null hints) exitFailure