summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimonas Kazlauskas <git@kazlauskas.me>2013-05-22 15:24:26 +0300
committerSimonas Kazlauskas <git@kazlauskas.me>2013-05-22 15:24:26 +0300
commit0a818d0725af6d5242d1545bf40a1eb532dfd1e5 (patch)
treecd4c0d3abf5b728d7fa1fdc5412e73338d3e6550
parent2ef7fee7978af45416634ae9a024523a2f6f0e10 (diff)
downloadhakyll-0a818d0725af6d5242d1545bf40a1eb532dfd1e5.tar.gz
Deploy should propagate error code
And return 1 if neither deployCommand and deploySite is set.
-rw-r--r--src/Hakyll/Commands.hs2
-rw-r--r--src/Hakyll/Core/Configuration.hs7
-rw-r--r--src/Hakyll/Main.hs2
3 files changed, 6 insertions, 5 deletions
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