1--------------------------------------------------------------------------------
2-- | Interval-based implementation of preview polling
4module Hakyll.Preview.Poll
9--------------------------------------------------------------------------------
10import Control.Applicative ((<$>))
11import Control.Concurrent (threadDelay)
12import Control.Monad (filterM)
13#if MIN_VERSION_directory(1,2,0)
14import Data.Time (getCurrentTime)
16import System.Time (getClockTime)
18import System.Directory (doesFileExist, getModificationTime)
21--------------------------------------------------------------------------------
22import Hakyll.Core.Configuration
25--------------------------------------------------------------------------------
26-- | A preview thread that periodically recompiles the site.
27previewPoll :: Configuration -- ^ Configuration
28 -> IO [FilePath] -- ^ Updating action
29 -> IO () -- ^ Can block forever
30previewPoll _ update = do
31#if MIN_VERSION_directory(1,2,0)
32 time <- getCurrentTime
41 files' <- filterM doesFileExist files
42 filesTime <- case files' of
44 _ -> maximum <$> mapM getModificationTime files'
46 if filesTime > time || files' /= files
47 then loop filesTime =<< update
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list