From 3251f8b6bc06ede86b6ec22d841eaf71111d6acb Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Thu, 24 Mar 2011 08:48:19 +0200 Subject: [PATCH] Call devel-server as separate executable --- Yesod.hs | 63 +++++++++++------------------------------------------ yesod.cabal | 13 ++--------- 2 files changed, 15 insertions(+), 61 deletions(-) diff --git a/Yesod.hs b/Yesod.hs index deaccfb9..a9053991 100644 --- a/Yesod.hs +++ b/Yesod.hs @@ -15,9 +15,7 @@ module Yesod -- * Running your application , warp , warpDebug -#if !PRODUCTION , develServer -#endif -- * Commonly referenced functions/datatypes , Application , lift @@ -62,9 +60,6 @@ import Yesod.Json import Yesod.Persist import Network.Wai (Application) import Network.Wai.Middleware.Debug -#if !PRODUCTION -import Network.Wai.Handler.DevelServer (runQuit) -#endif import Control.Monad.Trans.Class (lift) import Control.Monad.IO.Class (liftIO) import Control.Monad.IO.Peel (MonadPeelIO) @@ -72,12 +67,6 @@ import Control.Monad.IO.Peel (MonadPeelIO) import Network.Wai.Handler.Warp (run) import System.IO (stderr, hPutStrLn) -import qualified Data.Text.Lazy.IO as TIO -import qualified Data.Attoparsec.Text.Lazy as A -import Control.Applicative ((<|>)) -import Data.Maybe (mapMaybe) -import Data.Char (isSpace) - showIntegral :: Integral a => a -> String showIntegral x = show (fromIntegral x :: Integer) @@ -99,7 +88,6 @@ warpDebug port a = do hPutStrLn stderr $ "Application launched, listening on port " ++ show port toWaiApp a >>= run port . debug -#if !PRODUCTION -- | Run a development server, where your code changes are automatically -- reloaded. develServer :: Int -- ^ port number @@ -107,45 +95,20 @@ develServer :: Int -- ^ port number -> String -- ^ name of function providing a with-application -> IO () -develServer port modu func = do +develServer port modu func = mapM_ putStrLn - [ "Starting your server process. Code changes will be automatically" - , "loaded as you save your files. Type \"quit\" to exit." - , "You can view your app at http://localhost:" ++ show port ++ "/" + [ "Due to issues with GHC 7.0.2, you must now run the devel server" + , "separately. To do so, ensure you have installed the " + , "wai-handler-devel package >= 0.2.1 and run:" + , concat + [ " wai-handler-devel " + , show port + , " " + , modu + , " " + , func + , " --yesod" + ] , "" ] - runQuit port modu func determineHamletDeps -#endif - -data TempType = Hamlet | Cassius | Julius | Widget - deriving Show - --- | Determine which Hamlet files a Haskell file depends upon. -determineHamletDeps :: FilePath -> IO [FilePath] -determineHamletDeps x = do - y <- TIO.readFile x - let z = A.parse (A.many $ (parser <|> (A.anyChar >> return Nothing))) y - case z of - A.Fail{} -> return [] - A.Done _ r -> return $ mapMaybe go r - where - go (Just (Hamlet, f)) = Just $ "hamlet/" ++ f ++ ".hamlet" - go (Just (Widget, f)) = Just $ "hamlet/" ++ f ++ ".hamlet" - go _ = Nothing - parser = do - typ <- (A.string "$(hamletFile " >> return Hamlet) - <|> (A.string "$(cassiusFile " >> return Cassius) - <|> (A.string "$(juliusFile " >> return Julius) - <|> (A.string "$(widgetFile " >> return Widget) - <|> (A.string "$(Settings.hamletFile " >> return Hamlet) - <|> (A.string "$(Settings.cassiusFile " >> return Cassius) - <|> (A.string "$(Settings.juliusFile " >> return Julius) - <|> (A.string "$(Settings.widgetFile " >> return Widget) - A.skipWhile isSpace - _ <- A.char '"' - y <- A.many1 $ A.satisfy (/= '"') - _ <- A.char '"' - A.skipWhile isSpace - _ <- A.char ')' - return $ Just (typ, y) diff --git a/yesod.cabal b/yesod.cabal index 3ad00a7f..b1aff4e2 100644 --- a/yesod.cabal +++ b/yesod.cabal @@ -1,5 +1,5 @@ name: yesod -version: 0.7.1 +version: 0.7.2 license: BSD3 license-file: LICENSE author: Michael Snoyman @@ -18,21 +18,13 @@ extra-source-files: scaffold/*.cg flag ghc7 -flag production - Description: Skip the wai-handler-devel and hint dependencies. - Default: False - library - if flag(production) - cpp-options: -DPRODUCTION - else - build-depends: wai-handler-devel >= 0.2 && < 0.3 if flag(ghc7) build-depends: base >= 4.3 && < 5 cpp-options: -DGHC7 else build-depends: base >= 4 && < 4.3 - build-depends: yesod-core >= 0.7.0.1 && < 0.8 + build-depends: yesod-core >= 0.7.0.2 && < 0.8 , yesod-auth >= 0.3 && < 0.4 , yesod-json >= 0.0.0.1 && < 0.1 , yesod-persistent >= 0.0.0.1 && < 0.1 @@ -46,7 +38,6 @@ library , warp >= 0.3.2.1 && < 0.4 , mime-mail >= 0.1.0.1 && < 0.2 , hjsmin >= 0.0.12 && < 0.1 - , attoparsec-text >= 0.8.2.1 && < 0.9 exposed-modules: Yesod ghc-options: -Wall