summaryrefslogtreecommitdiff
path: root/Biz/Devalloc.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-02-05 21:56:20 -0500
committerBen Sima <ben@bsima.me>2021-02-05 21:56:20 -0500
commit753cdfe8c18b470da4a4807815d0aaade53f1d16 (patch)
tree1194557e0e0ab2e825c2786bf4bcccc33e86da27 /Biz/Devalloc.hs
parent1c75a8ee4c9914c7d482b38195b813b12ef4f834 (diff)
Add 'tidy' to Plan
This is supposed to be how to cleanup the database and any other local files. Should only be used before/after test, so maybe I can find a way to enforce this constraint somehow in the code.
Diffstat (limited to 'Biz/Devalloc.hs')
-rw-r--r--Biz/Devalloc.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Biz/Devalloc.hs b/Biz/Devalloc.hs
index bdb958f..9bc8bd0 100644
--- a/Biz/Devalloc.hs
+++ b/Biz/Devalloc.hs
@@ -397,7 +397,7 @@ init =
-- * main and test
main :: IO ()
-main = Cli.main <| Cli.Plan help move test
+main = Cli.main <| Cli.Plan help move test tidy
help :: Cli.Docopt
help =
@@ -435,6 +435,9 @@ startup = do
shutdown :: (Config, Application, Acid.AcidState Keep) -> IO ()
shutdown (_, _, kp) = Acid.closeAcidState kp
+tidy :: Config -> IO ()
+tidy Config {..} = Directory.removeDirectoryRecursive keep
+
run :: (Config, Wai.Application, Acid.AcidState Keep) -> IO ()
run (cfg, app, _) = Warp.run (port cfg) (logStdout app)