on master help sign in
Move preview modules
commit720c92ab1ef628c3c9545fa022ed546c60d9d72a authorJasper Van der Jeugt <m@jaspervdj.be> dateSat 29 Dec 2012, 09:53 (14 years ago) parent74e6ba9
4 files changed+29−21
hakyll.cabal+2−2 src/Hakyll/Main.hs+2−2 src/Hakyll/Web/Preview/Poll.hs → src/Hakyll/Preview/Poll.hs+15−10 src/Hakyll/Web/Preview/Server.hs → src/Hakyll/Preview/Server.hs+10−7
hakyll.cabal+2−2
@@ -161,8 +161,8 @@ Library
161161 Cpp-options:
162162 -DPREVIEW_SERVER
163163 Other-modules:
164− Hakyll.Web.Preview.Poll
165− Hakyll.Web.Preview.Server
164+ Hakyll.Preview.Poll
165+ Hakyll.Preview.Server
166166
167167 If flag(unixFilter)
168168 Build-depends:
src/Hakyll/Main.hs+2−2
@@ -28,8 +28,8 @@ import Control.Concurrent (forkIO)
2828import qualified Data.Set as S
2929import Hakyll.Core.Identifier
3030import Hakyll.Core.Rules.Internal
31−import Hakyll.Web.Preview.Poll
32−import Hakyll.Web.Preview.Server
31+import Hakyll.Preview.Poll
32+import Hakyll.Preview.Server
3333#endif
3434
3535
src/Hakyll/Web/Preview/Poll.hs → src/Hakyll/Preview/Poll.hsrenamed+15−10
@@ -1,24 +1,29 @@
1+--------------------------------------------------------------------------------
12-- | Interval-based implementation of preview polling
2−--
33{-# LANGUAGE CPP #-}
4−module Hakyll.Web.Preview.Poll
4+module Hakyll.Preview.Poll
55 ( previewPoll
66 ) where
77
8−import Control.Applicative ((<$>))
9−import Control.Concurrent (threadDelay)
10−import Control.Monad (filterM)
8+
9+--------------------------------------------------------------------------------
10+import Control.Applicative ((<$>))
11+import Control.Concurrent (threadDelay)
12+import Control.Monad (filterM)
1113#if MIN_VERSION_directory(1,2,0)
12−import Data.Time (getCurrentTime)
14+import Data.Time (getCurrentTime)
1315#else
14−import System.Time (getClockTime)
16+import System.Time (getClockTime)
1517#endif
16−import System.Directory (getModificationTime, doesFileExist)
18+import System.Directory (doesFileExist, getModificationTime)
19+
20+
21+--------------------------------------------------------------------------------
22+import Hakyll.Core.Configuration
1723
18−import Hakyll.Core.Configuration
1924
25+--------------------------------------------------------------------------------
2026-- | A preview thread that periodically recompiles the site.
21−--
2227previewPoll :: Configuration -- ^ Configuration
2328 -> IO [FilePath] -- ^ Updating action
2429 -> IO () -- ^ Can block forever
src/Hakyll/Web/Preview/Server.hs → src/Hakyll/Preview/Server.hsrenamed+10−7
@@ -1,18 +1,20 @@
1+--------------------------------------------------------------------------------
12-- | Implements a basic static file server for previewing options
2−--
33{-# LANGUAGE OverloadedStrings #-}
4−module Hakyll.Web.Preview.Server
4+module Hakyll.Preview.Server
55 ( staticServer
66 ) where
77
8−import Control.Monad.Trans (liftIO)
98
10−import qualified Snap.Core as Snap
11−import qualified Snap.Http.Server as Snap
9+--------------------------------------------------------------------------------
10+import Control.Monad.Trans (liftIO)
11+import qualified Snap.Core as Snap
12+import qualified Snap.Http.Server as Snap
1213import qualified Snap.Util.FileServe as Snap
1314
15+
16+--------------------------------------------------------------------------------
1417-- | Serve a given directory
15−--
1618static :: FilePath -- ^ Directory to serve
1719 -> (FilePath -> IO ()) -- ^ Pre-serve hook
1820 -> Snap.Snap ()
@@ -24,8 +26,9 @@ static directory preServe =
2426 { Snap.preServeHook = liftIO . preServe
2527 }
2628
29+
30+--------------------------------------------------------------------------------
2731-- | Main method, runs a static server in the given directory
28−--
2932staticServer :: FilePath -- ^ Directory to serve
3033 -> (FilePath -> IO ()) -- ^ Pre-serve hook
3134 -> Int -- ^ Port to listen on