From 0460a04474d2ea4f439708bb9f8ded24fba329ac Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 8 Apr 2014 16:58:11 -0400 Subject: propellor spin --- Propellor/Property/File.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Propellor/Property/File.hs') diff --git a/Propellor/Property/File.hs b/Propellor/Property/File.hs index 80c69d9b..0c1155fe 100644 --- a/Propellor/Property/File.hs +++ b/Propellor/Property/File.hs @@ -11,6 +11,13 @@ hasContent :: FilePath -> [Line] -> Property f `hasContent` newcontent = fileProperty ("replace " ++ f) (\_oldcontent -> newcontent) f +-- | Ensures a file has contents that comes from PrivData. +-- Note: Does not do anything with the permissions of the file to prevent +-- it from being seen. +hasPrivContent :: FilePath -> Property +hasPrivContent f = Property ("privcontent " ++ f) $ + withPrivData (PrivFile f) (\v -> ensureProperty $ f `hasContent` lines v) + -- | Ensures that a line is present in a file, adding it to the end if not. containsLine :: FilePath -> Line -> Property f `containsLine` l = fileProperty (f ++ " contains:" ++ l) go f -- cgit v1.3-2-g0d8e