diff options
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Main.hs | 4 | ||||
-rw-r--r-- | src/Hakyll/Preview/Poll.hs (renamed from src/Hakyll/Web/Preview/Poll.hs) | 25 | ||||
-rw-r--r-- | src/Hakyll/Preview/Server.hs (renamed from src/Hakyll/Web/Preview/Server.hs) | 17 |
3 files changed, 27 insertions, 19 deletions
diff --git a/src/Hakyll/Main.hs b/src/Hakyll/Main.hs index 37dc0fa..3ead225 100644 --- a/src/Hakyll/Main.hs +++ b/src/Hakyll/Main.hs @@ -28,8 +28,8 @@ import Control.Concurrent (forkIO) import qualified Data.Set as S import Hakyll.Core.Identifier import Hakyll.Core.Rules.Internal -import Hakyll.Web.Preview.Poll -import Hakyll.Web.Preview.Server +import Hakyll.Preview.Poll +import Hakyll.Preview.Server #endif diff --git a/src/Hakyll/Web/Preview/Poll.hs b/src/Hakyll/Preview/Poll.hs index 7ea033f..55118b3 100644 --- a/src/Hakyll/Web/Preview/Poll.hs +++ b/src/Hakyll/Preview/Poll.hs @@ -1,24 +1,29 @@ +-------------------------------------------------------------------------------- -- | Interval-based implementation of preview polling --- {-# LANGUAGE CPP #-} -module Hakyll.Web.Preview.Poll +module Hakyll.Preview.Poll ( previewPoll ) where -import Control.Applicative ((<$>)) -import Control.Concurrent (threadDelay) -import Control.Monad (filterM) + +-------------------------------------------------------------------------------- +import Control.Applicative ((<$>)) +import Control.Concurrent (threadDelay) +import Control.Monad (filterM) #if MIN_VERSION_directory(1,2,0) -import Data.Time (getCurrentTime) +import Data.Time (getCurrentTime) #else -import System.Time (getClockTime) +import System.Time (getClockTime) #endif -import System.Directory (getModificationTime, doesFileExist) +import System.Directory (doesFileExist, getModificationTime) + + +-------------------------------------------------------------------------------- +import Hakyll.Core.Configuration -import Hakyll.Core.Configuration +-------------------------------------------------------------------------------- -- | A preview thread that periodically recompiles the site. --- previewPoll :: Configuration -- ^ Configuration -> IO [FilePath] -- ^ Updating action -> IO () -- ^ Can block forever diff --git a/src/Hakyll/Web/Preview/Server.hs b/src/Hakyll/Preview/Server.hs index 15a1a33..14cf377 100644 --- a/src/Hakyll/Web/Preview/Server.hs +++ b/src/Hakyll/Preview/Server.hs @@ -1,18 +1,20 @@ +-------------------------------------------------------------------------------- -- | Implements a basic static file server for previewing options --- {-# LANGUAGE OverloadedStrings #-} -module Hakyll.Web.Preview.Server +module Hakyll.Preview.Server ( staticServer ) where -import Control.Monad.Trans (liftIO) -import qualified Snap.Core as Snap -import qualified Snap.Http.Server as Snap +-------------------------------------------------------------------------------- +import Control.Monad.Trans (liftIO) +import qualified Snap.Core as Snap +import qualified Snap.Http.Server as Snap import qualified Snap.Util.FileServe as Snap + +-------------------------------------------------------------------------------- -- | Serve a given directory --- static :: FilePath -- ^ Directory to serve -> (FilePath -> IO ()) -- ^ Pre-serve hook -> Snap.Snap () @@ -24,8 +26,9 @@ static directory preServe = { Snap.preServeHook = liftIO . preServe } + +-------------------------------------------------------------------------------- -- | Main method, runs a static server in the given directory --- staticServer :: FilePath -- ^ Directory to serve -> (FilePath -> IO ()) -- ^ Pre-serve hook -> Int -- ^ Port to listen on |