on master help sign in
added a default instance for Configuration
commit439847eb6f002f61bdc7a37a07989ab26540ab67 authorPiyush P Kurur <ppk@cse.iitk.ac.in> dateThu 7 Mar 2013, 16:43 (14 years ago) parent5cbb4ba
2 files changed+22
hakyll.cabal+1 src/Hakyll/Core/Configuration.hs+21
hakyll.cabal+1
@@ -92,6 +92,7 @@ Library
9292 citeproc-hs >= 0.3.2 && < 0.4,
9393 containers >= 0.3 && < 0.6,
9494 cryptohash >= 0.7 && < 0.9,
95+ data-default >= 0.4 && < 0.5,
9596 deepseq >= 1.3 && < 1.4,
9697 directory >= 1.0 && < 1.3,
9798 filepath >= 1.0 && < 1.4,
src/Hakyll/Core/Configuration.hs+21
@@ -8,6 +8,7 @@ module Hakyll.Core.Configuration
88
99
1010--------------------------------------------------------------------------------
11+import Data.Default
1112import Data.List (isPrefixOf, isSuffixOf)
1213import System.FilePath (normalise, takeFileName)
1314
@@ -56,8 +57,28 @@ data Configuration = Configuration
5657 inMemoryCache :: Bool
5758 }
5859
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
5979
6080--------------------------------------------------------------------------------
81+
6182-- | Default configuration for a hakyll application
6283defaultConfiguration :: Configuration
6384defaultConfiguration = Configuration