diff --git a/hakyll.cabal b/hakyll.cabal index 4649c8c..b952da6 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -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, diff --git a/src/Hakyll/Core/Configuration.hs b/src/Hakyll/Core/Configuration.hs index fdca879..be9a460 100644 --- a/src/Hakyll/Core/Configuration.hs +++ b/src/Hakyll/Core/Configuration.hs @@ -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