1--------------------------------------------------------------------------------
2-- | Exports a datastructure for the top-level hakyll configuration
3module Hakyll.Core.Configuration
10--------------------------------------------------------------------------------
11import Data.List (isPrefixOf, isSuffixOf)
12import System.FilePath (normalise, takeFileName)
15--------------------------------------------------------------------------------
16data Configuration = Configuration
17 { -- | Directory in which the output written
18 destinationDirectory :: FilePath
19 , -- | Directory where hakyll's internal store is kept
20 storeDirectory :: FilePath
21 , -- | Directory in which some temporary files will be kept
22 tmpDirectory :: FilePath
23 , -- | Directory where hakyll finds the files to compile. This is @.@ by
25 providerDirectory :: FilePath
26 , -- | Function to determine ignored files
28 -- In 'defaultConfiguration', the following files are ignored:
30 -- * files starting with a @.@
32 -- * files starting with a @#@
34 -- * files ending with a @~@
36 -- * files ending with @.swp@
38 -- Note that the files in 'destinationDirectory' and 'storeDirectory' will
39 -- also be ignored. Note that this is the configuration parameter, if you
40 -- want to use the test, you should use 'shouldIgnoreFile'.
42 ignoreFile :: FilePath -> Bool
43 , -- | Here, you can plug in a system command to upload/deploy your site.
47 -- > rsync -ave 'ssh -p 2217' _site jaspervdj@jaspervdj.be:hakyll
49 -- You can execute this by using
53 deployCommand :: String
54 , -- | Use an in-memory cache for items. This is faster but uses more
60--------------------------------------------------------------------------------
61-- | Default configuration for a hakyll application
62defaultConfiguration :: Configuration
63defaultConfiguration = Configuration
64 { destinationDirectory = "_site"
65 , storeDirectory = "_cache"
66 , tmpDirectory = "_cache/tmp"
67 , providerDirectory = "."
68 , ignoreFile = ignoreFile'
69 , deployCommand = "echo 'No deploy command specified'"
70 , inMemoryCache = True
74 | "." `isPrefixOf` fileName = True
75 | "#" `isPrefixOf` fileName = True
76 | "~" `isSuffixOf` fileName = True
77 | ".swp" `isSuffixOf` fileName = True
80 fileName = takeFileName path
83--------------------------------------------------------------------------------
84-- | Check if a file should be ignored
85shouldIgnoreFile :: Configuration -> FilePath -> Bool
86shouldIgnoreFile conf path =
87 destinationDirectory conf `isPrefixOf` path' ||
88 storeDirectory conf `isPrefixOf` path' ||
89 tmpDirectory conf `isPrefixOf` path' ||
92 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