From 3346123ca661d578ccb458e7135f8b68867bf107 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Tue, 15 Feb 2011 18:43:22 +0100 Subject: Receive list of used resources in Run module --- src/Hakyll/Main.hs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/Hakyll/Main.hs') diff --git a/src/Hakyll/Main.hs b/src/Hakyll/Main.hs index 64800c2..74097f7 100644 --- a/src/Hakyll/Main.hs +++ b/src/Hakyll/Main.hs @@ -6,13 +6,15 @@ module Hakyll.Main ) where import Control.Concurrent (forkIO) -import Control.Monad (when) +import Control.Monad (when, forM_) import System.Environment (getProgName, getArgs) import System.Directory (doesDirectoryExist, removeDirectoryRecursive) +import qualified Data.Set as S import Hakyll.Core.Configuration import Hakyll.Core.Run import Hakyll.Core.Rules +import Hakyll.Core.Rules.Internal import Hakyll.Web.Preview.INotify import Hakyll.Web.Preview.Server @@ -41,7 +43,9 @@ hakyllWith configuration rules = do -- | Build the site -- build :: HakyllConfiguration -> Rules -> IO () -build = run +build configuration rules = do + _ <- run configuration rules + return () -- | Remove the output directories -- @@ -80,11 +84,19 @@ help = do -- preview :: HakyllConfiguration -> Rules -> Int -> IO () preview configuration rules port = do + -- Build once, keep the rule set + ruleSet <- run configuration rules + + -- Debug: show the resources used + forM_ (S.toList $ rulesResources ruleSet) $ putStrLn . show + + {- -- Fork a thread polling for changes _ <- forkIO $ previewPoll configuration "." $ build configuration rules -- Run the server in the main thread server configuration port + -} -- | Rebuild the site -- -- cgit v1.2.3