summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Resource/Provider/Dummy.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-04-12 11:47:26 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-04-12 11:47:26 +0200
commit4ae03a797f8901e1f606e07ce70c3fedea443285 (patch)
treef201ef9679801532a76ddd9777881793ce1ab15e /src/Hakyll/Core/Resource/Provider/Dummy.hs
parentedcd3151ee54f3f71d2ffe0a60348f6641909ce7 (diff)
downloadhakyll-4ae03a797f8901e1f606e07ce70c3fedea443285.tar.gz
Dummy resource provider for testing purposes
Diffstat (limited to 'src/Hakyll/Core/Resource/Provider/Dummy.hs')
-rw-r--r--src/Hakyll/Core/Resource/Provider/Dummy.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Resource/Provider/Dummy.hs b/src/Hakyll/Core/Resource/Provider/Dummy.hs
new file mode 100644
index 0000000..bc0b16d
--- /dev/null
+++ b/src/Hakyll/Core/Resource/Provider/Dummy.hs
@@ -0,0 +1,21 @@
+-- | Dummy resource provider for testing purposes
+--
+module Hakyll.Core.Resource.Provider.Dummy
+ ( dummyResourceProvider
+ ) where
+
+import Data.Map (Map)
+import qualified Data.Map as M
+
+import qualified Data.ByteString.Lazy.Char8 as LBC
+
+import Hakyll.Core.Resource
+import Hakyll.Core.Resource.Provider
+
+-- | Create a dummy 'ResourceProvider'
+--
+dummyResourceProvider :: Map String String -> IO ResourceProvider
+dummyResourceProvider vfs = makeResourceProvider
+ (map Resource (M.keys vfs))
+ (return . (vfs M.!) . unResource)
+ (return . LBC.pack . (vfs M.!) . unResource)