on master help sign in
added a default instance for Configuration
439847ePiyush P Kurur
hakyll.cabal+1
@@ -92,6 +92,7 @@ Library
92 citeproc-hs >= 0.3.2 && < 0.4,
92 citeproc-hs >= 0.3.2 && < 0.4,
93 containers >= 0.3 && < 0.6,
93 containers >= 0.3 && < 0.6,
94 cryptohash >= 0.7 && < 0.9,
94 cryptohash >= 0.7 && < 0.9,
95+ data-default >= 0.4 && < 0.5,
95 deepseq >= 1.3 && < 1.4,
96 deepseq >= 1.3 && < 1.4,
96 directory >= 1.0 && < 1.3,
97 directory >= 1.0 && < 1.3,
97 filepath >= 1.0 && < 1.4,
98 filepath >= 1.0 && < 1.4,
src/Hakyll/Core/Configuration.hs+21
@@ -8,6 +8,7 @@ module Hakyll.Core.Configuration
8
8
9
9
10--------------------------------------------------------------------------------
10--------------------------------------------------------------------------------
11+import Data.Default
11import Data.List (isPrefixOf, isSuffixOf)
12import Data.List (isPrefixOf, isSuffixOf)
12import System.FilePath (normalise, takeFileName)
13import System.FilePath (normalise, takeFileName)
13
14
@@ -56,8 +57,28 @@ data Configuration = Configuration
56 inMemoryCache :: Bool
57 inMemoryCache :: Bool
57 }
58 }
58
59
60+instance Default Configuration where
61+ def = Configuration
62+ { destinationDirectory = "_site"
63+ , storeDirectory = "_cache"
64+ , tmpDirectory = "_cache/tmp"
65+ , providerDirectory = "."
66+ , ignoreFile = ignoreFile'
67+ , deployCommand = "echo 'No deploy command specified'"
68+ , inMemoryCache = True
69+ }
70+ where
71+ ignoreFile' path
72+ | "." `isPrefixOf` fileName = True
73+ | "#" `isPrefixOf` fileName = True
74+ | "~" `isSuffixOf` fileName = True
75+ | ".swp" `isSuffixOf` fileName = True
76+ | otherwise = False
77+ where
78+ fileName = takeFileName path
59
79
60--------------------------------------------------------------------------------
80--------------------------------------------------------------------------------
81+
61-- | Default configuration for a hakyll application
82-- | Default configuration for a hakyll application
62defaultConfiguration :: Configuration
83defaultConfiguration :: Configuration
63defaultConfiguration = Configuration
84defaultConfiguration = Configuration