summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2015-10-10 15:09:47 -0400
committerJoey Hess2015-10-10 15:09:47 -0400
commitfa813945849f3e5998a61b1625f9bef20cd2fa13 (patch)
tree1200a7598abb5687e30279a342571fbcc2f900fb
parentae380f085bc867f7405ef0a16c849864c6552e47 (diff)
propellor spin
-rw-r--r--src/Propellor/Engine.hs8
-rw-r--r--src/Propellor/Property.hs8
2 files changed, 9 insertions, 7 deletions
diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs
index dd3d4653..0fdbb995 100644
--- a/src/Propellor/Engine.hs
+++ b/src/Propellor/Engine.hs
@@ -26,6 +26,7 @@ import Propellor.Types
import Propellor.Message
import Propellor.Exception
import Propellor.Info
+import Propellor.Property
import Utility.Exception
import Utility.PartialPrelude
import Utility.Monad
@@ -62,13 +63,6 @@ runEndAction host res (EndAction desc a) = actionMessageOn (hostName host) desc
(ret, _s, _) <- runRWST (runWithHost (catchPropellor (a res))) host ()
return ret
--- | For when code running in the Propellor monad needs to ensure a
--- Property.
---
--- This can only be used on a Property that has NoInfo.
-ensureProperty :: Property NoInfo -> Propellor Result
-ensureProperty = catchPropellor . propertySatisfy
-
-- | Ensures a list of Properties, with a display of each as it runs.
ensureProperties :: [Property NoInfo] -> Propellor Result
ensureProperties ps = ensure ps NoChange
diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs
index c7fc555f..471916d0 100644
--- a/src/Propellor/Property.hs
+++ b/src/Propellor/Property.hs
@@ -12,6 +12,7 @@ import "mtl" Control.Monad.RWS.Strict
import Propellor.Types
import Propellor.Info
+import Propellor.Exception
import Utility.Monad
-- | Constructs a Property, from a description and an action to run to
@@ -109,6 +110,13 @@ describe = setDesc
(==>) = flip describe
infixl 1 ==>
+-- | For when code running in the Propellor monad needs to ensure a
+-- Property.
+--
+-- This can only be used on a Property that has NoInfo.
+ensureProperty :: Property NoInfo -> Propellor Result
+ensureProperty = catchPropellor . propertySatisfy
+
-- | Makes a Property only need to do anything when a test succeeds.
check :: IO Bool -> Property i -> Property i
check c p = adjustPropertySatisfy p $ \satisfy -> ifM (liftIO c)