1--------------------------------------------------------------------------------
2-- | Exports a datastructure for the top-level hakyll configuration
3module Hakyll.Core.Configuration
11--------------------------------------------------------------------------------
12import Data.List (isPrefixOf, isSuffixOf)
13import System.FilePath (normalise, takeFileName)
16--------------------------------------------------------------------------------
17import Hakyll.Core.Logger
20--------------------------------------------------------------------------------
21data Configuration = Configuration
22 { -- | Directory in which the output written
23 destinationDirectory :: FilePath
24 , -- | Directory where hakyll's internal store is kept
25 storeDirectory :: FilePath
26 , -- | Directory where hakyll finds the files to compile. This is @.@ by
28 providerDirectory :: FilePath
29 , -- | Function to determine ignored files
31 -- In 'defaultConfiguration', the following files are ignored:
33 -- * files starting with a @.@
35 -- * files starting with a @#@
37 -- * files ending with a @~@
39 -- * files ending with @.swp@
41 -- Note that the files in 'destinationDirectory' and 'storeDirectory' will
42 -- also be ignored. Note that this is the configuration parameter, if you
43 -- want to use the test, you should use 'shouldIgnoreFile'.
45 ignoreFile :: FilePath -> Bool
46 , -- | Here, you can plug in a system command to upload/deploy your site.
50 -- > rsync -ave 'ssh -p 2217' _site jaspervdj@jaspervdj.be:hakyll
52 -- You can execute this by using
56 deployCommand :: String
57 , -- | Use an in-memory cache for items. This is faster but uses more
60 -- | Verbosity for the logger
61 , verbosity :: Verbosity
65--------------------------------------------------------------------------------
66-- | Default configuration for a hakyll application
67defaultConfiguration :: Configuration
68defaultConfiguration = Configuration
69 { destinationDirectory = "_site"
70 , storeDirectory = "_cache"
71 , providerDirectory = "."
72 , ignoreFile = ignoreFile'
73 , deployCommand = "echo 'No deploy command specified'"
74 , inMemoryCache = True
79 | "." `isPrefixOf` fileName = True
80 | "#" `isPrefixOf` fileName = True
81 | "~" `isSuffixOf` fileName = True
82 | ".swp" `isSuffixOf` fileName = True
85 fileName = takeFileName path
88--------------------------------------------------------------------------------
89-- | Check if a file should be ignored
90shouldIgnoreFile :: Configuration -> FilePath -> Bool
91shouldIgnoreFile conf path =
92 destinationDirectory conf `isPrefixOf` path' ||
93 storeDirectory conf `isPrefixOf` path' ||
96 path' = normalise path
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list