diff options
| author | Joey Hess <joey@kitenet.net> | 2014-03-30 13:12:33 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-03-30 13:12:33 -0400 |
| commit | 8e7b296e820e7513c7846ceeb3fbd87d60bc95f4 (patch) | |
| tree | 4eb80ad32b42ee871f5704cd1af99baf9e8cacc6 /Property.hs | |
| parent | e741b7b82e0b5be2809d1da7f54d8b0fcd0449e3 (diff) | |
split out Property.FIle
Diffstat (limited to 'Property.hs')
| -rw-r--r-- | Property.hs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/Property.hs b/Property.hs index 4aba094f..f00ddfa2 100644 --- a/Property.hs +++ b/Property.hs @@ -127,25 +127,6 @@ cmdProperty' cmd params env = CmdProperty desc cmd params env showp (Param s) = s showp (File s) = s -{- Replaces all the content of a file. -} -fileHasContent :: FilePath -> [Line] -> Property -fileHasContent f newcontent = FileProperty ("replace " ++ f) - f (\_oldcontent -> newcontent) - -{- Ensures that a line is present in a file, adding it to the end if not. -} -lineInFile :: FilePath -> Line -> Property -lineInFile f l = FileProperty (f ++ " contains:" ++ l) f go - where - go ls - | l `elem` ls = ls - | otherwise = ls++[l] - -{- Ensures that a line is not present in a file. - - Note that the file is ensured to exist, so if it doesn't, an empty - - file will be written. -} -lineNotInFile :: FilePath -> Line -> Property -lineNotInFile f l = FileProperty (f ++ " remove: " ++ l) f (filter (/= l)) - {- Makes a perhaps non-idempotent Property be idempotent by using a flag - file to indicate whether it has run before. - Use with caution. -} |
