on master help sign in
Merge pull request #154 from tunixman/master
2ef7feeJasper Van der Jeugt
src/Hakyll/Commands.hs+7−13
@@ -13,8 +13,8 @@ module Hakyll.Commands
13
13
14
14
15--------------------------------------------------------------------------------
15--------------------------------------------------------------------------------
16−import System.Exit (exitWith)
16+import System.Exit (exitWith, ExitCode)
17−
17+import Control.Applicative
18
18
19--------------------------------------------------------------------------------
19--------------------------------------------------------------------------------
20import qualified Hakyll.Check as Check
20import qualified Hakyll.Check as Check
@@ -25,7 +25,6 @@ import Hakyll.Core.Rules.Internal
25import Hakyll.Core.Runtime
25import Hakyll.Core.Runtime
26import Hakyll.Core.Util.File
26import Hakyll.Core.Util.File
27
27
28−
29--------------------------------------------------------------------------------
28--------------------------------------------------------------------------------
30#ifdef PREVIEW_SERVER
29#ifdef PREVIEW_SERVER
31import Hakyll.Preview.Poll
30import Hakyll.Preview.Poll
@@ -35,11 +34,8 @@ import Hakyll.Preview.Server
35
34
36--------------------------------------------------------------------------------
35--------------------------------------------------------------------------------
37-- | Build the site
36-- | Build the site
38−build :: Configuration -> Verbosity -> Rules a -> IO ()
37+build :: Configuration -> Verbosity -> Rules a -> IO ExitCode
39−build conf verbosity rules = do
38+build conf verbosity rules = fst <$> run conf verbosity rules
40− _ <- run conf verbosity rules
41− return ()
42−
43
39
44--------------------------------------------------------------------------------
40--------------------------------------------------------------------------------
45-- | Run the checker and exit
41-- | Run the checker and exit
@@ -78,11 +74,9 @@ preview _ _ _ _ = previewServerDisabled
78
74
79--------------------------------------------------------------------------------
75--------------------------------------------------------------------------------
80-- | Rebuild the site
76-- | Rebuild the site
81−rebuild :: Configuration -> Verbosity -> Rules a -> IO ()
77+rebuild :: Configuration -> Verbosity -> Rules a -> IO ExitCode
82−rebuild conf verbosity rules = do
78+rebuild conf verbosity rules =
83− clean conf
84− build conf verbosity rules
79+ clean conf >> build conf verbosity rules
85−
86
80
87--------------------------------------------------------------------------------
81--------------------------------------------------------------------------------
88-- | Start a server
82-- | Start a server
src/Hakyll/Main.hs+3−3
@@ -13,7 +13,7 @@ import System.Console.CmdArgs
13import qualified System.Console.CmdArgs.Explicit as CA
13import qualified System.Console.CmdArgs.Explicit as CA
14import System.Environment (getProgName)
14import System.Environment (getProgName)
15import System.IO.Unsafe (unsafePerformIO)
15import System.IO.Unsafe (unsafePerformIO)
16−
16+import System.Exit (exitWith)
17
17
18--------------------------------------------------------------------------------
18--------------------------------------------------------------------------------
19import qualified Hakyll.Check as Check
19import qualified Hakyll.Check as Check
@@ -41,13 +41,13 @@ hakyllWith conf rules = do
41 if internal_links args' then Check.InternalLinks else Check.All
41 if internal_links args' then Check.InternalLinks else Check.All
42
42
43 case args' of
43 case args' of
44− Build _ -> Commands.build conf verbosity' rules
44+ Build _ -> Commands.build conf verbosity' rules >>= exitWith
45 Check _ _ -> Commands.check conf verbosity' check'
45 Check _ _ -> Commands.check conf verbosity' check'
46 Clean _ -> Commands.clean conf
46 Clean _ -> Commands.clean conf
47 Deploy _ -> Commands.deploy conf
47 Deploy _ -> Commands.deploy conf
48 Help _ -> showHelp
48 Help _ -> showHelp
49 Preview _ p -> Commands.preview conf verbosity' rules p
49 Preview _ p -> Commands.preview conf verbosity' rules p
50− Rebuild _ -> Commands.rebuild conf verbosity' rules
50+ Rebuild _ -> Commands.rebuild conf verbosity' rules >>= exitWith
51 Server _ _ -> Commands.server conf (port args')
51 Server _ _ -> Commands.server conf (port args')
52
52
53
53