packages feed

HAppSHelpers 0.5 → 0.6

raw patch · 2 files changed

+35/−2 lines, 2 filesdep +HAppS-Statedep +old-time

Dependencies added: HAppS-State, old-time

Files

+ HAppS/Server/Helpers.hs view
@@ -0,0 +1,32 @@+module HAppS.Server.Helpers+    ( smartserver+    ) where++import HAppS.Server+import HAppS.State+import System.Environment+import Control.Concurrent+import System.Time++-- run the happs server on some port+smartserver :: (Methods st, Component st, ToMessage a) =>+               Conf -> String -> [ServerPartT IO a] -> Proxy st -> IO ()+smartserver conf progName c stateProxy = withProgName progName $ do+      putStrLn . ( "starting happs server" ++ ) =<< time+      control <- startSystemState stateProxy -- start the HAppS state system++      putStrLn . ( "happs state started" ++ ) =<< time++      tid <- forkIO $ simpleHTTP conf c+      putStrLn . ( ( "simpleHttp started on port " ++ (show . port $ conf) ++ "\n" +++                 "shut down with ctrl-c" ) ++) =<< time++      waitForTermination+      killThread tid+      putStrLn . ( "creating checkpoint: " ++ ) =<< time+      createCheckpoint control++      putStrLn .  ( "shutting down system: " ++ ) =<< time+      shutdownSystem control +      putStrLn .  ( "exiting: " ++ ) =<< time+         where time = return . ("\ntime: " ++ ) . show  =<< getClockTime
HAppSHelpers.cabal view
@@ -1,5 +1,5 @@ Name: HAppSHelpers-Version: 0.5+Version: 0.6 License: BSD3 License-file: bsd3.txt Description: Functions I found I was using repeatedly when programming HAppS based web-apps. @@ -12,10 +12,11 @@ Exposed-Modules: HAppS.Helpers,HAppS.Helpers.DirBrowse, HAppS.Helpers.HtmlOutput, HAppS.Helpers.HtmlOutput.Common,                   HAppS.Helpers.HtmlOutput.Menu, HAppS.Helpers.ParseRequest,HAppS.Helpers.Redirect,                   HAppS.Data.User.Password, HAppS.Server.CookieFixer, HAppS.Data.IxSet.Helpers+                 HAppS.Server.Helpers                   Build-Depends: base, mtl, HAppS-Server, hscolour, filepath, directory, bytestring,                HStringTemplate, HStringTemplateHelpers, safe, MissingH, containers, parsec, Crypto, haskell98,-               HAppS-IxSet, PBKDF2, random, HAppS-Data+               HAppS-IxSet, HAppS-State, PBKDF2, random, HAppS-Data, old-time Category: Distributed Computing Build-type: Simple