update
This commit is contained in:
parent
335cce275a
commit
ad02c89c6a
|
@ -1,5 +1,6 @@
|
||||||
module Propellor.Property.Scheduled
|
module Propellor.Property.Scheduled
|
||||||
( period
|
( period
|
||||||
|
, periodParse
|
||||||
, Recurrance(..)
|
, Recurrance(..)
|
||||||
, WeekDay
|
, WeekDay
|
||||||
, MonthDay
|
, MonthDay
|
||||||
|
@ -31,7 +32,15 @@ period prop recurrance = Property desc $ do
|
||||||
else noChange
|
else noChange
|
||||||
where
|
where
|
||||||
schedule = Schedule recurrance AnyTime
|
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 :: FilePath
|
||||||
lastCheckedFile = localdir </> ".lastchecked"
|
lastCheckedFile = localdir </> ".lastchecked"
|
||||||
|
|
|
@ -49,9 +49,9 @@ data Recurrance
|
||||||
| Weekly (Maybe WeekDay)
|
| Weekly (Maybe WeekDay)
|
||||||
| Monthly (Maybe MonthDay)
|
| Monthly (Maybe MonthDay)
|
||||||
| Yearly (Maybe YearDay)
|
| Yearly (Maybe YearDay)
|
||||||
|
| Divisible Int Recurrance
|
||||||
-- ^ Days, Weeks, or Months of the year evenly divisible by a number.
|
-- ^ Days, Weeks, or Months of the year evenly divisible by a number.
|
||||||
-- (Divisible Year is years evenly divisible by a number.)
|
-- (Divisible Year is years evenly divisible by a number.)
|
||||||
| Divisible Int Recurrance
|
|
||||||
deriving (Eq, Read, Show, Ord)
|
deriving (Eq, Read, Show, Ord)
|
||||||
|
|
||||||
type WeekDay = Int
|
type WeekDay = Int
|
||||||
|
|
Loading…
Reference in New Issue