summaryrefslogtreecommitdiff
path: root/src/Hakyll/Commands.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2013-05-22 03:03:46 -0700
committerJasper Van der Jeugt <jaspervdj@gmail.com>2013-05-22 03:03:46 -0700
commit2ef7fee7978af45416634ae9a024523a2f6f0e10 (patch)
treeddab5348a653c6ea4ff31f348b73e8c92b613e80 /src/Hakyll/Commands.hs
parent2430751164c4bc19f1e15419a92a37e7f703794a (diff)
parent8c73820abcd91ece6fac001bdec3aa341d90f6bf (diff)
downloadhakyll-2ef7fee7978af45416634ae9a024523a2f6f0e10.tar.gz
Merge pull request #154 from tunixman/master
Have Build and Rebuild commands exit with status
Diffstat (limited to 'src/Hakyll/Commands.hs')
-rw-r--r--src/Hakyll/Commands.hs20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/Hakyll/Commands.hs b/src/Hakyll/Commands.hs
index 6d6b0ae..7e4ba1c 100644
--- a/src/Hakyll/Commands.hs
+++ b/src/Hakyll/Commands.hs
@@ -13,8 +13,8 @@ module Hakyll.Commands
--------------------------------------------------------------------------------
-import System.Exit (exitWith)
-
+import System.Exit (exitWith, ExitCode)
+import Control.Applicative
--------------------------------------------------------------------------------
import qualified Hakyll.Check as Check
@@ -25,7 +25,6 @@ import Hakyll.Core.Rules.Internal
import Hakyll.Core.Runtime
import Hakyll.Core.Util.File
-
--------------------------------------------------------------------------------
#ifdef PREVIEW_SERVER
import Hakyll.Preview.Poll
@@ -35,11 +34,8 @@ import Hakyll.Preview.Server
--------------------------------------------------------------------------------
-- | Build the site
-build :: Configuration -> Verbosity -> Rules a -> IO ()
-build conf verbosity rules = do
- _ <- run conf verbosity rules
- return ()
-
+build :: Configuration -> Verbosity -> Rules a -> IO ExitCode
+build conf verbosity rules = fst <$> run conf verbosity rules
--------------------------------------------------------------------------------
-- | Run the checker and exit
@@ -78,11 +74,9 @@ preview _ _ _ _ = previewServerDisabled
--------------------------------------------------------------------------------
-- | Rebuild the site
-rebuild :: Configuration -> Verbosity -> Rules a -> IO ()
-rebuild conf verbosity rules = do
- clean conf
- build conf verbosity rules
-
+rebuild :: Configuration -> Verbosity -> Rules a -> IO ExitCode
+rebuild conf verbosity rules =
+ clean conf >> build conf verbosity rules
--------------------------------------------------------------------------------
-- | Start a server