hakyll 3.2.0.4 → 3.2.0.5
raw patch · 2 files changed
+52/−10 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Hakyll.Web.Preview.Poll: previewPoll :: HakyllConfiguration -> IO [FilePath] -> IO ()
- Hakyll.Web.Preview.Server: staticServer :: FilePath -> (FilePath -> IO ()) -> Int -> IO ()
Files
- hakyll.cabal +15/−5
- src/Hakyll/Main.hs +37/−5
hakyll.cabal view
@@ -1,5 +1,5 @@ Name: hakyll-Version: 3.2.0.4+Version: 3.2.0.5 Synopsis: A static website compiler library Description:@@ -50,6 +50,10 @@ Type: git Location: git://github.com/jaspervdj/hakyll.git +Flag previewServer+ Description: Include the preview server+ default: True+ Library Ghc-Options: -Wall Hs-Source-Dirs: src@@ -72,8 +76,6 @@ process >= 1.0 && < 1.4, regex-base >= 0.93 && < 1.0, regex-pcre >= 0.93 && < 1.0,- snap-core >= 0.5.1 && < 0.6,- snap-server >= 0.5.1 && < 0.6, tagsoup >= 0.12 && < 0.13, time >= 1.1 && < 1.3, unix >= 2.4 && < 2.6@@ -113,8 +115,6 @@ Hakyll.Web.Page.Read Hakyll.Web.Pandoc Hakyll.Web.Pandoc.FileType- Hakyll.Web.Preview.Poll- Hakyll.Web.Preview.Server Hakyll.Web.RelativizeUrls Hakyll.Web.Tags Hakyll.Web.Template@@ -131,3 +131,13 @@ Hakyll.Web.Template.Read.Hakyll Hakyll.Web.Template.Read.Hamlet Paths_hakyll++ If flag(previewServer)+ Build-depends:+ snap-core >= 0.5.1 && < 0.6,+ snap-server >= 0.5.1 && < 0.6+ Cpp-Options:+ -DPREVIEW_SERVER+ Other-Modules:+ Hakyll.Web.Preview.Poll+ Hakyll.Web.Preview.Server
src/Hakyll/Main.hs view
@@ -1,25 +1,30 @@ -- | Module providing the main hakyll function and command-line argument parsing --+{-# LANGUAGE CPP #-} module Hakyll.Main ( hakyll , hakyllWith ) where -import Control.Applicative ((<$>))-import Control.Concurrent (forkIO) import Control.Monad (when) import System.Directory (doesDirectoryExist, removeDirectoryRecursive) import System.Environment (getProgName, getArgs) import System.Process (system)-import qualified Data.Set as S import Hakyll.Core.Configuration-import Hakyll.Core.Resource import Hakyll.Core.Run import Hakyll.Core.Rules++#ifdef PREVIEW_SERVER+import Control.Applicative ((<$>))+import Control.Concurrent (forkIO)+import qualified Data.Set as S++import Hakyll.Core.Resource import Hakyll.Core.Rules.Internal import Hakyll.Web.Preview.Poll import Hakyll.Web.Preview.Server+#endif -- | This usualy is the function with which the user runs the hakyll compiler --@@ -83,11 +88,17 @@ , name ++ " rebuild Clean up and build again" , name ++ " server [port] Run a local test server" , name ++ " deploy Upload/deploy your site"+ , "" ] +#ifndef PREVIEW_SERVER+ previewServerDisabled+#endif+ -- | Preview the site -- preview :: HakyllConfiguration -> RulesM a -> Int -> IO ()+#ifdef PREVIEW_SERVER preview conf rules port = do -- Fork a thread polling for changes _ <- forkIO $ previewPoll conf update@@ -96,6 +107,9 @@ server conf port where update = map unResource . S.toList . rulesResources <$> run conf rules+#else+preview _ _ _ = previewServerDisabled+#endif -- | Rebuild the site --@@ -107,15 +121,33 @@ -- | Start a server -- server :: HakyllConfiguration -> Int -> IO ()+#ifdef PREVIEW_SERVER server conf port = do let destination = destinationDirectory conf staticServer destination preServeHook port where preServeHook _ = return ()+#else+server _ _ = previewServerDisabled+#endif --- Upload the site+-- | Upload the site -- deploy :: HakyllConfiguration -> IO () deploy conf = do _ <- system $ deployCommand conf return ()++-- | Print a warning message about the preview serving not being enabled+--+#ifndef PREVIEW_SERVER+previewServerDisabled :: IO ()+previewServerDisabled =+ mapM_ putStrLn+ [ "PREVIEW SERVER"+ , ""+ , "The preview server is not enabled in the version of Hakyll. To"+ , "enable it, set the flag to True and recompile Hakyll."+ , "Alternatively, use an external tool to serve your site directory."+ ]+#endif