packages feed

hapistrano 0.3.9.4 → 0.3.10.0

raw patch · 3 files changed

+19/−6 lines, 3 filesdep +ansi-terminalPVP ok

version bump matches the API change (PVP)

Dependencies added: ansi-terminal

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## 0.3.10.0+### Added+* Colorize the output in the terminal.+ ## 0.3.9.4 ### Added * Support for GHC 8.8
hapistrano.cabal view
@@ -1,5 +1,5 @@ name:                hapistrano-version:             0.3.9.4+version:             0.3.10.0 synopsis:            A deployment library for Haskell applications description:   .@@ -51,6 +51,7 @@                      , System.Hapistrano.Core                      , System.Hapistrano.Types   build-depends:       aeson              >= 0.11 && < 1.5+                     , ansi-terminal      >= 0.9 && < 0.11                      , base               >= 4.8 && < 5.0                      , filepath           >= 1.2 && < 1.5                      , formatting         >= 6.2 && < 7.0
src/System/Hapistrano/Core.hs view
@@ -23,19 +23,20 @@   , scpDir ) where +import           Control.Concurrent.STM     (atomically) import           Control.Monad import           Control.Monad.Except import           Control.Monad.Reader-import           Control.Concurrent.STM (atomically) import           Data.Proxy import           Data.Time import           Path+import           System.Console.ANSI import           System.Exit import           System.Hapistrano.Commands import           System.Hapistrano.Types import           System.Process-import           System.Process.Typed (ProcessConfig)-import qualified System.Process.Typed as SPT+import           System.Process.Typed       (ProcessConfig)+import qualified System.Process.Typed       as SPT  -- | Run the 'Hapistrano' monad. The monad hosts 'exec' actions. @@ -113,7 +114,7 @@         ("ssh", sshArgs ++ [sshHost, "-p", show sshPort, cmd])     where       renderShell :: Shell -> String-      renderShell Zsh = "zsh"+      renderShell Zsh  = "zsh"       renderShell Bash = "bash"  -- | Copy a file from local path to target server.@@ -172,7 +173,10 @@         case configSshOptions of           Nothing              -> "localhost"           Just SshOptions {..} -> sshHost ++ ":" ++ show sshPort-  liftIO $ configPrint StdoutDest (putLine hostLabel ++ "[" ++ printableTime ++ "] INFO -- : " ++ "$ " ++ cmd ++ "\n")+      hostInfo = colorizeString Blue $ putLine hostLabel+      timestampInfo = colorizeString Cyan ("[" ++ printableTime ++ "] INFO -- : $ ")+      cmdInfo = colorizeString Green (cmd ++ "\n")+  liftIO $ configPrint StdoutDest (hostInfo ++ timestampInfo ++ cmdInfo)   (exitCode', stdout', stderr') <- liftIO readProcessOutput   unless (null stdout') . liftIO $     configPrint StdoutDest stdout'@@ -190,3 +194,7 @@ putLine str = "*** " ++ str ++ padding ++ "\n"   where     padding = ' ' : replicate (75 - length str) '*'++colorizeString :: Color -> String -> String+colorizeString color msg =+  setSGRCode [SetColor Foreground Vivid color] ++ msg ++ setSGRCode [Reset]