From c236cda401d401bf5b42d3546ee2f117d5729219 Mon Sep 17 00:00:00 2001 From: Evan Cofsky Date: Mon, 20 May 2013 21:17:31 -0700 Subject: Have Build and Rebuild exit with a status to the shell. --- src/Hakyll/Commands.hs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/Hakyll/Commands.hs') diff --git a/src/Hakyll/Commands.hs b/src/Hakyll/Commands.hs index 6d6b0ae..1df1d56 100644 --- a/src/Hakyll/Commands.hs +++ b/src/Hakyll/Commands.hs @@ -13,7 +13,7 @@ module Hakyll.Commands -------------------------------------------------------------------------------- -import System.Exit (exitWith) +import System.Exit (exitWith, ExitCode) -------------------------------------------------------------------------------- @@ -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,10 @@ import Hakyll.Preview.Server -------------------------------------------------------------------------------- -- | Build the site -build :: Configuration -> Verbosity -> Rules a -> IO () +build :: Configuration -> Verbosity -> Rules a -> IO (ExitCode) build conf verbosity rules = do - _ <- run conf verbosity rules - return () - + (ec, _) <- run conf verbosity rules + return ec -------------------------------------------------------------------------------- -- | Run the checker and exit @@ -78,11 +76,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 -- cgit v1.2.3 From 8c73820abcd91ece6fac001bdec3aa341d90f6bf Mon Sep 17 00:00:00 2001 From: Evan Cofsky Date: Tue, 21 May 2013 09:01:00 -0700 Subject: Clean up type declarations, use fst and <$>. --- src/Hakyll/Commands.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/Hakyll/Commands.hs') diff --git a/src/Hakyll/Commands.hs b/src/Hakyll/Commands.hs index 1df1d56..7e4ba1c 100644 --- a/src/Hakyll/Commands.hs +++ b/src/Hakyll/Commands.hs @@ -14,7 +14,7 @@ module Hakyll.Commands -------------------------------------------------------------------------------- import System.Exit (exitWith, ExitCode) - +import Control.Applicative -------------------------------------------------------------------------------- import qualified Hakyll.Check as Check @@ -34,10 +34,8 @@ import Hakyll.Preview.Server -------------------------------------------------------------------------------- -- | Build the site -build :: Configuration -> Verbosity -> Rules a -> IO (ExitCode) -build conf verbosity rules = do - (ec, _) <- run conf verbosity rules - return ec +build :: Configuration -> Verbosity -> Rules a -> IO ExitCode +build conf verbosity rules = fst <$> run conf verbosity rules -------------------------------------------------------------------------------- -- | Run the checker and exit @@ -76,7 +74,7 @@ preview _ _ _ _ = previewServerDisabled -------------------------------------------------------------------------------- -- | Rebuild the site -rebuild :: Configuration -> Verbosity -> Rules a -> IO (ExitCode) +rebuild :: Configuration -> Verbosity -> Rules a -> IO ExitCode rebuild conf verbosity rules = clean conf >> build conf verbosity rules -- cgit v1.2.3