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