buildbox-1.0.0.0: Rehackable components for writing buildbots and test harnesses.

BuildBox.Build

Description

Defines the main Build monad and common utils.

Synopsis

Documentation

type Build a = ErrorT BuildError (ReaderT BuildConfig IO) aSource

The builder monad encapsulates and IO action that can fail with an error, and also read some global configuration info.

data BuildError Source

The errors we recognise.

Constructors

ErrorOther String

Some generic error

ErrorSystemCmdFailed

Some system command fell over, and it barfed out the given stdout and stderr.

ErrorIOError IOError

Some other IO action failed.

forall prop . Show prop => ErrorCheckFailed Bool prop

Some property check was supposed to return the given boolean value, but it didn't.

data BuildConfig Source

Global builder configuration.

Constructors

BuildConfig 

Fields

buildConfigLogSystem :: Maybe Handle

Log all system commands executed to this file handle.

buildConfigDefault :: BuildConfigSource

The default build config.

runBuild :: Build a -> IO (Either BuildError a)Source

Run a build command.

runBuildPrint :: Build a -> IO (Maybe a)Source

Run a build command, reporting whether it succeeded to the console. If it succeeded then return Just the result, else Nothing.

throw :: BuildError -> Build aSource

Throw an error in the build monad.

io :: IO a -> Build aSource

Lift an IO action into the build monad. If the action throws any exceptions they get caught and turned into ErrorIOError exceptions in our Build monad.

logSystem :: String -> Build ()Source

Log a system command to the handle in our BuildConfig, if any.

out :: Pretty a => a -> Build ()Source

Print some text to stdout.

outLn :: Pretty a => a -> Build ()Source

Print some text to stdout followed by a newline.

outBlank :: Build ()Source

Print a blank line to stdout

outLine :: Build ()Source

Print a ----- line to stdout

outLINE :: Build ()Source

Print a ===== line to stdout

whenM :: Monad m => m Bool -> m () -> m ()Source

Like when, but with teh monadz.