diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2013-03-26 02:08:34 -0700 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2013-03-26 02:08:34 -0700 |
commit | e552896338fe369b363160111099af99b7f1d265 (patch) | |
tree | 747c32d1e0c267a1c074971bf5097eacced007a5 /src/Hakyll | |
parent | 6c8fda2c00bd14bf75c9fa1b98b09e283711a706 (diff) | |
parent | 543cba90f6efba8508d2feb3377b1a9f5f428c1a (diff) | |
download | hakyll-e552896338fe369b363160111099af99b7f1d265.tar.gz |
Merge pull request #125 from samueltardieu/deploy-in-haskell
Allow overriding the `deploy` command with Haskell code
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Commands.hs | 5 | ||||
-rw-r--r-- | src/Hakyll/Core/Configuration.hs | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/Hakyll/Commands.hs b/src/Hakyll/Commands.hs index 4c60783..6e0b9f2 100644 --- a/src/Hakyll/Commands.hs +++ b/src/Hakyll/Commands.hs @@ -14,7 +14,6 @@ module Hakyll.Commands -------------------------------------------------------------------------------- import System.Exit (ExitCode (ExitSuccess), exitWith) -import System.Process (system) -------------------------------------------------------------------------------- @@ -109,9 +108,7 @@ server _ _ = previewServerDisabled -------------------------------------------------------------------------------- -- | Upload the site deploy :: Configuration -> IO () -deploy conf = do - _ <- system $ deployCommand conf - return () +deploy conf = deploySite conf conf -------------------------------------------------------------------------------- diff --git a/src/Hakyll/Core/Configuration.hs b/src/Hakyll/Core/Configuration.hs index 5382b6d..480c6c4 100644 --- a/src/Hakyll/Core/Configuration.hs +++ b/src/Hakyll/Core/Configuration.hs @@ -8,9 +8,11 @@ module Hakyll.Core.Configuration -------------------------------------------------------------------------------- +import Control.Monad (void) import Data.Default (Default(..)) import Data.List (isPrefixOf, isSuffixOf) import System.FilePath (normalise, takeFileName) +import System.Process (system) -------------------------------------------------------------------------------- @@ -52,6 +54,16 @@ data Configuration = Configuration -- > ./site deploy -- deployCommand :: String + , -- | Function to deploy the site from Haskell. + -- + -- By default, this command executes the shell command stored in + -- 'deployCommand'. If you override it, 'deployCommand' will not + -- be used implicitely. + -- + -- The 'Configuration' object is passed as a parameter to this + -- function. + -- + deploySite :: Configuration -> IO () , -- | Use an in-memory cache for items. This is faster but uses more -- memory. inMemoryCache :: Bool @@ -71,6 +83,7 @@ defaultConfiguration = Configuration , providerDirectory = "." , ignoreFile = ignoreFile' , deployCommand = "echo 'No deploy command specified'" + , deploySite = void . system . deployCommand , inMemoryCache = True } where |