summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-01-03 11:33:59 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-01-03 11:33:59 +0100
commit40c75767d4f926de4ce2fd3db688e46987fb8b72 (patch)
treee8b0dc65169ee8cf93ef64d0126610837b9c5837 /src
parent220e4b484cb460df0e0a0cb50a309788349745b2 (diff)
downloadhakyll-40c75767d4f926de4ce2fd3db688e46987fb8b72.tar.gz
Store modified flags in a map
This allows reuse for actual dependency checking (to be implemented later).
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Core/Run.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Hakyll/Core/Run.hs b/src/Hakyll/Core/Run.hs
index 1b45f38..6898b3a 100644
--- a/src/Hakyll/Core/Run.hs
+++ b/src/Hakyll/Core/Run.hs
@@ -3,12 +3,13 @@
module Hakyll.Core.Run where
import Control.Arrow ((&&&))
-import Control.Monad (foldM, forM_)
+import Control.Monad (foldM, forM_, forM)
import qualified Data.Map as M
import Data.Monoid (mempty)
import Data.Typeable (Typeable)
import Data.Binary (Binary)
import System.FilePath ((</>))
+import Control.Applicative ((<$>))
import Hakyll.Core.Route
import Hakyll.Core.Identifier
@@ -60,18 +61,23 @@ hakyllWith rules provider store = do
putStrLn "Writing dependency graph to dependencies.dot..."
writeDot "dependencies.dot" show graph
+ -- Check which items are up-to-date: modified will be a Map Identifier Bool
+ modifiedMap <- fmap M.fromList $ forM orderedCompilers $ \(id', _) -> do
+ modified <- if resourceExists provider id'
+ then resourceModified provider id' store
+ else return False
+ return (id', modified)
+
-- Generate all the targets in order
- _ <- foldM (addTarget route') M.empty orderedCompilers
+ _ <- foldM (addTarget route' modifiedMap) M.empty orderedCompilers
putStrLn "DONE."
where
- addTarget route' map' (id', comp) = do
+ addTarget route' modifiedMap map' (id', comp) = do
let url = runRoute route' id'
-- Check if the resource was modified
- modified <- if resourceExists provider id'
- then resourceModified provider id' store
- else return False
+ let modified = modifiedMap M.! id'
-- Run the compiler
compiled <- runCompilerJob comp id' provider (dependencyLookup map')