summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2013-02-10 22:15:34 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2013-02-10 22:15:34 +0100
commit8c575ae52115f09d5b6e53ed409d934f5168de59 (patch)
treef364cdc8a7667decc1474dfd5eda3cd56f217edf
parent46168382f170b4559ce266b8257b7b7988589ed1 (diff)
downloadhakyll-8c575ae52115f09d5b6e53ed409d934f5168de59.tar.gz
Fix apparent remaining provider rewrite issues
-rw-r--r--src/Hakyll/Core/Provider.hs11
-rw-r--r--src/Hakyll/Core/Provider/Internal.hs7
2 files changed, 8 insertions, 10 deletions
diff --git a/src/Hakyll/Core/Provider.hs b/src/Hakyll/Core/Provider.hs
index 4dd8288..00b694d 100644
--- a/src/Hakyll/Core/Provider.hs
+++ b/src/Hakyll/Core/Provider.hs
@@ -23,7 +23,6 @@ module Hakyll.Core.Provider
--------------------------------------------------------------------------------
-import Control.Monad (forM_)
import qualified Hakyll.Core.Provider.Internal as Internal
import qualified Hakyll.Core.Provider.MetadataCache as Internal
import Hakyll.Core.Store (Store)
@@ -37,9 +36,7 @@ newProvider :: Store -- ^ Store to use
-> IO Internal.Provider -- ^ Resulting provider
newProvider store ignore directory = do
-- Delete metadata cache where necessary
- provider <- Internal.newProvider store ignore directory
- forM_ (Internal.resourceList provider) $ \identifier ->
- if Internal.resourceModified provider identifier
- then Internal.resourceInvalidateMetadataCache provider identifier
- else return ()
- return provider
+ p <- Internal.newProvider store ignore directory
+ mapM_ (Internal.resourceInvalidateMetadataCache p) $
+ filter (Internal.resourceModified p) $ Internal.resourceList p
+ return p
diff --git a/src/Hakyll/Core/Provider/Internal.hs b/src/Hakyll/Core/Provider/Internal.hs
index 64b19c8..5c3d07e 100644
--- a/src/Hakyll/Core/Provider/Internal.hs
+++ b/src/Hakyll/Core/Provider/Internal.hs
@@ -172,12 +172,13 @@ resourceLBS p i = BL.readFile $ resourceFilePath p i
-- | A resource is modified if it or its metadata has changed
resourceModified :: Provider -> Identifier -> Bool
resourceModified p r = case (ri, oldRi) of
- (Nothing, _) -> True
+ (Nothing, _) -> False
(Just _, Nothing) -> True
(Just n, Just o) -> resourceInfoModified n > resourceInfoModified o
where
- ri = M.lookup (setVersion Nothing r) (providerFiles p)
- oldRi = ri >>= resourceInfoMetadata >>= flip M.lookup (providerFiles p)
+ normal = setVersion Nothing r
+ ri = M.lookup normal (providerFiles p)
+ oldRi = M.lookup normal (providerOldFiles p)
--------------------------------------------------------------------------------