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

Safe HaskellSafe
LanguageHaskell98

BuildBox.Command.File

Description

Working with the file system.

Synopsis

Documentation

data PropFile Source #

Properties of the file system we can test for.

Constructors

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.

Instances
Show PropFile Source # 
Instance details

Defined in BuildBox.Command.File

Testable PropFile Source # 
Instance details

Defined in BuildBox.Command.File

inDir :: FilePath -> Build a -> Build a Source #

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

inScratchDir :: FilePath -> Build a -> Build a Source #

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.

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 a Source #

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.

exe :: String Source #

The file extension for an executable on the current system.