packages feed

shadower 0.1.0.4 → 0.1.0.5

raw patch · 3 files changed

+16/−48 lines, 3 filesdep +mtldep +safe

Dependencies added: mtl, safe

Files

shadower.cabal view
@@ -1,5 +1,5 @@ name:                shadower-version:             0.1.0.4+version:             0.1.0.5 synopsis:            An automated way to run doctests in files that are changing description:         Shadower watches folders with Haskell sources, and runs doctests in files that are modified homepage:            http://github.com/karun012/shadower@@ -13,6 +13,14 @@  executable shadower   default-language:   Haskell2010-  build-depends:      base >4 && <5, fsnotify, process, system-filepath, text, filemanip, MissingH, doctest+  build-depends:      base >4 && <5, fsnotify, process, system-filepath, text, filemanip, MissingH, doctest, safe >=0.3.3, mtl   main-is:            Shadower.hs    HS-Source-Dirs:     src++test-suite doctests+  default-language:   Haskell2010+  type:               exitcode-stdio-1.0+  ghc-options:        -threaded+  main-is:            doctests.hs+  build-depends:      base >4 && <5, fsnotify, process, system-filepath, text, filemanip, MissingH, doctest, safe >=0.3.3, mtl+  HS-Source-Dirs:     test
src/Shadower.hs view
@@ -2,52 +2,9 @@   module Main where -import Filesystem.Path.CurrentOS (fromText, encodeString)-import Filesystem.Path (parent)-import Data.Text (pack)-import Data.String.Utils--import Control.Exception-import qualified Control.Exception as E--import System.FSNotify+import ShadowerFunctions import System.Environment-import System.Exit--import Test.DocTest+import Control.Applicative  main :: IO ()-main = getArgs >>= getFilePathFromArgs >>= watchPath--getFilePathFromArgs :: [String] -> IO FilePath-getFilePathFromArgs (filePath:_) = return filePath-getFilePathFromArgs []       = return "."--watchPath :: FilePath -> IO ()-watchPath path = withManager $ \manager -> do-       _ <- watchTree manager (fromText $ pack path) (const True) handler-       _ <- getLine-       exitSuccess--handler :: Event -> IO()-handler action = case action of -                 Modified file _ -> maybeRunDocTests (encodeString file)-                 _ -> return ()--maybeRunDocTests :: String -> IO ()-maybeRunDocTests file = case isHaskellSource file of -                   True -> E.catch (runDocTests file) ignoreAllExceptions-                   _ -> return ()--ignoreAllExceptions :: SomeException -> IO ()-ignoreAllExceptions _ = return ()--runDocTests :: String -> IO ()-runDocTests file = do-              _ <- putStrLn $ "Running doctests in " ++ file-              doctest $ generateAllSourceLocations file ++ [file]-generateAllSourceLocations :: String -> [String]-generateAllSourceLocations "/" = []-generateAllSourceLocations xs = (generateAllSourceLocations $ encodeString $ parent $ fromText $ pack xs) ++ ["-i" ++ (encodeString $ parent $ fromText $ pack xs)]-isHaskellSource :: String -> Bool-isHaskellSource file = endswith ".hs" file || endswith ".lhs" file+main = getFilePathFromArgs <$> getArgs >>= watchPath
+ test/doctests.hs view
@@ -0,0 +1,3 @@+import Test.DocTest++main = doctest["-isrc", "src/Shadower.hs"]