diff options
| author | Piyush P Kurur <ppk@cse.iitk.ac.in> | 2013-03-07 16:43:53 +0530 |
|---|---|---|
| committer | Piyush P Kurur <ppk@cse.iitk.ac.in> | 2013-03-07 16:46:17 +0530 |
| commit | 439847eb6f002f61bdc7a37a07989ab26540ab67 (patch) | |
| tree | a2b6d3502716689b81296b5aca095d0bfab938b7 | |
| parent | 5cbb4ba75c84f6329c8a37ded983efb4994602a0 (diff) | |
| download | hakyll-439847eb6f002f61bdc7a37a07989ab26540ab67.tar.gz | |
added a default instance for Configuration
| -rw-r--r-- | hakyll.cabal | 1 | ||||
| -rw-r--r-- | src/Hakyll/Core/Configuration.hs | 21 |
2 files changed, 22 insertions, 0 deletions
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 |
