@@ -8,9 +8,11 @@ module Hakyll.Core.Configuration
10--------------------------------------------------------------------------------
10--------------------------------------------------------------------------------
11+import Control.Monad (void)
11import Data.Default (Default(..))
12import Data.Default (Default(..))
12import Data.List (isPrefixOf, isSuffixOf)
13import Data.List (isPrefixOf, isSuffixOf)
13import System.FilePath (normalise, takeFileName)
14import System.FilePath (normalise, takeFileName)
15+import System.Process (system)
16--------------------------------------------------------------------------------
18--------------------------------------------------------------------------------
@@ -52,6 +54,16 @@ data Configuration = Configuration
52 -- > ./site deploy
54 -- > ./site deploy
54 deployCommand :: String
56 deployCommand :: String
57+ , -- | Function to deploy the site from Haskell.
59+ -- By default, this command executes the shell command stored in
60+ -- 'deployCommand'. If you override it, 'deployCommand' will not
61+ -- be used implicitely.
63+ -- The 'Configuration' object is passed as a parameter to this
66+ deploySite :: Configuration -> IO ()
55 , -- | Use an in-memory cache for items. This is faster but uses more
67 , -- | Use an in-memory cache for items. This is faster but uses more
56 -- memory.
68 -- memory.
57 inMemoryCache :: Bool
69 inMemoryCache :: Bool
@@ -71,6 +83,7 @@ defaultConfiguration = Configuration
71 , providerDirectory = "."
83 , providerDirectory = "."
72 , ignoreFile = ignoreFile'
84 , ignoreFile = ignoreFile'
73 , deployCommand = "echo 'No deploy command specified'"
85 , deployCommand = "echo 'No deploy command specified'"
86+ , deploySite = void . system . deployCommand
74 , inMemoryCache = True
87 , inMemoryCache = True