From 0a818d0725af6d5242d1545bf40a1eb532dfd1e5 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Wed, 22 May 2013 15:24:26 +0300 Subject: Deploy should propagate error code And return 1 if neither deployCommand and deploySite is set. --- src/Hakyll/Commands.hs | 2 +- src/Hakyll/Core/Configuration.hs | 7 ++++--- src/Hakyll/Main.hs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Hakyll/Commands.hs b/src/Hakyll/Commands.hs index 7e4ba1c..d86fd5c 100644 --- a/src/Hakyll/Commands.hs +++ b/src/Hakyll/Commands.hs @@ -94,7 +94,7 @@ server _ _ = previewServerDisabled -------------------------------------------------------------------------------- -- | Upload the site -deploy :: Configuration -> IO () +deploy :: Configuration -> IO ExitCode deploy conf = deploySite conf conf diff --git a/src/Hakyll/Core/Configuration.hs b/src/Hakyll/Core/Configuration.hs index 70a7a1c..790badc 100644 --- a/src/Hakyll/Core/Configuration.hs +++ b/src/Hakyll/Core/Configuration.hs @@ -12,6 +12,7 @@ import Control.Monad (void) import Data.Default (Default (..)) import Data.List (isPrefixOf, isSuffixOf) import System.Directory (canonicalizePath) +import System.Exit (ExitCode) import System.FilePath (isAbsolute, normalise, takeFileName) import System.IO.Error (catchIOError) import System.Process (system) @@ -65,7 +66,7 @@ data Configuration = Configuration -- The 'Configuration' object is passed as a parameter to this -- function. -- - deploySite :: Configuration -> IO () + deploySite :: Configuration -> IO ExitCode , -- | Use an in-memory cache for items. This is faster but uses more -- memory. inMemoryCache :: Bool @@ -84,8 +85,8 @@ defaultConfiguration = Configuration , tmpDirectory = "_cache/tmp" , providerDirectory = "." , ignoreFile = ignoreFile' - , deployCommand = "echo 'No deploy command specified'" - , deploySite = void . system . deployCommand + , deployCommand = "echo 'No deploy command specified' && exit 1" + , deploySite = system . deployCommand , inMemoryCache = True } where diff --git a/src/Hakyll/Main.hs b/src/Hakyll/Main.hs index 0f0d340..7e50418 100644 --- a/src/Hakyll/Main.hs +++ b/src/Hakyll/Main.hs @@ -44,7 +44,7 @@ hakyllWith conf rules = do Build _ -> Commands.build conf verbosity' rules >>= exitWith Check _ _ -> Commands.check conf verbosity' check' Clean _ -> Commands.clean conf - Deploy _ -> Commands.deploy conf + Deploy _ -> Commands.deploy conf >>= exitWith Help _ -> showHelp Preview _ p -> Commands.preview conf verbosity' rules p Rebuild _ -> Commands.rebuild conf verbosity' rules >>= exitWith -- cgit v1.2.3