twitch-0.1.6.1: A high level file watcher DSL

Safe HaskellNone
LanguageHaskell2010

Twitch.InternalRule

Synopsis

Documentation

type Action = FilePath -> UTCTime -> IO () Source

The actions that are run when file events are triggered

type FileTest = FilePath -> UTCTime -> Bool Source

The test function to determine if a event Action should get fired

data InternalRule Source

Constructors

InternalRule 

Fields

name :: String

A name for debugging mostly

fileTest :: FileTest

The test to determine if the rule actions should fire

modify :: Action

The action to run on Modify events

add :: Action

The action to run on Add events

delete :: Action

The action to run on Delete events

data Config Source

Configuration to run the file watcher

Constructors

Config 

Fields

logger :: Issue -> IO ()

A logger for the issues

dirs :: [FilePath]

The directories to watch

watchConfig :: WatchConfig

config for the file watcher

data Issue Source

A sum type for the various issues that can be logged

Constructors

IEvent Event

logged every time an event is fired

IRuleFired Event InternalRule

logged every time an rule is fired

Instances

filePath :: Event -> FilePath Source

Retrieve the filePath of an Event

time :: Event -> UTCTime Source

Retrieve the time of an Event

fireRule :: Event -> InternalRule -> IO () Source

Run the Rule action associated with the an event

testAndFireRule :: Config -> Event -> InternalRule -> IO () Source

Test to see if the rule should fire and fire it

setupRuleForDir :: Config -> WatchManager -> [InternalRule] -> FilePath -> IO () Source

Start watching a directory, and run the rules on it.

setupRules :: Config -> [InternalRule] -> IO WatchManager Source

Setup all of the directory watches using the rules