From 866a282f19592e9ef4f0b6d3bc44be2dd2b3e08c Mon Sep 17 00:00:00 2001 From: Eric Stolten Date: Wed, 28 Aug 2013 13:11:44 -0400 Subject: * Preview now shows the deprecation message and calls watch. * Details on how to disable the server in the command description. --- src/Hakyll/Commands.hs | 17 +++++++++-------- src/Hakyll/Main.hs | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/Hakyll/Commands.hs b/src/Hakyll/Commands.hs index 0601909..7951f4e 100644 --- a/src/Hakyll/Commands.hs +++ b/src/Hakyll/Commands.hs @@ -65,9 +65,13 @@ clean conf = do -- | Preview the site preview :: Configuration -> Verbosity -> Rules a -> Int -> IO () #ifdef PREVIEW_SERVER -preview _ _ _ _ = mapM_ putStrLn [ "The preview command has been deprecated." - , "Use the watch command for recompilation and serving." - , "You can disable the server with watch --no-server"] +preview conf verbosity rules port = do + deprecatedMessage + watch conf verbosity port True rules + where + deprecatedMessage = mapM_ putStrLn [ "The preview command has been deprecated." + , "Use the watch command for recompilation and serving." + ] #else preview _ _ _ _ = previewServerDisabled #endif @@ -87,12 +91,9 @@ watch conf verbosity port runServer rules = do (_, ruleSet) <- run conf verbosity rules return $ rulesPattern ruleSet - server' :: IO () - server' = if runServer - then (server conf port) - else (return ()) - loop = threadDelay 100000 >> loop + + server' = if runServer then server conf port else return () #else watch _ _ _ _ _ = watchServerDisabled #endif diff --git a/src/Hakyll/Main.hs b/src/Hakyll/Main.hs index b8e0444..4b30939 100644 --- a/src/Hakyll/Main.hs +++ b/src/Hakyll/Main.hs @@ -87,7 +87,7 @@ hakyllArgs = modes , (Server (verboseFlag def) (portFlag 8000)) &= help "Start a preview server" , (Watch (verboseFlag def) (portFlag 8000) (noServerFlag False) &= - help "Autocompile on changes and start a preview server") + help "Autocompile on changes and start a preview server. You can watch and recompile without running a server with --no-server.") ] &= help "Hakyll static site compiler" &= program progName -- cgit v1.2.3