2011-02-03 10:34:00 +00:00
|
|
|
-- | Exports a datastructure for the top-level hakyll configuration
|
|
|
|
--
|
|
|
|
module Hakyll.Core.Configuration
|
|
|
|
( HakyllConfiguration (..)
|
|
|
|
, defaultHakyllConfiguration
|
|
|
|
) where
|
|
|
|
|
2011-02-19 16:04:50 +00:00
|
|
|
import System.FilePath (takeFileName)
|
|
|
|
import Data.List (isPrefixOf, isSuffixOf)
|
|
|
|
|
2011-02-03 10:34:00 +00:00
|
|
|
data HakyllConfiguration = HakyllConfiguration
|
|
|
|
{ -- | Directory in which the output written
|
|
|
|
destinationDirectory :: FilePath
|
|
|
|
, -- | Directory where hakyll's internal store is kept
|
|
|
|
storeDirectory :: FilePath
|
2011-02-19 16:04:50 +00:00
|
|
|
, -- | Function to determine ignored files
|
|
|
|
--
|
|
|
|
-- In 'defaultHakyllConfiguration', the following files are ignored:
|
|
|
|
--
|
|
|
|
-- * files starting with a @.@
|
|
|
|
--
|
|
|
|
-- * files ending with a @~@
|
|
|
|
--
|
|
|
|
-- * files ending with @.swp@
|
|
|
|
--
|
|
|
|
ignoreFile :: FilePath -> Bool
|
|
|
|
}
|
2011-02-03 10:34:00 +00:00
|
|
|
|
|
|
|
-- | Default configuration for a hakyll application
|
|
|
|
--
|
|
|
|
defaultHakyllConfiguration :: HakyllConfiguration
|
|
|
|
defaultHakyllConfiguration = HakyllConfiguration
|
|
|
|
{ destinationDirectory = "_site"
|
|
|
|
, storeDirectory = "_cache"
|
2011-02-19 16:04:50 +00:00
|
|
|
, ignoreFile = ignoreFile'
|
2011-02-03 10:34:00 +00:00
|
|
|
}
|
2011-02-19 16:04:50 +00:00
|
|
|
where
|
|
|
|
ignoreFile' path
|
|
|
|
| "." `isPrefixOf` fileName = True
|
|
|
|
| "~" `isSuffixOf` fileName = True
|
|
|
|
| ".swp" `isSuffixOf` fileName = True
|
|
|
|
| otherwise = False
|
|
|
|
where
|
|
|
|
fileName = takeFileName path
|