Skip to content

Commit

Permalink
Changes for Keter.
Browse files Browse the repository at this point in the history
stdout flushing for logs, and autoclones content.
  • Loading branch information
snoyberg committed May 17, 2012
1 parent 19fcbaf commit b2325c3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Application.hs
Expand Up @@ -21,6 +21,12 @@ import Data.IORef (newIORef, writeIORef)
import System.Process (runProcess, waitForProcess)
import Yesod.Static (Static (Static))
import Network.Wai.Application.Static (defaultFileServerSettings, ssFolder, fileSystemLookup)
import Control.Monad (unless, forever)
import Filesystem (isDirectory)
import System.Process (rawSystem)
import System.Exit (ExitCode (ExitSuccess), exitWith)
import Control.Concurrent (forkIO, threadDelay)
import Yesod.Logger (flushLogger)

-- Import all relevant handler modules here.
import Handler.Root
Expand All @@ -40,6 +46,15 @@ mkYesodDispatch "YesodWeb" resourcesYesodWeb
-- migrations handled by Yesod.
getApplication :: AppConfig DefaultEnv Extra -> Logger -> IO Application
getApplication conf logger = do
_ <- forkIO $ forever $ do
threadDelay $ 1000 * 1000
flushLogger logger

exists <- isDirectory "content"
unless exists $ do
ec <- rawSystem "git" ["clone", "https://github.com/yesodweb/yesodweb.com-content.git", "content"]
unless (ec == ExitSuccess) $ exitWith ec

s <- staticSite
let assets = Static defaultFileServerSettings { ssFolder = fileSystemLookup "content/static" }

Expand Down

0 comments on commit b2325c3

Please sign in to comment.