diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-13 15:34:01 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-13 15:34:01 -0400 |
| commit | 95ac5163da904780ae166c2bf3a0addcb8d8870e (patch) | |
| tree | c476ec0951db984c2784a9e5ba7370bac333e64a /Propellor/Property.hs | |
| parent | 576acfed33abfae2065354431100701713e83a23 (diff) | |
Properties can now be satisfied differently on different operating systems.
Diffstat (limited to 'Propellor/Property.hs')
| -rw-r--r-- | Propellor/Property.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Propellor/Property.hs b/Propellor/Property.hs index 3e41fbcb..95d17c05 100644 --- a/Propellor/Property.hs +++ b/Propellor/Property.hs @@ -10,6 +10,7 @@ import "mtl" Control.Monad.Reader import Propellor.Types import Propellor.Types.Attr +import Propellor.Attr import Propellor.Engine import Utility.Monad import System.FilePath @@ -91,6 +92,13 @@ check c property = Property (propertyDesc property) $ ifM (liftIO c) , return NoChange ) +-- | Makes a property that is satisfied differently depending on the host's +-- operating system. +-- +-- Note that the operating system may not be declared for some hosts. +withOS :: Desc -> (Maybe System -> Propellor Result) -> Property +withOS desc a = Property desc $ a =<< getOS + boolProperty :: Desc -> IO Bool -> Property boolProperty desc a = Property desc $ ifM (liftIO a) ( return MadeChange |
