diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-09-04 14:08:20 -0700 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-09-04 14:08:20 -0700 |
| commit | 3e6d85c7b01e1a2a6e6751ca99514bd54e184299 (patch) | |
| tree | ae89c7d8de14b4b9be6264f7a34c3cac75ecad4b /src/Propellor/Property/Rsync.hs | |
| parent | 9d546f04c640c0eb1ded6e585c99e2cd11fb1847 (diff) | |
propellor spin
Diffstat (limited to 'src/Propellor/Property/Rsync.hs')
| -rw-r--r-- | src/Propellor/Property/Rsync.hs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/Propellor/Property/Rsync.hs b/src/Propellor/Property/Rsync.hs index 064d129f..809cfc22 100644 --- a/src/Propellor/Property/Rsync.hs +++ b/src/Propellor/Property/Rsync.hs @@ -9,9 +9,16 @@ type Dest = FilePath class RsyncParam p where toRsync :: p -> String --- | Rsync checks each name to be transferred against its list of Filter --- rules, and the first matching one is acted on. If no matching rule --- is found, the file is processed. +-- | A pattern that matches all files under a directory, but does not +-- match the directory itself. +filesUnder :: FilePath -> Pattern +filesUnder d = Pattern (d ++ "/*") + +-- | Ensures that the Dest directory exists and has identical contents as +-- the Src directory. +syncDir :: Src -> Dest -> Property NoInfo +syncDir = syncDirFiltered [] + data Filter = Include Pattern | Exclude Pattern @@ -28,18 +35,12 @@ instance RsyncParam Filter where -- directory, relative to the 'Src' that rsync is acting on. newtype Pattern = Pattern String --- | A pattern that matches all files under a directory, but does not --- match the directory itself. -filesUnder :: FilePath -> Pattern -filesUnder d = Pattern (d ++ "/*") - --- | Ensures that the Dest directory exists and has identical contents as --- the Src directory. -syncDir :: Src -> Dest -> Property NoInfo -syncDir = syncDirFiltered [] - -- | Like syncDir, but avoids copying anything that the filter list -- excludes. Anything that's filtered out will be deleted from Dest. +-- +-- Rsync checks each name to be transferred against its list of Filter +-- rules, and the first matching one is acted on. If no matching rule +-- is found, the file is processed. syncDirFiltered :: [Filter] -> Src -> Dest -> Property NoInfo syncDirFiltered filters src dest = rsync $ [ "-av" |
