buildbox- Rehackable components for writing buildbots and test harnesses.

Safe HaskellSafe-Infered



Working with the file system.



data PropFile Source

Properties of the file system we can test for.


HasExecutable String

Some executable is in the current path.

HasFile FilePath

Some file exists.

HasDir FilePath

Some directory exists.

FileEmpty FilePath

Some file is empty.

inDir :: FilePath -> Build a -> Build aSource

Run a command in a different working directory. Throws an error if the directory doesn't exist.

inScratchDir :: FilePath -> Build a -> Build aSource

Create a new directory with the given name, run a command within it, then change out and recursively delete the directory. Throws an error if a directory with the given name already exists.

clobberDir :: FilePath -> Build ()Source

Delete a dir recursively if it's there, otherwise do nothing. Unlike removeDirectoryRecursive, this function does not follow symlinks, it just deletes them.

ensureDir :: FilePath -> Build ()Source

Create a new directory if it isn't already there, or return successfully if it is.

withTempFile :: (FilePath -> Build a) -> Build aSource

Create a temp file, pass it to some command, then delete the file after the command finishes.

atomicWriteFile :: FilePath -> String -> Build ()Source

Atomically write a file by first writing it to a tmp file then renaming it. This prevents concurrent processes from reading half-written files.