2012-03-30 23:31:53 +04:00
|
|
|
{-# LANGUAGE PackageImports #-}
|
2012-11-15 21:48:48 +04:00
|
|
|
import "hledger-web" Application (getApplicationDev)
|
2014-05-23 20:02:20 +04:00
|
|
|
import Network.Wai.Handler.Warp (runSettings, defaultSettings, setPort)
|
2012-03-30 23:31:53 +04:00
|
|
|
import Control.Concurrent (forkIO)
|
|
|
|
import System.Directory (doesFileExist, removeFile)
|
|
|
|
import System.Exit (exitSuccess)
|
|
|
|
import Control.Concurrent (threadDelay)
|
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = do
|
|
|
|
putStrLn "Starting devel application"
|
|
|
|
(port, app) <- getApplicationDev
|
2014-05-23 20:02:20 +04:00
|
|
|
forkIO $ runSettings (setPort port defaultSettings) app
|
2012-03-30 23:31:53 +04:00
|
|
|
loop
|
|
|
|
|
|
|
|
loop :: IO ()
|
|
|
|
loop = do
|
|
|
|
threadDelay 100000
|
2012-11-15 21:48:48 +04:00
|
|
|
e <- doesFileExist "yesod-devel/devel-terminate"
|
2012-03-30 23:31:53 +04:00
|
|
|
if e then terminateDevel else loop
|
|
|
|
|
|
|
|
terminateDevel :: IO ()
|
|
|
|
terminateDevel = exitSuccess
|