Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

support for `yesod devel`

  • Loading branch information...
commit fa294852803e4695cc896257aff28e449757db78 1 parent 61f05c8
jannschu authored August 27, 2012
1  .gitignore
... ...
@@ -0,0 +1 @@
  1
+dist/
9  Application.hs
... ...
@@ -1,6 +1,7 @@
1 1
 {-# OPTIONS_GHC -fno-warn-orphans #-}
2 2
 module Application
3 3
     ( makeApplication
  4
+    , getApplicationDev
4 5
     , makeUIFoundation
5 6
     ) where
6 7
 
@@ -127,6 +128,14 @@ makeApplication conf = do
127 128
              ]
128 129
            return $ res'
129 130
 
  131
+getApplicationDev :: IO (Int, Application)
  132
+getApplicationDev =
  133
+    defaultDevelApp loader makeApplication
  134
+  where
  135
+    loader = loadConfig (configSettings Settings.Development)
  136
+        { csParseExtra = parseExtra 
  137
+        }
  138
+
130 139
 makeUIFoundation :: AppConfig BitloveEnv Extra -> DBPool -> IO UIApp
131 140
 makeUIFoundation conf pool = do
132 141
     manager <- newManager def
26  devel.hs
... ...
@@ -0,0 +1,26 @@
  1
+{-# LANGUAGE PackageImports #-}
  2
+import "bitlove-ui" Application (getApplicationDev)
  3
+import Network.Wai.Handler.Warp
  4
+    (runSettings, defaultSettings, settingsPort)
  5
+import Control.Concurrent (forkIO)
  6
+import System.Directory (doesFileExist, removeFile)
  7
+import System.Exit (exitSuccess)
  8
+import Control.Concurrent (threadDelay)
  9
+
  10
+main :: IO ()
  11
+main = do
  12
+    putStrLn "Starting devel application"
  13
+    (port, app) <- getApplicationDev
  14
+    forkIO $ runSettings defaultSettings
  15
+        { settingsPort = port
  16
+        } app
  17
+    loop
  18
+
  19
+loop :: IO ()
  20
+loop = do
  21
+  threadDelay 100000
  22
+  e <- doesFileExist "dist/devel-terminate"
  23
+  if e then terminateDevel else loop
  24
+
  25
+terminateDevel :: IO ()
  26
+terminateDevel = exitSuccess

0 notes on commit fa29485

Please sign in to comment.
Something went wrong with that request. Please try again.