From 712ffa39b5857fdc5cdae1db38a177267a430b11 Mon Sep 17 00:00:00 2001
From: Alexey Kreshchuk <akrsch@gmail.com>
Date: Wed, 16 Oct 2013 01:39:04 +0400
Subject: Track metadata dependencies

I had to prepend some Rules to global Rules set. This might be possible
to replaced by a correct Store.set call.
I also had to prepend some Compile rules.
---
 src/Hakyll/Core/Rules/Default.hs | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 src/Hakyll/Core/Rules/Default.hs

(limited to 'src/Hakyll/Core/Rules/Default.hs')

diff --git a/src/Hakyll/Core/Rules/Default.hs b/src/Hakyll/Core/Rules/Default.hs
new file mode 100644
index 0000000..ccca1bd
--- /dev/null
+++ b/src/Hakyll/Core/Rules/Default.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE OverloadedStrings          #-}
+module Hakyll.Core.Rules.Default 
+    ( internalRules
+    , addMetadataDependencies 
+    )
+where
+import           Hakyll.Core.Rules
+import           Hakyll.Core.Compiler
+import           Hakyll.Core.Compiler.Internal (compilerTellDependencies)
+import           Hakyll.Core.Metadata          (getMatches, metadataFiles)
+import           Hakyll.Core.Identifier.Pattern(fromList)
+
+internalRules :: Rules ()
+internalRules  = do
+    match "metadata" $ compile $ makeItem ()
+    match "**/metadata" $ compile $ makeItem ()
+
+--------------------------------------------------------------------------------
+addMetadataDependencies :: Compiler ()
+addMetadataDependencies =
+    compilerTellDependencies . map IdentifierDependency =<< getMatches . fromList =<< fmap metadataFiles getUnderlying
+
+
-- 
cgit v1.2.3