ngx-export-distribution 0.5.0.2 → 0.5.0.3
raw patch · 3 files changed
+31/−29 lines, 3 filesdep +ansi-terminaldep −prettyprinterdep −prettyprinter-ansi-terminalPVP ok
version bump matches the API change (PVP)
Dependencies added: ansi-terminal
Dependencies removed: prettyprinter, prettyprinter-ansi-terminal
API changes (from Hackage documentation)
Files
- Changelog.md +4/−0
- ngx-export-distribution.cabal +2/−3
- nhm-tool.hs +25/−26
Changelog.md view
@@ -1,3 +1,7 @@+### 0.5.0.3++- *nhm-tool*: replace dependency on *prettyprinter* by *ansi-terminal*.+ ### 0.5.0.2 - *nhm-tool*: get rid of dependency on package *extra* and other improvements.
ngx-export-distribution.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-distribution-version: 0.5.0.2+version: 0.5.0.3 synopsis: Build custom libraries for Nginx haskell module description: Build custom libraries for <https://github.com/lyokha/nginx-haskell-module Nginx haskell module>.@@ -34,8 +34,7 @@ , filepath , text , containers- , prettyprinter- , prettyprinter-ansi-terminal+ , ansi-terminal , cabal-plan , parsec
nhm-tool.hs view
@@ -17,15 +17,12 @@ import Data.Maybe import Data.Char import Data.List-import Prettyprinter (pretty, annotate)-import Prettyprinter.Render.Terminal+import System.Console.ANSI import System.Environment import System.Directory import System.FilePath import System.Exit import System.IO-import GHC.IO.Device-import qualified GHC.IO.FD as FD data DistData = DistData { distDataDir :: String , distDataArchive :: String@@ -375,23 +372,21 @@ cmdDeps :: DepsData -> IO () cmdDeps DepsData {..} = do units <- pjUnits <$> findAndDecodePlanJson (ProjectRelativeToDir ".")- let locals = [ Unit {..}- | Unit {..} <- M.elems units- , uType == UnitTypeLocal- , M.member CompNameLib uComps- , toPkgName uPId == T.pack depsDataProject- ]- when (null locals) $ do+ let comps = [ uComps+ | Unit {..} <- M.elems units+ , uType == UnitTypeLocal+ , toPkgName uPId == T.pack depsDataProject+ ]+ when (null comps) $ do hPutStrLn stderr $ "Failed to find plan for " ++ depsDataProject exitFailure- let locals' = foldl (\a (Unit {..}) ->- let comps = M.filterWithKey- (const . (== CompNameLib)) uComps- deps = M.map ciLibDeps comps- in M.foldr S.union a deps- ) S.empty locals- forM_ (S.toList locals') $ \(UnitId local) ->- putStrLn $ "package-id " ++ T.unpack local+ let deps = foldl (\a curComps ->+ let libComps = M.filterWithKey+ (const . (== CompNameLib)) curComps+ in M.foldr S.union a $ M.map ciLibDeps libComps+ ) S.empty comps+ forM_ (S.toList deps) $ \(UnitId unit) ->+ putStrLn $ "package-id " ++ T.unpack unit where toPkgName (PkgId (PkgName name) _) = name cmdInit :: InitData -> IO ()@@ -401,14 +396,14 @@ ,(initDataProject ++ ".cabal", projectCabal init', True) ,("Makefile", makefile init', True) ,(replace '-' '_' initDataProject ++ ".hs"- ,projectHs init'- ,False+ ,projectHs init'+ ,False ) ] forM_ files $ if initDataToStdout then \(name, file, _) ->- printHeader name >> T.putStrLn file+ printHeader (name ++ "\n") >> T.putStrLn file else \(name, file, overridable) -> do exists <- doesFileExist name if exists@@ -421,11 +416,15 @@ else T.writeFile name file where replace from to = foldr (\v -> ((if v == from then to else v) :)) "" printHeader header = do- isTerm <- isTerminal FD.stdout+ isTerm <- hIsTerminalDevice stdout if isTerm- then putDoc $ annotate (color Blue <> underlined) $- pretty $ header ++ "\n\n"- else putStrLn $ " ~~~ " ++ header ++ "\n"+ then do+ setSGR [SetColor Foreground Dull Blue+ ,SetUnderlining SingleUnderline+ ]+ putStrLn header+ setSGR [Reset]+ else putStrLn $ " ~~~ " ++ header existsMsg name = "File " ++ name ++ " exists" useForceMsg name = existsMsg name ++ ", use option -f to override it"