From ad02c89c6aa6902b9b16375f61df2139e47dfcb3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 9 Apr 2014 01:15:11 -0400 Subject: update --- Propellor/Property/Scheduled.hs | 11 ++++++++++- Utility/Scheduled.hs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Propellor/Property/Scheduled.hs b/Propellor/Property/Scheduled.hs index 2e7ae060..bef2a297 100644 --- a/Propellor/Property/Scheduled.hs +++ b/Propellor/Property/Scheduled.hs @@ -1,5 +1,6 @@ module Propellor.Property.Scheduled ( period + , periodParse , Recurrance(..) , WeekDay , MonthDay @@ -31,7 +32,15 @@ period prop recurrance = Property desc $ do else noChange where schedule = Schedule recurrance AnyTime - desc = propertyDesc prop ++ " (period " ++ show recurrance ++ ")" + desc = propertyDesc prop ++ " (period " ++ fromRecurrance recurrance ++ ")" + +-- | Like period, but parse a human-friendly string. +periodParse :: Property -> String -> Property +periodParse prop s = case toRecurrance s of + Just recurrance -> period prop recurrance + Nothing -> Property "periodParse" $ do + warningMessage $ "failed periodParse: " ++ s + noChange lastCheckedFile :: FilePath lastCheckedFile = localdir ".lastchecked" diff --git a/Utility/Scheduled.hs b/Utility/Scheduled.hs index 6b0609d8..11e3b569 100644 --- a/Utility/Scheduled.hs +++ b/Utility/Scheduled.hs @@ -49,9 +49,9 @@ data Recurrance | Weekly (Maybe WeekDay) | Monthly (Maybe MonthDay) | Yearly (Maybe YearDay) + | Divisible Int Recurrance -- ^ Days, Weeks, or Months of the year evenly divisible by a number. -- (Divisible Year is years evenly divisible by a number.) - | Divisible Int Recurrance deriving (Eq, Read, Show, Ord) type WeekDay = Int -- cgit v1.2.3