added a default instance for Configuration

This commit is contained in:
Piyush P Kurur 2013-03-07 16:43:53 +05:30
parent 5cbb4ba75c
commit 439847eb6f
2 changed files with 22 additions and 0 deletions

View file

@ -92,6 +92,7 @@ Library
citeproc-hs >= 0.3.2 && < 0.4,
containers >= 0.3 && < 0.6,
cryptohash >= 0.7 && < 0.9,
data-default >= 0.4 && < 0.5,
deepseq >= 1.3 && < 1.4,
directory >= 1.0 && < 1.3,
filepath >= 1.0 && < 1.4,

View file

@ -8,6 +8,7 @@ module Hakyll.Core.Configuration
--------------------------------------------------------------------------------
import Data.Default
import Data.List (isPrefixOf, isSuffixOf)
import System.FilePath (normalise, takeFileName)
@ -56,8 +57,28 @@ data Configuration = Configuration
inMemoryCache :: Bool
}
instance Default Configuration where
def = Configuration
{ destinationDirectory = "_site"
, storeDirectory = "_cache"
, tmpDirectory = "_cache/tmp"
, providerDirectory = "."
, ignoreFile = ignoreFile'
, deployCommand = "echo 'No deploy command specified'"
, inMemoryCache = True
}
where
ignoreFile' path
| "." `isPrefixOf` fileName = True
| "#" `isPrefixOf` fileName = True
| "~" `isSuffixOf` fileName = True
| ".swp" `isSuffixOf` fileName = True
| otherwise = False
where
fileName = takeFileName path
--------------------------------------------------------------------------------
-- | Default configuration for a hakyll application
defaultConfiguration :: Configuration
defaultConfiguration = Configuration