@@ -14,16 +14,17 @@ module Hakyll.Commands
1414
1515
1616--------------------------------------------------------------------------------
17−import System.Exit (exitWith, ExitCode)
18−import System.IO.Error (catchIOError)
1917import Control.Applicative
20−import Control.Monad (void)
2118import Control.Concurrent
19+import Control.Monad (void)
20+import System.Exit (ExitCode, exitWith)
21+import System.IO.Error (catchIOError)
2222
2323--------------------------------------------------------------------------------
2424import qualified Hakyll.Check as Check
2525import Hakyll.Core.Configuration
26−import Hakyll.Core.Logger (Verbosity)
26+import Hakyll.Core.Logger (Logger)
27+import qualified Hakyll.Core.Logger as Logger
2728import Hakyll.Core.Rules
2829import Hakyll.Core.Rules.Internal
2930import Hakyll.Core.Runtime
@@ -31,7 +32,7 @@ import Hakyll.Core.Util.File
3132
3233--------------------------------------------------------------------------------
3334#ifdef WATCH_SERVER
34−import Hakyll.Preview.Poll (watchUpdates)
35+import Hakyll.Preview.Poll (watchUpdates)
3536#endif
3637
3738#ifdef PREVIEW_SERVER
@@ -41,35 +42,36 @@ import Hakyll.Preview.Server
4142
4243--------------------------------------------------------------------------------
4344-- | Build the site
44−build :: Configuration -> Verbosity -> Rules a -> IO ExitCode
45−build conf verbosity rules = fst <$> run conf verbosity rules
45+build :: Configuration -> Logger -> Rules a -> IO ExitCode
46+build conf logger rules = fst <$> run conf logger rules
47+
4648
4749--------------------------------------------------------------------------------
4850-- | Run the checker and exit
49−check :: Configuration -> Verbosity -> Check.Check -> IO ()
50−check config verbosity check' = Check.check config verbosity check' >>= exitWith
51+check :: Configuration -> Logger -> Check.Check -> IO ()
52+check config logger check' = Check.check config logger check' >>= exitWith
5153
5254
5355--------------------------------------------------------------------------------
5456-- | Remove the output directories
55−clean :: Configuration -> IO ()
56−clean conf = do
57+clean :: Configuration -> Logger -> IO ()
58+clean conf logger = do
5759 remove $ destinationDirectory conf
5860 remove $ storeDirectory conf
5961 remove $ tmpDirectory conf
6062 where
6163 remove dir = do
62− putStrLn $ "Removing " ++ dir ++ "..."
64+ Logger.header logger $ "Removing " ++ dir ++ "..."
6365 removeDirectory dir
6466
6567
6668--------------------------------------------------------------------------------
6769-- | Preview the site
68−preview :: Configuration -> Verbosity -> Rules a -> Int -> IO ()
70+preview :: Configuration -> Logger -> Rules a -> Int -> IO ()
6971#ifdef PREVIEW_SERVER
70−preview conf verbosity rules port = do
72+preview conf logger rules port = do
7173 deprecatedMessage
72− watch conf verbosity "0.0.0.0" port True rules
74+ watch conf logger "0.0.0.0" port True rules
7375 where
7476 deprecatedMessage = mapM_ putStrLn [ "The preview command has been deprecated."
7577 , "Use the watch command for recompilation and serving."
@@ -82,9 +84,9 @@ preview _ _ _ _ = previewServerDisabled
8284--------------------------------------------------------------------------------
8385-- | Watch and recompile for changes
8486
85−watch :: Configuration -> Verbosity -> String -> Int -> Bool -> Rules a -> IO ()
87+watch :: Configuration -> Logger -> String -> Int -> Bool -> Rules a -> IO ()
8688#ifdef WATCH_SERVER
87−watch conf verbosity host port runServer rules = do
89+watch conf logger host port runServer rules = do
8890#ifndef mingw32_HOST_OS
8991 _ <- forkIO $ watchUpdates conf update
9092#else
@@ -97,27 +99,27 @@ watch conf verbosity host port runServer rules = do
9799 server'
98100 where
99101 update = do
100− (_, ruleSet) <- run conf verbosity rules
102+ (_, ruleSet) <- run conf logger rules
101103 return $ rulesPattern ruleSet
102104 loop = threadDelay 100000 >> loop
103− server' = if runServer then server conf host port else loop
105+ server' = if runServer then server conf logger host port else loop
104106#else
105107watch _ _ _ _ _ _ = watchServerDisabled
106108#endif
107109
108110--------------------------------------------------------------------------------
109111-- | Rebuild the site
110−rebuild :: Configuration -> Verbosity -> Rules a -> IO ExitCode
111−rebuild conf verbosity rules =
112− clean conf >> build conf verbosity rules
112+rebuild :: Configuration -> Logger -> Rules a -> IO ExitCode
113+rebuild conf logger rules =
114+ clean conf logger >> build conf logger rules
113115
114116--------------------------------------------------------------------------------
115117-- | Start a server
116−server :: Configuration -> String -> Int -> IO ()
118+server :: Configuration -> Logger -> String -> Int -> IO ()
117119#ifdef PREVIEW_SERVER
118−server conf host port = do
120+server conf logger host port = do
119121 let destination = destinationDirectory conf
120− staticServer destination preServeHook host port
122+ staticServer logger destination preServeHook host port
121123 where
122124 preServeHook _ = return ()
123125#else
@@ -156,4 +158,3 @@ watchServerDisabled =
156158 , "Alternatively, use an external tool to serve your site directory."
157159 ]
158160#endif
159−