zifter-stack 0.0.0.2 → 0.0.0.4
raw patch · 2 files changed
+30/−10 lines, 2 filesdep +safe
Dependencies added: safe
Files
- src/Zifter/Stack.hs +27/−8
- zifter-stack.cabal +3/−2
src/Zifter/Stack.hs view
@@ -5,7 +5,9 @@ import Data.List (isInfixOf) import Path import Path.IO+import Safe import System.Exit (ExitCode(..))+import qualified System.FilePath as FP (splitPath) import System.IO import System.Process @@ -41,7 +43,7 @@ (_, fs) <- liftIO $ listDirRecur rd let cabalFiles = filter (not . isInfixOf ".stack-work" . toFilePath) $- filter ((== ".cabal") . fileExtension) fs+ filter (not . hidden) $ filter ((== ".cabal") . fileExtension) fs (concat <$>) $ forM cabalFiles $ \cabalFile -> do pd <-@@ -64,12 +66,21 @@ let stack :: String -> Zift () stack args = do let buildCmd = unwords ["stack", args]- bec <-- liftIO $ do- (_, _, _, bph) <-- createProcess- ((shell buildCmd) {cwd = Just $ toFilePath rd})- waitForProcess bph+ (_, mouth, merrh, bph) <-+ liftIO $+ createProcess+ ((shell buildCmd)+ { cwd = Just $ toFilePath rd+ , std_out = CreatePipe+ , std_err = CreatePipe+ })+ bec <- liftIO $ waitForProcess bph+ case mouth of+ Nothing -> pure ()+ Just outh -> liftIO (hGetContents outh) >>= printZift+ case merrh of+ Nothing -> pure ()+ Just errh -> liftIO (hGetContents errh) >>= printZift case bec of ExitFailure c -> fail $ unwords [buildCmd, "failed with exit code", show c]@@ -80,4 +91,12 @@ forM_ tups $ \(package_, targets) -> do stack $ unwords ["clean", package_] forM_ targets $ \target ->- stack $ unwords ["build --pedantic --haddock --test", target]+ stack $+ unwords+ [ "build --pedantic --haddock --test"+ , target+ , "--test-arguments='--fail-fast --seed=42'"+ ]++hidden :: Path Abs t -> Bool+hidden = any ((Just '.' ==) . headMay) . FP.splitPath . toFilePath
zifter-stack.cabal view
@@ -1,5 +1,5 @@ name: zifter-stack-version: 0.0.0.2+version: 0.0.0.4 cabal-version: >=1.10 build-type: Simple license: MIT@@ -18,13 +18,14 @@ Zifter.Stack build-depends: base >=4.9 && <=5,+ Cabal >=1.24 && <1.25, process -any, filepath >=1.4 && <1.5, directory -any, zifter >=0.0 && <0.1, path >=0.5 && <0.6, path-io >=1.2 && <1.3,- Cabal >=1.24 && <1.25+ safe >=0.3 && <0.4 default-language: Haskell2010 hs-source-dirs: src/ ghc-options: -Wall