summaryrefslogtreecommitdiff
path: root/Propellor/Property/File.hs
diff options
context:
space:
mode:
authorJoey Hess2014-04-01 01:12:05 -0400
committerJoey Hess2014-04-01 01:12:05 -0400
commit90f86b8b2bb7f0a3c834387827c9ec2e1876f342 (patch)
tree10e74b0a52f4987c6f7e9cf2abf756275e0cefae /Propellor/Property/File.hs
parentd53729495efe7174239deab3b5dd71204543b0d0 (diff)
not quite working docker container interface
Diffstat (limited to 'Propellor/Property/File.hs')
-rw-r--r--Propellor/Property/File.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Propellor/Property/File.hs b/Propellor/Property/File.hs
index 02bf27c0..f3065d21 100644
--- a/Propellor/Property/File.hs
+++ b/Propellor/Property/File.hs
@@ -38,3 +38,8 @@ fileProperty desc a f = Property desc $ go =<< doesFileExist f
then noChange
else makeChange $ viaTmp writeFile f (unlines ls')
go False = makeChange $ writeFile f (unlines $ a [])
+
+-- | Ensures a directory exists.
+dirExists :: FilePath -> Property
+dirExists d = check (doesDirectoryExist d) $ Property (d ++ " exists") $
+ makeChange $ createDirectoryIfMissing True d