yesod 0.7.1 → 0.7.2
raw patch · 5 files changed
+32/−63 lines, 5 filesdep −attoparsec-textdep −wai-handler-develdep ~yesod-core
Dependencies removed: attoparsec-text, wai-handler-devel
Dependency ranges changed: yesod-core
Files
- Yesod.hs +13/−50
- scaffold.hs +5/−2
- scaffold/StaticFiles_hs.cg +11/−0
- scaffold/sitearg_hs.cg +1/−0
- yesod.cabal +2/−11
Yesod.hs view
@@ -15,9 +15,7 @@ -- * Running your application , warp , warpDebug-#if !PRODUCTION , develServer-#endif -- * Commonly referenced functions/datatypes , Application , lift@@ -62,9 +60,6 @@ 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 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 @@ 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 @@ -> 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)
scaffold.hs view
@@ -79,7 +79,8 @@ mkDir "hamlet" mkDir "cassius" mkDir "julius"-+ mkDir "static"+ writeFile' "test.hs" $(codegen "test_hs") writeFile' "production.hs" $(codegen "production_hs") writeFile' "devel-server.hs" $(codegen "devel-server_hs")@@ -90,6 +91,7 @@ writeFile' "Handler/Root.hs" $(codegen "Root_hs") writeFile' "Model.hs" $(codegen "Model_hs") writeFile' "Settings.hs" $(codegen "Settings_hs")+ writeFile' "StaticFiles.hs" $(codegen "StaticFiles_hs") writeFile' "cassius/default-layout.cassius" $(codegen "default-layout_cassius") writeFile' "hamlet/default-layout.hamlet"@@ -97,8 +99,9 @@ writeFile' "hamlet/homepage.hamlet" $(codegen "homepage_hamlet") writeFile' "cassius/homepage.cassius" $(codegen "homepage_cassius") writeFile' "julius/homepage.julius" $(codegen "homepage_julius")-+ S.writeFile (dir ++ "/favicon.ico") $(runIO (S.readFile "scaffold/favicon_ico.cg") >>= \bs -> do pack <- [|S.pack|] return $ pack `AppE` LitE (StringL $ S.unpack bs))+
+ scaffold/StaticFiles_hs.cg view
@@ -0,0 +1,11 @@+{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-}+module StaticFiles where+import Yesod+import Yesod.Helpers.Static++-- | This generates easy references to files in the static directory at compile time.+-- The upside to this is that you have compile-time verification that referenced files+-- exist. However, any files added to your static directory during run-time can't be+-- accessed this way. You'll have to use their FilePath or URL to access them.+$(staticFiles "static")+
scaffold/sitearg_hs.cg view
@@ -25,6 +25,7 @@ import Database.Persist.GenericSql import Settings (hamletFile, cassiusFile, juliusFile, widgetFile) import Model+import StaticFiles import Data.Maybe (isJust) import Control.Monad (join, unless) import Network.Mail.Mime
yesod.cabal view
@@ -1,5 +1,5 @@ name: yesod-version: 0.7.1+version: 0.7.2 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -18,21 +18,13 @@ 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 @@ , 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